]> git.mxchange.org Git - flightgear.git/commit
Make a subtle change to tile loading/unloading policy in order to make the tile
authorcurt <curt>
Wed, 15 Sep 2004 15:52:05 +0000 (15:52 +0000)
committercurt <curt>
Wed, 15 Sep 2004 15:52:05 +0000 (15:52 +0000)
commitcc3d0221ea5fb1def56f53305560829fc66c2ab6
tree882408436057833ec912619f735d2ae09d383e75
parent5a8bb823edcc662b46c0a9a9b8775087c56b2ad1
Make a subtle change to tile loading/unloading policy in order to make the tile
paging system much more robust when position change is very rapid and sporadic.

Recall that we must load 3d models in the main render thread because model
loading can trigger opengl calls (i.e. with texture loading) and all opengl
calls *must* happen in the main render thread.

To accomplish this we load the base tile in the pager thread and build a work
queue of external models that need to be loaded.  We never allow a tile to be
paged out of the tile cache until all it's pending model loads are complete.

However, when changing position very rapidly, we can quickly create a huge
backlog of pending model loads because we are changing positions faster than we
can load the associated models for the existing tiles.  The end result is
that tiles that are long out of range can't be removed because there is still
a huge backlog of pending model load requests and memory blows up.

This change being committed allows the tile paging system to remove tiles
if they are out of range, even when there are pending models to load.  The
model loading code in the render thread can now check to see if the tile
exists and discard any model load request for tiles that no longer exist.

This situation should never occur in normal operation, but could occur in
"contrived" situations where an external script was rapidly changing
the simulator position to then be able to query FG terrain height, and doing
this for a large number of points that are distributed across a large area.
src/Scenery/newcache.cxx
src/Scenery/tileentry.cxx
src/Scenery/tileentry.hxx
src/Scenery/tilemgr.cxx