Skip to content

Canvas Shader Coding

grondag edited this page Jun 22, 2020 · 5 revisions

To ensure maximum compatibility for multiple mods accessing the shader pipeline, Canvas provides a defined API and requires some conventions to be followed.

Mod Shaders

Mod authors can create vertex shaders, fragment shaders or both. When only one is present, an appropriate "default" shader is used.

Mod shaders do not contain a main method, and should not include attribute or uniform declarations. (Those are handled by Canvas.)

Instead, these shaders implement one or more of the following methods:

void cv_startFragment(inout cv_FragmentData fragData)

void cv_startVertex(inout cv_VertexData data)

void cv_endVertex(inout cv_VertexData data)

The data structures and their usage within these methods are defined here:

Canvas API

Shader libraries that enable into

Clone this wiki locally