@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
99 lines (98 loc) • 3.71 kB
TypeScript
/**
* A representation of a compute shader with the associated resources, that can be executed on the
* GPU. Only supported on WebGPU platform.
*/
export class Compute {
/**
* Create a compute instance. Note that this is supported on WebGPU only and is a no-op on
* other platforms.
*
* @param {import('./graphics-device.js').GraphicsDevice} graphicsDevice -
* The graphics device.
* @param {import('./shader.js').Shader} shader - The compute shader.
* @param {string} [name] - The name of the compute instance, used for debugging only.
*/
constructor(graphicsDevice: import("./graphics-device.js").GraphicsDevice, shader: import("./shader.js").Shader, name?: string);
/**
* A compute shader.
*
* @type {import('./shader.js').Shader|null}
* @ignore
*/
shader: import("./shader.js").Shader | null;
/**
* The non-unique name of an instance of the class. Defaults to 'Unnamed'.
*
* @type {string}
*/
name: string;
/**
* @type {Map<string, ComputeParameter>}
* @ignore
*/
parameters: Map<string, ComputeParameter>;
/**
* @type {number}
* @ignore
*/
countX: number;
/**
* @type {number|undefined}
* @ignore
*/
countY: number | undefined;
/**
* @type {number|undefined}
* @ignore
*/
countZ: number | undefined;
device: import("./graphics-device.js").GraphicsDevice;
impl: any;
/**
* Sets a shader parameter on a compute instance.
*
* @param {string} name - The name of the parameter to set.
* @param {number|number[]|Float32Array|import('./texture.js').Texture|import('./storage-buffer.js').StorageBuffer|import('./vertex-buffer.js').VertexBuffer|import('./index-buffer.js').IndexBuffer} value
* - The value for the specified parameter.
*/
setParameter(name: string, value: number | number[] | Float32Array | import("./texture.js").Texture | import("./storage-buffer.js").StorageBuffer | import("./vertex-buffer.js").VertexBuffer | import("./index-buffer.js").IndexBuffer): void;
/**
* Returns the value of a shader parameter from the compute instance.
*
* @param {string} name - The name of the parameter to get.
* @returns {number|number[]|Float32Array|import('./texture.js').Texture|import('./storage-buffer.js').StorageBuffer|import('./vertex-buffer.js').VertexBuffer|import('./index-buffer.js').IndexBuffer|undefined}
* The value of the specified parameter.
*/
getParameter(name: string): number | number[] | Float32Array | import("./texture.js").Texture | import("./storage-buffer.js").StorageBuffer | import("./vertex-buffer.js").VertexBuffer | import("./index-buffer.js").IndexBuffer | undefined;
/**
* Deletes a shader parameter from the compute instance.
*
* @param {string} name - The name of the parameter to delete.
*/
deleteParameter(name: string): void;
/**
* Apply the parameters to the scope.
*
* @ignore
*/
applyParameters(): void;
/**
* Prepare the compute work dispatch.
*
* @param {number} x - X dimension of the grid of work-groups to dispatch.
* @param {number} [y] - Y dimension of the grid of work-groups to dispatch.
* @param {number} [z] - Z dimension of the grid of work-groups to dispatch.
*/
setupDispatch(x: number, y?: number, z?: number): void;
}
/**
* A helper class storing a parameter value as well as its scope ID.
*
* @ignore
*/
declare class ComputeParameter {
value: any;
/** @type {import('./scope-id.js').ScopeId} */
scopeId: import("./scope-id.js").ScopeId;
}
export {};