Class WebGpuResourceRecycler
- Namespace
- LansMap.Map.TilePipeline
Disposes every idle pooled tile GPU resource on a fixed cadence of map switches, as a stability workaround for browsers whose WebGPU backend degrades after many repeated GPU operations.
public static class WebGpuResourceRecycler
- Inheritance
-
objectWebGpuResourceRecycler
Remarks
When a buyer opts a TileResourcePool into Always retention (no longer WebGL's own default), the pool keeps tile GPU stacks alive across scene switches so a revisit reuses them. Some browser WebGPU backends (documented on iOS Safari) can crash the page after enough scene switches even with memory flat; periodically releasing everything the pool holds forces the browser to free the backend objects and starts the next build from a clean slate. Under the default Never retention (every platform, including WebGL) the pool never holds anything, so this type is inert there too - it only does work once a buyer opts into Always. Set RecycleEveryNthSwitch to 0 to turn the workaround off.
Fields
DefaultRecycleEveryNthSwitch
Default number of map switches between recycles.
public const int DefaultRecycleEveryNthSwitch = 8
Field Value
Properties
RecycleEveryNthSwitch
How many map switches (scene loads, fullscreen/tabletop toggles) pass between recycles. 0 or negative turns the workaround off.
public static int RecycleEveryNthSwitch { get; set; }
Property Value
SwitchCountForTests
Switches counted since the last recycle, for tests.
public static int SwitchCountForTests { get; }
Property Value
Methods
NoteSwitch()
Records one map switch and recycles the idle pooled resources when the cadence comes due.
public static void NoteSwitch()
ResetForTests()
Resets the switch counter and cadence to defaults. Call from test teardown: this is process-wide static state.
public static void ResetForTests()