Shader Attribute Descriptors

Each attribute descriptor entry is a Lua table with the following fields:

  • name: the name of the attribute/vertex data stream. Must match the name used in GLSL and HLSL code.
  • type: data type used from the host point of view. One of Shader.DFLOAT, Shader.DBYTE, Shader.DUBYTE, Shader.DSHORT, Shader.DUSHORT or Shader.DINT.
  • mult: number of components of the input vector.
  • slot: index of the input slot (HLSL only).
  • offset: offset within the input slot (HLSL only, should be 0).

The first three attributes have fixed meaning. Those are, in order:

  • The vertex coordinate stream. Type must be Shader.DFLOAT and mult should be 3.
  • The per-vertex color. Type must be Shader.DUBYTE and mult should be 4.
  • The texture coordinates. Type must be Shader.DFLOAT and mult should be 2.

If one of these fixed attributes is not used by the custom shader program, it should still be defined with a mult value of 0 to serve as a placeholder.