Difference between revisions of "Shader Uniform Descriptors"
From GiderosMobile
(Created page with "Each uniform descriptor entry is a lua table with the following fields: * name: Name of the uniform. Must match the name used in GLSL program. * type: Type of data this unifo...") |
|||
Line 1: | Line 1: | ||
Each uniform descriptor entry is a lua table with the following fields: | Each uniform descriptor entry is a lua table with the following fields: | ||
− | * name: | + | * name: name of the uniform. Must match the name used in GLSL program |
− | * type: | + | * type: type of data this uniform holds. Must be one of Shader.CFLOAT, Shader.CFLOAT4, Shader.CINT, Shader.CMATRIX or Shader.CTEXTURE |
− | * mult: | + | * mult: the number of elements if this uniform is an array |
− | * sys: | + | * vertex: boolean which must be set to true if the uniform is defined in the vertex shader, and false if it is defined in the fragment shader |
− | # Shader.SYS_WVP: this uniform of type CMATRIX will hold the World/View/Projection matrix | + | * sys: indicates that this uniform has a special meaning and should be set by Gideros when appropriate. Current possible values are: |
− | # Shader.SYS_COLOR: this uniform of type CFLOAT4 will hold the constant color to be used to draw the shape | + | # Shader.SYS_WVP: this uniform of type CMATRIX will hold the World/View/Projection matrix |
− | # Shader.SYS_WORLD: this uniform of type CMATRIX will hold the World transform matrix | + | # Shader.SYS_COLOR: this uniform of type CFLOAT4 will hold the constant color to be used to draw the shape |
− | # Shader.SYS_WIT: this uniform of type CMATRIX will hold the World Inverse Transpose matrix | + | # Shader.SYS_WORLD: this uniform of type CMATRIX will hold the World transform matrix |
− | # Shader.SYS_TEXTUREINFO: this uniform of type CFLOAT4 will hold information about the texture used in a particle shader | + | # Shader.SYS_WIT: this uniform of type CMATRIX will hold the World Inverse Transpose matrix |
− | # Shader.SYS_PARTICLESIZE: the uniform of type CFLOAT will hold the particle size to use in a particle shader | + | # Shader.SYS_TEXTUREINFO: this uniform of type CFLOAT4 will hold information about the texture used in a particle shader |
+ | # Shader.SYS_PARTICLESIZE: the uniform of type CFLOAT will hold the particle size to use in a particle shader | ||
The uniforms must be declared in the order they appear in the constant block of the HLSL version of the shader. If shaders are only GLSL, then the order is not relevant. | The uniforms must be declared in the order they appear in the constant block of the HLSL version of the shader. If shaders are only GLSL, then the order is not relevant. |
Revision as of 06:35, 4 November 2023
Each uniform descriptor entry is a lua table with the following fields:
- name: name of the uniform. Must match the name used in GLSL program
- type: type of data this uniform holds. Must be one of Shader.CFLOAT, Shader.CFLOAT4, Shader.CINT, Shader.CMATRIX or Shader.CTEXTURE
- mult: the number of elements if this uniform is an array
- vertex: boolean which must be set to true if the uniform is defined in the vertex shader, and false if it is defined in the fragment shader
- sys: indicates that this uniform has a special meaning and should be set by Gideros when appropriate. Current possible values are:
- Shader.SYS_WVP: this uniform of type CMATRIX will hold the World/View/Projection matrix
- Shader.SYS_COLOR: this uniform of type CFLOAT4 will hold the constant color to be used to draw the shape
- Shader.SYS_WORLD: this uniform of type CMATRIX will hold the World transform matrix
- Shader.SYS_WIT: this uniform of type CMATRIX will hold the World Inverse Transpose matrix
- Shader.SYS_TEXTUREINFO: this uniform of type CFLOAT4 will hold information about the texture used in a particle shader
- Shader.SYS_PARTICLESIZE: the uniform of type CFLOAT will hold the particle size to use in a particle shader
The uniforms must be declared in the order they appear in the constant block of the HLSL version of the shader. If shaders are only GLSL, then the order is not relevant.