Skip to content

@tmrw-realityos/charm


@tmrw-realityos/charm / createTextureFromKTX2Data

Function: createTextureFromKTX2Data()

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

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

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

Parameters

device

GPUDevice

GPU device

data

Uint8Array

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?

(texture) => void

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

Returns

WebGPUTexture

WebGPU texture in compressed format