playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
90 lines (89 loc) • 2.37 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;
/**
* 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;
computeUniformBufferFormats: any;
computeBindGroupFormat: any;
/**
* 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;
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';