Skip to content

Documentation / @ripl/webgpu / TextureManager

Class: TextureManager ​

Defined in: webgpu/src/texture.ts:34

Uploads Texture images to the GPU and caches the bind groups built from them.

Every draw binds group 2, textured or not: an untextured mesh gets a 1×1 opaque white fallback so the pipeline layout never changes, which is what keeps the backend on a single pipeline rather than one permutation per material.

Constructors ​

Constructor ​

new TextureManager(device, layout): TextureManager

Defined in: webgpu/src/texture.ts:46

Parameters ​

ParameterTypeDescription
deviceGPUDeviceThe device to allocate textures and samplers on.
layoutGPUBindGroupLayoutThe bind group layout for group 2.

Returns ​

TextureManager

Methods ​

destroy() ​

destroy(): void

Defined in: webgpu/src/texture.ts:82

Releases every uploaded texture, leaving the manager permanently inert.

Returns ​

void


getBindGroup() ​

getBindGroup(texture): GPUBindGroup

Defined in: webgpu/src/texture.ts:57

Returns the bind group for a texture, uploading it if it is new or has changed.

Parameters ​

ParameterTypeDescription
textureTexture | undefinedThe texture to bind, or undefined for the untextured fallback.

Returns ​

GPUBindGroup

The bind group to set at index 2.