One of my favorite new features in Shazzam 1.1 is the HLSL meta data tags. Shazzam reads a small set of optional XML tags embedded in your HLSL and uses this meta data to inject information into your generated class. Plus there are tags for setting default, minimum and maximum values that propagate to the shader testing screen.
Shazzam MetaTags
In order to keep the HLSL compiler happy the tags are placed in a comment line. Use the triple-slash /// syntax to differentiate Shazzam comments from HLSL comments.
Available Tags
<class>: The class tag specifies your desired Class name for the generated code file.
<namespace>: The namespace tag specifies your desired .NET namespace for the generated code file.
<description>: The description tag injects an XML comment above your class definition in the generated code file.
Example HLSL
//------------------------------------------------------------ // Specify a default Class name for the generated file /// <class>DemoEffect</class> //------------------------------------------------------------- // Specify the default >NET namespace for generated file. /// <namespace>Shazzam.Shaders</namespace> //------------------------------------------------------------- // Provide a description for this Shader // Shazzam will generate XML comments from this description /// <description>An effect that demonstrates the Shazzam features.</description>
Figure 1: Generated class code.
Testing Screen MetaTags
The next set of Meta Tags is used to pass information to the Shazzam test page. You can specify minValue, maxValue, defaultValue and summary values for each HLSL register. The generated C# or VB class uses these value as defaults for the class properties. Plus every time your shader.fx code is compiled the testing UI is initialized with these settings. No more reentering values every time you compile the shader!
<summary>: Provide a summary describing the purpose of this variable. A summary tooltip will appear in the testing window.
<minValue>: Provide a default value for the minimum textbox. Note that you can set the value in the text box to a lower number than the minimum. minValue merely provides the starting value for the textbox.
<maxValue>: Provide a default value for the maximum textbox. Note that you can set the value in the text box to a higher number than the maximum. maxValue merely provides the starting value for the textbox.
<defaultValue>: Provide a starting value for the Value slider control.
Example HLSL
// Causes a tooltip to show in Shazzam.
/// <summary>Summarize the purpose of this variable.</summary>
/// <minValue>-20</minValue> // provide minimum initial value for the register. /// <maxValue>300</maxValue> // provide maximum initial value for the register. /// <defaultValue>120</defaultValue> // provide default value for the register. float SampleFloatWithXML: register(C1);
Figure 2: Min, Max and Default values in the Shader Settings view.
Summary
[Shazzam 1.1 was released on October 11, 2009]
See a list of additional help pages here.
Install your own copy of the free Shazzam Pixel Shader Utility here.
[...] HLSL Meta Tags – Controlling defaults [...]