Struct that contains all the parameters that Kanzi needs to create a ShaderProgram. More...
#include <kanzi/core.ui/platform/graphics_backend/gl/shader_create_info.hpp>
Public Types | |
using | BindingContainer = ShaderProgram::BindingContainer |
Binding container type. More... | |
using | BindingInfo = ShaderProgram::BindingInfo |
Binding info. More... | |
enum | Status { StatusUnsupportedFormat, StatusCompileError, StatusLinkError, StatusInvalidAttributeLocation, StatusValid } |
Status tells if shader creation parameters can be used to create a shader. More... | |
Public Member Functions | |
void | addUniform (string_view name, PropertyDataType dataType, unsigned int elementCount, optional< AbstractPropertyType > propertyType, UniformBindingType bindingType, optional< FixedUniform > fixedOperation, FixedUniformFunction func, UniformTransformation transform) |
Adds an uniform to shader. More... | |
void | addUniform (AbstractPropertyType propertyType, PropertyDataType dataType, unsigned int elementCount, ShaderProgram::UniformTransformation transformation) |
Adds a property type uniform to shader. More... | |
void | addUniform (AbstractPropertyType propertyType, PropertyDataType dataType, unsigned int elementCount) |
Adds a property type uniform to shader. More... | |
void | addUniform (AbstractPropertyType propertyType, ShaderProgram::UniformTransformation transformation) |
Adds a property type uniform to shader. More... | |
void | addUniform (AbstractPropertyType propertyType) |
Adds a property type uniform to shader. More... | |
CreateInfo () | |
Constructs empty create info structure for shader program creation. More... | |
Status | validate (const Renderer &renderer) const |
Perform validation of shader creation parameters. More... | |
Public Attributes | |
BindingContainer | bindings |
Bindings. More... | |
bool | blendingControl |
Indicates whether ShaderProgram created from this createInfo should be able to change blending mode. More... | |
string | combinedShaderBinaryData |
Combined shader binary data. More... | |
unsigned int | combinedShaderBinaryFormat |
Format for combined shader binary. More... | |
string | fragmentShaderSource |
Fragment shader source code. More... | |
string | programBinaryData |
Program binary data. More... | |
unsigned int | programBinaryFormat |
Format for program binary. More... | |
unsigned int | separateShaderBinaryFormat |
Format for separate shader binaries. More... | |
string | separateShaderBinaryFragmentData |
Fragment shader binary data when using separate shader binaries. More... | |
string | separateShaderBinaryVertexData |
Vertex shader binary data when using separate shader binaries. More... | |
UniformContainer | uniforms |
Uniforms. More... | |
ShaderAttributeCollection | vertexFormat |
Shader vertex attributes. More... | |
string | vertexShaderSource |
Vertex shader source code. More... | |
Struct that contains all the parameters that Kanzi needs to create a ShaderProgram.
Kanzi loads ShaderProgram::CreateInfo from the kzb file as part of shader creation. You can also use ShaderProgram::CreateInfo to create shaders manually in code.
To define a shader, you must set these fields of the CreateInfo struct:
To create a shader whose bindings are in the default state:
When you want to override binding information, instead of relying on the default states for the bindings, create the bindings manually. To manually create bindings for shaders:
Binding container type.
Status tells if shader creation parameters can be used to create a shader.
If status is not StatusValid, create info must not be passed to ShaderProgram::create().
Enumerator | |
---|---|
StatusUnsupportedFormat | Shader binary format is not supported. |
StatusCompileError | Shader fails compilation. |
StatusLinkError | Shader fails linking. |
StatusInvalidAttributeLocation | Shader has invalid vertex attribute locations. |
StatusValid | CreateInfo is valid and can be used to create Shader. |
|
explicit |
Constructs empty create info structure for shader program creation.
Members of the structure must be filled in before the structure can be used in ShaderProgram::create().
Perform validation of shader creation parameters.
You can call validate() to see if shader creation parameters are valid before you pass create info to ShaderProgram::create().
renderer | Renderer to validate with. |
|
inline |
Adds an uniform to shader.
All properties are listed.
name | Uniform name. |
dataType | Uniform data type. |
elementCount | Number of elements in the uniform. |
propertyType | Optional property type. |
bindingType | The type of binding associated with the shader uniform. |
fixedOperation | Optional fixed uniform id. |
func | Fixed function for the uniform, may be nullptr. |
transform | Uniform transformation. See UniformTransformation. |
|
inline |
Adds a property type uniform to shader.
propertyType | Optional property type. |
dataType | Uniform data type. |
elementCount | Number of elements in the uniform. |
transformation | Uniform transformation. |
|
inline |
Adds a property type uniform to shader.
Uniform transformation is set to pass-through.
propertyType | Optional property type. |
dataType | Uniform data type. |
elementCount | Number of elements in the uniform. |
|
inline |
Adds a property type uniform to shader.
Data type is inferred from property. Element count is set to one.
propertyType | Property type. |
transformation | Uniform transformation. |
|
inline |
Adds a property type uniform to shader.
Data type is inferred from property. Element count is set to one. Uniform transformation is set to pass-through.
propertyType | Property type. |
string kanzi::ShaderProgram::CreateInfo::vertexShaderSource |
Vertex shader source code.
string kanzi::ShaderProgram::CreateInfo::fragmentShaderSource |
Fragment shader source code.
unsigned int kanzi::ShaderProgram::CreateInfo::programBinaryFormat |
Format for program binary.
string kanzi::ShaderProgram::CreateInfo::programBinaryData |
Program binary data.
unsigned int kanzi::ShaderProgram::CreateInfo::combinedShaderBinaryFormat |
Format for combined shader binary.
string kanzi::ShaderProgram::CreateInfo::combinedShaderBinaryData |
Combined shader binary data.
unsigned int kanzi::ShaderProgram::CreateInfo::separateShaderBinaryFormat |
Format for separate shader binaries.
string kanzi::ShaderProgram::CreateInfo::separateShaderBinaryVertexData |
Vertex shader binary data when using separate shader binaries.
string kanzi::ShaderProgram::CreateInfo::separateShaderBinaryFragmentData |
Fragment shader binary data when using separate shader binaries.
UniformContainer kanzi::ShaderProgram::CreateInfo::uniforms |
Uniforms.
ShaderAttributeCollection kanzi::ShaderProgram::CreateInfo::vertexFormat |
Shader vertex attributes.
BindingContainer kanzi::ShaderProgram::CreateInfo::bindings |
Bindings.
bool kanzi::ShaderProgram::CreateInfo::blendingControl |
Indicates whether ShaderProgram created from this createInfo should be able to change blending mode.
When blending control is enabled, materials using a ShaderProgram can set renderer blend mode. If blending control is disabled, materials using a ShaderProgram will leave blend mode unchanged.