Advanced
Create a new GpuProgram
The options for the gpu program
if true, the program will automatically assign global uniforms to group[0]
if true, the program will automatically assign local uniforms to group[1]
Optional
Readonly
fragmentThe fragment glsl shader source.
Readonly
gpuConfiguration for the WebGPU bind group layouts, detailing resource organization for the shader. Generated from shader sources if not explicitly provided.
// Assuming a shader program that requires two bind groups:
[
// First bind group layout entries
[{ binding: 0, visibility: GPUShaderStage.VERTEX, type: "uniform-buffer" }],
// Second bind group layout entries
[{ binding: 1, visibility: GPUShaderStage.FRAGMENT, type: "sampler" },
{ binding: 2, visibility: GPUShaderStage.FRAGMENT, type: "sampled-texture" }]
]
Readonly
layoutMapping of uniform names to group indexes for organizing shader program uniforms. Automatically generated from shader sources if not provided.
Readonly
namethe name of the program, this is added to the label of the GPU Program created under the hood. Makes it much easier to debug!
Readonly
structsthe structs and groups extracted from the shader sources
Optional
Readonly
vertexThe vertex glsl shader source
destroys the program
Static
fromHelper function that creates a program for a given source. It will check the program cache if the program has already been created. If it has that one will be returned, if not a new one will be created and cached.
The options for the program.
A program using the same source
A wrapper for a WebGPU Program, specifically designed for the WebGPU renderer. This class facilitates the creation and management of shader code that integrates with the WebGPU pipeline.
To leverage the full capabilities of this class, familiarity with WGSL shaders is recommended.
See
https://gpuweb.github.io/gpuweb/#index
Example