playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
118 lines (117 loc) • 3.64 kB
TypeScript
/**
* A WebGPU implementation of the Shader.
*
* @ignore
*/
export class WebgpuShader {
/**
* @param {Shader} shader - The shader.
*/
constructor(shader: Shader);
/**
* Transpiled vertex shader code.
*
* @type {string|null}
*/
_vertexCode: string | null;
/**
* Transpiled fragment shader code.
*
* @type {string|null}
*/
_fragmentCode: string | null;
/**
* Compute shader code.
*
* @type {string|null}
*/
_computeCode: string | null;
/**
* Cached content-based key for compute shader.
*
* @type {number|undefined}
* @private
*/
private _computeKey;
/**
* Caller-provided bind group format (compute, group 0), or null if none was supplied.
*
* @type {import('../bind-group-format.js').BindGroupFormat|null}
*/
computeBindGroupFormat: import("../bind-group-format.js").BindGroupFormat | null;
/**
* Bind group format for resources auto-reflected from the compute shader source. Lives at
* {@link computeReflectedGroupIndex}. Null when there is nothing to reflect.
*
* @type {import('../bind-group-format.js').BindGroupFormat|null}
*/
computeReflectedBindGroupFormat: import("../bind-group-format.js").BindGroupFormat | null;
/**
* Generated uniform buffer format holding the reflected loose uniforms, bound inside the
* reflected bind group. Null when the shader declares no loose uniforms.
*
* @type {import('../uniform-buffer-format.js').UniformBufferFormat|null}
*/
computeReflectedUniformBufferFormat: import("../uniform-buffer-format.js").UniformBufferFormat | null;
/**
* Bind group index of the reflected resources (0 when no caller format, otherwise 1).
*
* @type {number}
*/
computeReflectedGroupIndex: number;
/**
* Name of the vertex entry point function.
*/
vertexEntryPoint: string;
/**
* Name of the fragment entry point function.
*/
fragmentEntryPoint: string;
/**
* Name of the compute entry point function.
*/
computeEntryPoint: string;
/** @type {Shader} */
shader: Shader;
/**
* Free the WebGPU resources associated with a shader.
*
* @param {Shader} shader - The shader to free.
*/
destroy(shader: Shader): void;
createShaderModule(code: any, shaderType: any): any;
getVertexShaderModule(): any;
getFragmentShaderModule(): any;
getComputeShaderModule(): any;
processGLSL(): void;
processed: any;
processComputeWGSL(): void;
computeUniformBufferFormats: {
[x: string]: import("../uniform-buffer-format.js").UniformBufferFormat;
};
processWGSL(): void;
transpile(src: any, shaderType: any, originalSrc: any): any;
get vertexCode(): string;
get fragmentCode(): string;
/**
* Content-based key for compute shader caching. Returns the same key for identical
* shader code and entry point combinations, regardless of how many Shader instances exist.
*
* @type {number}
* @ignore
*/
get computeKey(): number;
/**
* Dispose the shader when the context has been lost.
*/
loseContext(): void;
/**
* Restore shader after the context has been obtained.
*
* @param {GraphicsDevice} device - The graphics device.
* @param {Shader} shader - The shader to restore.
*/
restoreContext(device: GraphicsDevice, shader: Shader): void;
}
import type { Shader } from '../shader.js';
import type { GraphicsDevice } from '../graphics-device.js';