<shader> (//pfx/shader)

<shader> elements provide shader source for a pipeline.

<shader> elements are the way by which shader source is provided for a pipeline. The code for several API versions can be provided, and considerable leeway in mix-and-matching parts of code is supported.

Code is provided by using either <file> and <code> elements. Shader code can be provided for different API versions using the apiVersion attribute.

For each <shader> element, all <file> and <code> elements that have the same apiVersion attribute and / or no apiVersion attribute will be concatenated together. This means there will be a single source code per API version for each <shader> element.

To avoid confusing versionless application objects, at least one apiVersion attribute should be provided for at least one of the <file> or <code> elements.

XML Attributes (<shader> element)

ATTRIBUTE

Description

name

A unique identifier for this shader.

type

The type of this shaders.

Minimum supported valid values are:

  • vertex
  • fragment

Other possibly supported values (not exclusive list):

  • geometry
  • tessControl, tessellationControl
  • tessEvaluation, tessellationEvaluation

Child elements (<shader> element)

ELEMENT

Description

file

An element containing information required to load a file

code

A element containing code to directly add to the source of a file