XML Schema for Shading Fragments

The following is an XML schema which defines the XML format used for shading fragments registered with MFragmentManager. This schema can be used to validate the XML for fragment definitions. Valid XML is necessary, but is not a sufficient condition for a fragment to function correctly in the Maya fragment shader system.

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

 <xs:element name="fragment">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
    <xs:element name="keyword" type="KeywordType" minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="properties" type="PropertiesListType" />
    <xs:element name="values" type="ValuesListType" />
    <xs:element name="outputs" type="OutputsListType" />
    <xs:element name="implementation" type="ImplementationListType" />
   </xs:sequence>
   <xs:attribute name="uiName" type="xs:string" use="required" />
   <xs:attribute name="name" type="xs:string" use="required" />
   <xs:attribute name="type" type="FragmentType" use="required" />
   <xs:attribute name="class" type="xs:string" use="required" fixed="ShadeFragment" />
   <xs:attribute name="version" type="xs:float" use="required" />
   <xs:attribute name="feature_level" type="xs:integer" />
  </xs:complexType>
 </xs:element>

 <xs:simpleType name="FragmentType">
  <xs:restriction base="xs:string">
   <xs:enumeration value="surface" />
   <xs:enumeration value="declaration" />
   <xs:enumeration value="sceneEffect" />
   <xs:enumeration value="graph" />
   <xs:enumeration value="interpolant" />
   <xs:enumeration value="geomInterpolant" />
   <xs:enumeration value="lighting" />
   <xs:enumeration value="plumbing" />
   <xs:enumeration value="procedure" />
   <xs:enumeration value="structure" />
   <xs:enumeration value="unknown" />
   <xs:enumeration value="constant" />
   <xs:enumeration value="accum" />
   <xs:enumeration value="selector" />
   <xs:enumeration value="choice" />
   <xs:enumeration value="imaging" />
   <xs:enumeration value="output" />
   <xs:enumeration value="geometryShader" />
   <xs:enumeration value="hullShader" />
   <xs:enumeration value="domainShader" />
   <xs:enumeration value="computeShader" />
  </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="KeywordType">
  <xs:attribute name="value" type="xs:string" use="required" />
 </xs:complexType>

 <xs:complexType name="PropertiesListType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="float" type="PropertyType" />
   <xs:element name="float2" type="PropertyType" />
   <xs:element name="float3" type="PropertyType" />
   <xs:element name="float4" type="PropertyType" />
   <xs:element name="target" type="PropertyType" />
   <xs:element name="texture1" type="PropertyType" />
   <xs:element name="texture2" type="PropertyType" />
   <xs:element name="texture3" type="PropertyType" />
   <xs:element name="textureCube" type="PropertyType" />
   <xs:element name="world" type="PropertyType" />
   <xs:element name="bool" type="PropertyType" />
   <xs:element name="int" type="PropertyType" />
   <xs:element name="int2" type="PropertyType" />
   <xs:element name="int3" type="PropertyType" />
   <xs:element name="int4" type="PropertyType" />
   <xs:element name="color" type="PropertyType" />
   <xs:element name="colorAlpha" type="PropertyType" />
   <xs:element name="float4x4" type="PropertyType" />
   <xs:element name="string" type="PropertyType" />
   <xs:element name="stringArray" type="PropertyType" />
   <xs:element name="countedObject" type="PropertyType" />
   <xs:element name="object" type="PropertyType" />
   <xs:element name="struct" type="PropertyType" />
   <xs:element name="camera" type="PropertyType" />
   <xs:element name="effectInstance" type="PropertyType" />
   <xs:element name="effectInstanceArray" type="PropertyType" />
   <xs:element name="sampler" type="PropertyType" />
   <xs:element name="simpleMesh" type="PropertyType" />
   <xs:element name="pointStream" type="PropertyType" />
   <xs:element name="lineStream" type="PropertyType" />
   <xs:element name="triStream" type="PropertyType" />
   <xs:element name="undefined" type="PropertyType" />
   <xs:element name="renderer" type="PropertyType" />
   <xs:element name="enum" type="PropertyType" />
  </xs:choice>
 </xs:complexType>

 <xs:complexType name="PropertyType">
  <xs:attribute name="name" type="xs:string" use="required" />
  <xs:attribute name="struct_name" type="xs:string" />
  <xs:attribute name="semantic" type="xs:string" />
  <xs:attribute name="size" type="xs:nonNegativeInteger" />
  <xs:attribute name="flags" type="xs:string" />
  <xs:attribute name="evaluatedByOwner" type="xs:boolean" />
 </xs:complexType>

 <xs:complexType name="ValuesListType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="float" type="ValueType" />
   <xs:element name="float2" type="ValueType" />
   <xs:element name="float3" type="ValueType" />
   <xs:element name="float4" type="ValueType" />
   <xs:element name="color" type="ValueType" />
   <xs:element name="colorAlpha" type="ValueType" />
   <xs:element name="bool" type="ValueType" />
   <xs:element name="int" type="ValueType" />
   <xs:element name="int2" type="ValueType" />
   <xs:element name="int3" type="ValueType" />
   <xs:element name="int4" type="ValueType" />
   <xs:element name="float4x4" type="ValueType" />
   <xs:element name="string" type="ValueType" />
  </xs:choice>
 </xs:complexType>

 <xs:complexType name="ValueType">
  <xs:attribute name="name" type="xs:string" use="required" />
  <xs:attribute name="value" type="xs:string" use="required" />
 </xs:complexType>

 <xs:complexType name="OutputsListType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
   <xs:element name="float" type="OutputType" />
   <xs:element name="float2" type="OutputType" />
   <xs:element name="float3" type="OutputType" />
   <xs:element name="float4" type="OutputType" />
   <xs:element name="target" type="OutputType" />
   <xs:element name="texture1" type="OutputType" />
   <xs:element name="texture2" type="OutputType" />
   <xs:element name="texture3" type="OutputType" />
   <xs:element name="textureCube" type="OutputType" />
   <xs:element name="world" type="OutputType" />
   <xs:element name="bool" type="OutputType" />
   <xs:element name="int" type="OutputType" />
   <xs:element name="int2" type="OutputType" />
   <xs:element name="int3" type="OutputType" />
   <xs:element name="int4" type="OutputType" />
   <xs:element name="color" type="OutputType" />
   <xs:element name="colorAlpha" type="OutputType" />
   <xs:element name="float4x4" type="OutputType" />
   <xs:element name="string" type="OutputType" />
   <xs:element name="stringArray" type="OutputType" />
   <xs:element name="countedObject" type="OutputType" />
   <xs:element name="object" type="OutputType" />
   <xs:element name="struct" type="OutputType" />
   <xs:element name="camera" type="OutputType" />
   <xs:element name="effectInstance" type="OutputType" />
   <xs:element name="effectInstanceArray" type="OutputType" />
   <xs:element name="sampler" type="OutputType" />
   <xs:element name="simpleMesh" type="OutputType" />
   <xs:element name="pointStream" type="OutputType" />
   <xs:element name="lineStream" type="OutputType" />
   <xs:element name="triStream" type="OutputType" />
   <xs:element name="undefined" type="OutputType" />
   <xs:element name="renderer" type="OutputType" />
   <xs:element name="enum" type="OutputType" />
   <xs:element name="alias" type="OutputType" />
  </xs:choice>
