Menu

Shaders

Milan Davidovic

There are 6 classes that represent shader types:

  • IVertexShader
  • ITessControlShader
  • ITessEvaluationShader
  • IGeometryShader
  • IFragmentShader
  • IComputeShader

They are all derived from IShader which has some common functionality. Shader objects are created using IRenderContext functions Create*Shader() which have overloads that take shader source string or shader binary. All shader types except fragment and compute shaders can also be created with Create*ShaderWithTransformFeedback() which creates shader object and sets up transform feedback output varyings.

The following are current shader object design directions, some of them still need to be proven through testing and practical usage and might be changed later if they are proven to be unsound because of either performance or usability reasons:

  • OpenGL separate shader objects are used exclusively, so each shader stage can be set separately. There is no concept of "program object" in GLSlayer API that contains shader objects for each stage. Internally, single pipeline object is created and always used.
  • Shader objects are designed to be immutable. When a shader is created, source code is specified and shader is compiled and linked, after that source cannot be changed and shader cannot be recompiled and relinked.
  • Uniform blocks are used exclusively for shader constant storage.

Related

Wiki: Home