Skip to content

@bloopjs/toodle


@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:

  1. Find the non-transparent bounding box in a texture.
  2. Crop the texture to that bounding box.
  3. 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 ​

TextureWithMetadata

Returns ​

Promise<TextureWithMetadata>


create() ​

static create(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