UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

86 lines (85 loc) 2.83 kB
/** * A WebGPU implementation of the Texture. * * @ignore */ export class WebgpuTexture { constructor(texture: any); /** * @type {GPUTexture} * @private */ private gpuTexture; /** * @type {GPUTextureView} * @private */ private view; /** * An array of samplers, addressed by SAMPLETYPE_*** constant, allowing texture to be sampled * using different samplers. Most textures are sampled as interpolated floats, but some can * additionally be sampled using non-interpolated floats (raw data) or compare sampling * (shadow maps). * * @type {GPUSampler[]} * @private */ private samplers; /** * @type {GPUTextureDescriptor} * @private */ private desc; /** * @type {GPUTextureFormat} * @private */ private format; /** * A cache of texture views keyed by TextureView.key, used for storage texture bindings. * * @type {Map<number, GPUTextureView>} * @private */ private viewCache; /** @type {Texture} */ texture: Texture; create(device: any): void; destroy(device: any): void; propertyChanged(flag: any): void; /** * Returns a texture view. If a TextureView is provided, returns a cached view for those * specific parameters (creating it if needed). Otherwise returns the default view. * * @param {WebgpuGraphicsDevice} device - The graphics device. * @param {TextureView} [textureView] - Optional TextureView specifying view parameters. * @returns {GPUTextureView} - Returns the view. * @private */ private getView; createView(viewDescr: any): any; /** * @param {any} device - The Graphics Device. * @param {number} [sampleType] - A sample type for the sampler, SAMPLETYPE_*** constant. If not * specified, the sampler type is based on the texture format / texture sampling type. * @returns {any} - Returns the sampler. */ getSampler(device: any, sampleType?: number): any; loseContext(): void; /** * @param {WebgpuGraphicsDevice} device - The graphics device. * @param {Texture} texture - The texture. */ uploadImmediate(device: WebgpuGraphicsDevice, texture: Texture): void; /** * @param {WebgpuGraphicsDevice} device - The graphics * device. */ uploadData(device: WebgpuGraphicsDevice): void; isExternalImage(image: any): boolean; uploadExternalImage(device: any, image: any, mipLevel: any, index: any): void; uploadTypedArrayData(device: any, data: any, mipLevel: any, index: any): void; read(x: any, y: any, width: any, height: any, options: any): Promise<any>; } import type { Texture } from '../texture.js'; import type { WebgpuGraphicsDevice } from './webgpu-graphics-device.js';