@bloopjs/toodle / backends/webgpu/TextureComputeShader / TextureComputeShader
Class: TextureComputeShader
Defined in: backends/webgpu/TextureComputeShader.ts:31
A GPU-based texture processor that uses compute shaders to:
- Find the non-transparent bounding box in a texture.
- Crop the texture to that bounding box.
- Create a fallback texture if no non-transparent pixels are found.
Constructors
Constructor
new TextureComputeShader(
device,cropPipeline,boundPipeline,missingTexturePipeline):TextureComputeShader
Defined in: backends/webgpu/TextureComputeShader.ts:38
Parameters
device
GPUDevice
cropPipeline
GPUComputePipeline
boundPipeline
GPUComputePipeline
missingTexturePipeline
GPUComputePipeline
Returns
TextureComputeShader
Methods
processTexture()
processTexture(
textureWrapper):Promise<TextureWithMetadata>
Defined in: backends/webgpu/TextureComputeShader.ts:76
Main entry point to process a texture. Returns a cropped ImageBitmap and metadata.
Parameters
textureWrapper
Returns
Promise<TextureWithMetadata>
create()
staticcreate(device):TextureComputeShader
Defined in: backends/webgpu/TextureComputeShader.ts:62
Factory method to initialize pipelines and return an instance of TextureComputeShader.
Parameters
device
GPUDevice
Returns
TextureComputeShader