Step 1) Install
Step 2) For existing HLSL files in your project just set the Custom Tool property to
ShaderEffectGenerator.
Step 3) For any new HLSL files in your project you'll want to select the
WPF Shader Effect File
Step 4) Use a triple slash comments to add additional metadata information to the effect the generation of the code. They are all optional.
/// <description>A simple color blending shader for WPF.</description>
/// <target>WPF</target>
/// <profile>ps_2_0</profile>
/// <DdxUvDdyUvRegisterIndex>-1</DdxUvDdyUvRegisterIndex>
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
/// <summary>The brightness offset.</summary>
/// <type>Color</type>
/// <defaultValue>255,0,0,0</defaultValue>
float4 BlendColor : register(c0);
//-----------------------------------------------------------------------------
// Samplers
//-----------------------------------------------------------------------------
/// <summary>The implicit input sampler passed into the pixel shader by WPF.</summary>
/// <samplingMode>Auto</samplingMode>
sampler2D Input : register(s0);
//-----------------------------------------------------------------------------
// Pixel Shader
//-----------------------------------------------------------------------------
float4 main(float2 uv : TEXCOORD) : COLOR
{
// TODO: add your pixel shader code here.
return BlendColor * BlendColor.a + tex2D(Input, uv) * (1.0 - BlendColor.a);
}
File Tags
| Tag | Options | Description |
| description | ... | The description of the shader, this will appear in a summary comment on the generated ShaderEffect class. |
| profile | ps_2_0, ps_3_0 | The shader model version to use when compiling the shader, ps{_}2{_}0 is the default. |
| target | WPF, Silverlight | The target platform for the ShaderEffect, this affects what types and features are available, WPF is the default. |
| DdxUvDdyUvRegisterIndex | ... | The register index to use for the partial derivatives of the texture coordinates with respect to screen space. -1 is the default. |
Register Tags
| Tag | Options | Description |
| summary | ... | The text you want to appear inside the summary comment that is generated in the code. |
| samplingMode | Auto, NearestNeighbor, Bilinear | The texture sampling mode to use, this is only valid on samplers, Auto is the default. |
| type | (bool) (int, uint, sbyte, byte, char, short, ushort, long, ulong) (float, double) (Point, Size, Vector) (Point3D, Vector3D) (Point4D, Color) | The type you would like to override the default generated type that is exposed to C#, the ones in bold in a group represent the default for that set. |
| defaultValue | bool = (true, false), float = ..., float[] = ...,... | The default value to set for the register when the C# code is generated. |