RenderPipelineEntry constructor
parameters used to create this RenderPipelineEntry
The type of the PipelineEntry
The Renderer used to create this PipelineEntry
Readonly
indexIndex of this PipelineEntry, i.e. creation order
GPUPipelineLayout | Pipeline layout created based on the given bind groups
The GPU pipeline
The pipeline compilation status
bind groups used to patch the shaders and create the pipeline layout
Shaders to use with this RenderPipelineEntry
Geometry attributes sent to the RenderPipelineEntry
Options used to create this RenderPipelineEntry
Get whether the pipeline is ready, i.e. successfully compiled
Get whether the pipeline is ready to be compiled, i.e. we have not already tried to compile it, and it's not currently compiling neither
Get whether the shaders modules have been created
Set our pipeline entry bind groups
bind groups to use with this PipelineEntry
Create a GPUShaderModule
Parameters used
patched WGSL code string
Create the pipeline entry layout
Flush a PipelineEntry, i.e. reset its bind groups, layout and descriptor and recompile the pipeline Used when one of the bind group or rendering property has changed
new bind groups in case they have changed
Set RenderPipelineEntry properties (in this case the bind groups and attributes)
the bind groups and attributes to use
Patch the shaders by appending all the necessary shader chunks, bind groups) and attributes WGSL code fragments to the given parameter shader code
Create the shaders: patch them and create the GPUShaderModule
Create the render pipeline descriptor
Create the render pipeline
Asynchronously create the render pipeline
Call PipelineEntry compilePipelineEntry method, then create our render pipeline
Used to create a PipelineEntry specifically designed to handle RenderMaterial.
Shaders patching
The RenderPipelineEntry uses each of its bind groups Binding to patch the given vertex and fragment shaders before creating the GPUShaderModule.
It will prepend every Binding WGSL code snippets (or fragments) with the correct bind group and bindings indices.
Pipeline compilation
The RenderPipelineEntry will then create a GPURenderPipeline (asynchronously by default).
Default attributes and uniforms
Attributes
Attributes are only added to the vertex shaders. They are generated based on the Geometry used and may vary in case you're using a geometry with custom attributes. Here are the default ones:
Uniforms
If the Mesh is one of Mesh, DOMMesh or Plane, some additional uniforms are added to the shaders.
Vertex shaders
Fragment shaders
Helpers
Finally, some helpers functions are added to the shaders as well.
Vertex and fragment shaders
To help you compute scaled UV based on a texture matrix, this function is always added to both vertex and fragment shaders:
Vertex shaders
If the Mesh is one of Mesh, DOMMesh or Plane, some functions are added to the vertex shader to help you compute the vertices positions and normals.
Position
Position helper function:
Note that it is not mandatory to use it. If you want to do these computations yourself, you are free to do it the way you like most. You could for example use this formula instead:
Normal
The normal matrix provided, available as
matrices.normal
, is computed in world space (i.e. it is the inverse transpose of the world matrix). A couple helpers functions are added to help you compute the normals in the right space:Fragment shaders
Last but not least, those couple functions are added to the fragment shaders to help you convert vertex positions to UV coordinates: