Builds an IrModule: module-scope constants, resource bindings with (group, binding) uniqueness validation, and functions.
More...
#include "donner/gpu/shader/IrModule.h"
|
|
| ModuleBuilder ()=default |
| | Constructs an empty module builder.
|
|
| ModuleBuilder (const ModuleBuilder &)=delete |
|
ModuleBuilder & | operator= (const ModuleBuilder &)=delete |
|
| ModuleBuilder (ModuleBuilder &&)=delete |
|
ModuleBuilder & | operator= (ModuleBuilder &&)=delete |
|
| ~ModuleBuilder ()=default |
| | Destructor.
|
| ShaderStatus | addConstant (const RcString &name, const IrExpr &value) |
| | Adds a module-scope constant with a literal value (e.g.
|
| ShaderStatus | addUniformBuffer (uint32_t group, uint32_t binding, const RcString &name, const IrType &structType) |
| | Adds a uniform buffer binding.
|
| ShaderStatus | addReadOnlyStorageBuffer (uint32_t group, uint32_t binding, const RcString &name, const IrType &type) |
| | Adds a read-only storage buffer binding with a runtime array or struct type.
|
| ShaderStatus | addTexture2d (uint32_t group, uint32_t binding, const RcString &name) |
| | Adds a texture_2d<f32> binding.
|
| ShaderStatus | addSampler (uint32_t group, uint32_t binding, const RcString &name) |
| | Adds a filtering sampler binding.
|
| ShaderResult< FunctionBuilder > | createFunction (const RcString &name, std::vector< IrParam > params, const std::optional< IrType > &returnType) |
| | Starts a plain function.
|
| ShaderResult< FunctionBuilder > | createVertexEntryPoint (const RcString &name, std::vector< IrParam > params, std::vector< IrOutputMember > outputs) |
| | Starts a vertex entry point.
|
| ShaderResult< FunctionBuilder > | createFragmentEntryPoint (const RcString &name, std::vector< IrParam > params, std::vector< IrOutputMember > outputs) |
| | Starts a fragment entry point.
|
|
ShaderResult< IrModule > | build () |
| | Finalizes and returns the module. Fails if any recorded error is pending.
|
Builds an IrModule: module-scope constants, resource bindings with (group, binding) uniqueness validation, and functions.
◆ addConstant()
Adds a module-scope constant with a literal value (e.g.
a u32 sentinel).
- Parameters
-
| name | Constant name; must be unique at module scope. |
| value | Literal expression. |
◆ addReadOnlyStorageBuffer()
| ShaderStatus donner::gpu::shader::ModuleBuilder::addReadOnlyStorageBuffer |
( |
uint32_t | group, |
|
|
uint32_t | binding, |
|
|
const RcString & | name, |
|
|
const IrType & | type ) |
Adds a read-only storage buffer binding with a runtime array or struct type.
- Parameters
-
| group | Bind group index. |
| binding | Binding index; (group, binding) must be unique. |
| name | Binding name; must be unique at module scope. |
| type | Runtime array or struct type. |
◆ addSampler()
| ShaderStatus donner::gpu::shader::ModuleBuilder::addSampler |
( |
uint32_t | group, |
|
|
uint32_t | binding, |
|
|
const RcString & | name ) |
Adds a filtering sampler binding.
- Parameters
-
| group | Bind group index. |
| binding | Binding index; (group, binding) must be unique. |
| name | Binding name; must be unique at module scope. |
◆ addTexture2d()
| ShaderStatus donner::gpu::shader::ModuleBuilder::addTexture2d |
( |
uint32_t | group, |
|
|
uint32_t | binding, |
|
|
const RcString & | name ) |
Adds a texture_2d<f32> binding.
- Parameters
-
| group | Bind group index. |
| binding | Binding index; (group, binding) must be unique. |
| name | Binding name; must be unique at module scope. |
◆ addUniformBuffer()
| ShaderStatus donner::gpu::shader::ModuleBuilder::addUniformBuffer |
( |
uint32_t | group, |
|
|
uint32_t | binding, |
|
|
const RcString & | name, |
|
|
const IrType & | structType ) |
Adds a uniform buffer binding.
- Parameters
-
| group | Bind group index. |
| binding | Binding index; (group, binding) must be unique. |
| name | Binding name; must be unique at module scope. |
| structType | Uniform struct type. |
◆ createFragmentEntryPoint()
Starts a fragment entry point.
Parameters must have unique locations; outputs must include a location-0 vec4<f32> color.
- Parameters
-
| name | Entry point name; must be unique at module scope. |
| params | Stage inputs. |
| outputs | Stage outputs. |
◆ createFunction()
| ShaderResult< FunctionBuilder > donner::gpu::shader::ModuleBuilder::createFunction |
( |
const RcString & | name, |
|
|
std::vector< IrParam > | params, |
|
|
const std::optional< IrType > & | returnType ) |
Starts a plain function.
Finish it with FunctionBuilder::finish() before starting the next function.
- Parameters
-
| name | Function name; must be unique at module scope. |
| params | Parameters (types must be plain data or texture/sampler for helpers). |
| returnType | Return type, or empty for void. |
◆ createVertexEntryPoint()
Starts a vertex entry point.
Parameters may carry the instance_index builtin (u32) or unique locations; outputs must contain exactly one position builtin (vec4<f32>) plus uniquely-located outputs.
- Parameters
-
| name | Entry point name; must be unique at module scope. |
| params | Stage inputs. |
| outputs | Stage outputs. |
The documentation for this class was generated from the following file: