The graphics device.
The vertex shader code.
The fragment shader code.
Unique name for the shader. If a shader with this name already exists, it will be returned instead of a new shader instance.
Optional
attributes: {}Object detailing the mapping of vertex shader attribute names to semantics SEMANTIC_*. This enables the engine to match vertex buffer data as inputs to the shader. Defaults to undefined, which generates the default attributes.
Optional
useTransformFeedback: boolean | Record<string, string | boolean | string[]> = falseWhether to use transform feedback. Defaults to false.
Optional
shaderDefinitionOptions: { Additional options that will be added to the shader definition.
Fragment shader output types, which default to vec4. Passing a string will set the output type for all color attachments. Passing an array will set the output type for each color attachment.
Whether to use transform feedback. Defaults to false.
The newly created shader.
Create a shader from the supplied source code. Note that this function adds additional shader blocks to both vertex and fragment shaders, which allow the shader to use more features and compile on both WebGL and WebGPU. Specifically, these blocks are added, and should not be part of provided vsCode and fsCode: shader version, shader precision, commonly used extensions.