</xs:complexType>

 <xs:complexType name="OutputType">
  <xs:attribute name="name" type="xs:string" use="required" />
  <xs:attribute name="struct_name" type="xs:string" />
  <xs:attribute name="semantic" type="xs:string" />
  <xs:attribute name="size" type="xs:nonNegativeInteger" />
  <xs:attribute name="flags" type="xs:string" />
  <xs:attribute name="isInOutParam" type="xs:boolean" />
 </xs:complexType>

 <xs:complexType name="ImplementationListType">
  <xs:sequence>
   <xs:element name="implementation" minOccurs="0" maxOccurs="unbounded">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="function_name" type="FunctionNameType" minOccurs="0" maxOccurs="1" />
      <xs:element name="declaration" type="DeclarationType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="source" type="xs:string" minOccurs="0" maxOccurs="1" />
      <xs:element name="vertex_source" type="xs:string" minOccurs="0" maxOccurs="1" />
     </xs:sequence>
     <xs:attribute name="render" type="xs:string" use="required" fixed="OGSRenderer" />
     <xs:attribute name="language" type="LanguageType" use="required" />
     <xs:attribute name="lang_version" type="xs:float" use="required" />
    </xs:complexType>
   </xs:element>
  </xs:sequence>
 </xs:complexType>

 <xs:simpleType name="LanguageType">
  <xs:restriction base="xs:string">
   <xs:enumeration value="Cg" />
   <xs:enumeration value="GLSL" />
   <xs:enumeration value="HLSL" />
  </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="FunctionNameType">
  <xs:attribute name="val" type="xs:string" use="required" />
 </xs:complexType>

 <xs:complexType name="DeclarationType">
  <xs:simpleContent>
   <xs:extension base="xs:string">
    <xs:attribute name="name" type="xs:string" />
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>

</xs:schema>