Skip to main content

Function: runGpuMemoryCalibration()

runGpuMemoryCalibration(options): Promise<GpuMemoryCalibration>

Experimental

Allocates GPU memory in growing steps until the GPU fails, and records the largest size that worked. It runs in a WebGL context of its own, outside the viewports, so the result is the texture memory with the viewer open.

  • The first step is 90 % of the failed size of the last failure, and each step adds 10 % of the first step, up to 32 GB.
  • Before each step, a record of the step is stored, so a run that stops the tab is recorded by the next page of the tab, and a wait for WebGL starts in every tab, so the other tabs upload no large texture meanwhile.
  • The run ends at a lost context or OUT_OF_MEMORY. Its result goes in the history of the record (see getGpuMemoryHistory), and GPU_MEMORY_CALIBRATED fires. The suggested limit then follows it.
  • In Chromium the viewports lose their contexts with the context of the run, so the application reloads the page when the wait ends, as after any failure.
  • A page that the user closes or leaves during the run removes the record of its step (pagehide), so the run records nothing. A tab that the system stops gets no pagehide, and its record stays.

It runs only when the application calls it, never at the start of a page. It rejects when canRunGpuMemoryCalibration() is false.

Parameters​

• options: RunGpuMemoryCalibrationOptions = {}

Returns​

Promise<GpuMemoryCalibration>

the result, when the page survives the run

It may change in a later 5.x version.

Defined in​

packages/core/src/utilities/gpuMemoryCalibration.ts:163