Skip to content

@tmrw-realityos/charmDocs


@tmrw-realityos/charm / createTextureFromKTX2Data

Function: createTextureFromKTX2Data()

createTextureFromKTX2Data(device, data, existingLoader?, existingTexture?, onComplete?): WebGPUTexture

Create a GPU texture in compressed or uncompressed format, depending on device features.

Parameters

device: GPUDevice

GPU device

data: ArrayBuffer

KTX data as arraybuffer

existingLoader?: KTX2TextureLoader

Existing KTX2 texture loader.

existingTexture?: WebGPUTexture

Existing target texture to load data into. If undefined, a new WebGPUTexture instance is returned.

onComplete?

Callback when the texture data is decoded and written to the GPUTexture handle.

Returns

WebGPUTexture

WebGPU texture in compressed format

Defined in

packages/charm/src/graphics/WebGPU/WebGPUTextureTools.ts:34