Shader stages

  • for hull shader
  • HSConstantMain for patch constant function
  • DSMain for domain shader
  • VSMain for vertex shader (takes no arguments)
  • GSMain for geometry shader
  • PSMain for pixel shader (takes no arguments)

The geometry and tessellation shaders need some kind of predefined structure as input and output. However, since Xenko shaders are generic, it's impossible to know beforehand what the structure will be. As a result, these shaders use and Output structures that are automatically generated to fit the final shader.

A vertex shader has to set the variable with the semantic SV_Position. In ShaderBase, it's ShadingPosition.

For example:

Pixel shader

For example:

An example of geometry shader:

Input can be used in the method body. It behaves like the streams object and contains the same members.

Tessellation shader

An example of a tessellation shader:

Input and Input2 both behave like streams.

Note

Don't forget to assign output to streams at the end of your stage.

You can inherit from and override the Compute method.

See also