GPUDeviceManager constructor
parameters used to create this GPUDeviceManager.
Number of times a GPUDevice has been created.
The label of the GPUDeviceManager, used to create the GPUDevice for debugging purpose.
Flag indicating whether we're running the production mode or not. If not, useful warnings could be logged to the console.
The navigator GPU object.
The WebGPU adapter used.
Additional options to use when requesting an adapter.
The WebGPU device used.
Flag indicating whether the GPUDeviceManager is ready, i.e. its adapter and device have been successfully created.
The PipelineManager used to cache GPURenderPipeline and GPUComputePipeline and set them only when appropriate.
Array of renderers using that GPUDeviceManager.
A Map containing all our created AllowedBindGroups.
An array containing all our created GPUBuffer.
A Map containing all our created IndirectBuffer.
A Map containing all our created GPUBindGroupLayout indexed by cache keys.
A Map containing all our created BufferBinding indexed by cache keys.
An array containing all our created Sampler.
An array to keep track of the newly uploaded MediaTexture and set their sourceUploaded property.
Index of the source in the MediaTexture#sources array.
MediaTexture to handle.
Request animation frame callback returned id if used.
function assigned to the onBeforeRender callback.
function assigned to the onAfterRender callback.
Callback to run whenever the device is lost.
Callback to run whenever the device has been intentionally destroyed.
Get all the rendered objects (i.e. compute passes, meshes, ping pong planes and shader passes) created by this GPUDeviceManager.
GPUAdapter and/or GPUDevice to use if set.
GPUAdapter and/or GPUDevice to use if set.
Set our adapter if possible. The adapter represents a specific GPU. Some devices have multiple GPUs.
GPUAdapter to use if set.
Set our pipeline manager.
Called when the device is lost. Reset all our renderers.
Called when the device should be restored. Restore all our renderers.
GPUAdapter and/or GPUDevice to use if set.
Add a bind group to our bind groups array.
bind group to add.
Remove a bind group from our bind groups array.
bind group to remove.
Copy an external image to the GPU.
Upload a texture to the GPU.
MediaTexture containing the GPUTexture to upload.
Index of the source to upload (for cube maps). Default to 0
.
Mips generation helper on the GPU using our device. Caches sampler, module and pipeline (by GPUTexture formats) for faster generation. Ported from https://webgpufundamentals.org/webgpu/lessons/webgpu-importing-textures.html
Texture for which to generate the mips.
optional GPUCommandEncoder to use if we're already in the middle of a command encoding process.
Called each frame before rendering.
callback to run at each render.
Called each frame after rendering.
callback to run at each render.
Render everything:
Destroy the GPUDeviceManager and its renderers.
Responsible for the WebGPU adapter and device creations, losing and restoration.
It will create all the GPU objects that need a device to do so, as well as a PipelineManager. It will also keep a track of all the Renderer, bind groups, Sampler, MediaTexture and GPU buffers created.
The GPUDeviceManager is also responsible for creating the GPUCommandBuffer, rendering all the Renderer and then submitting the GPUCommandBuffer at each render calls.