Templates
Shader templating is available in XKSL. Unlike many templating systems, pdxsl requires strong typed templates. The available types are:
- -
Code: Templating
shader TemplateShader<float speed, Texture2D myTexture, SamplerState mySampler, Semantic mySemantic, LinkType myLink>{ [Color] [Link("myLink")] float4 myColor; stream float2 texcoord : mySemantic; float4 GetValue() { return speed * myColor * myTexture.Sample(mySampler, streams.texcoord); }};// To instantiate the shader, use:TemplateShader<1.0f, Texturing.Texture0, Texturing.Sampler0, TEXCOORD0, MyColorLink>
See also
- Effect language
- Shading language index
- Shader classes, mixins, and inheritance
- Composition
- Shader stage input/output automatic management
