If you have time to spare you could also go the totally overkill route as I did. I wrote a Shader Generation tool that allows me to define shaders as tree of "nodes". For example here is a Gaussian Blur shader.
DeclarationNode nColor = DeclarationNode.InitNode("color", Shaders.Type.Float4, 0, 0, 0, 0);
ArrayNode fOffsetWeight = new ArrayNode() {Input = fOffsetsAndWeights, Index = "i"};
AdditionNode nBlur = new AdditionNode
{
PreCondition = new ForBlock()
{
PreCondition = nColor,
StartCondition = new ScalarNode(){Value = 0},
EndCondition = new ScalarNode(){Value = 15}
},
OpensBlock = true,
Input1 = nColor,
Input2 = new MultiplyNode()
{
Input1 = new TextureSampleNode()
{
Texture = tDiffuse,
Sampler = sLinear,
Coordinates = new AdditionNode()
{
Input1 = new ReferenceNode() {Value = InputStruct[Param.SemanticVariables.Texture]},
Input2 = new SwizzleNode(){Input = fOffsetWeight, Swizzle = new []{Swizzle.X, Swizzle.Y}},
}
},
Input2 = new SwizzleNode() { Input = fOffsetWeight, Swizzle = new[] { Swizzle.Z } },
},
ClosesBlock = true,
IsVerbose = true,
Declare = false,
AssignToInput1 = true,
Output = nColor.Output
};
OutputStruct = Struct.PixelShaderOutput;
Result = new PSOutputNode
{
FinalColor = nBlur,
Output = OutputStruct
};
And the resulting shader code (cbuffer declarations omitted)
PSOut GaussianBlurPS(VSOut input) : SV_Target
{
float4 color = float4(0, 0, 0, 0);
for (int i = 0; i < 15; i++)
{
color += tDiffuseMap.Sample(sLinear, input.Texture + fOffsetsAndWeights[i].xy) * fOffsetsAndWeights[i].z;
}
PSOut output;
output.Color = color;
return output;
}
The issue is that shaders need to be declared as combinations of node. There's no graphical editor as of yet (someday!). On the other hand this allows me to tailor it to the necessities of my engine. Since I can annotate every variable with the corresponding engine references. For example if a cbuffer requires a World matrix, the corresponding variable is tagged with that reference. So the shader initializer system when encountering that reference will automatically apply the correct data without needing to initialize a shader on a ad hoc basis.
Further, I can have "function" nodes such as one representing your "DoBlur" nodes (either as combination of other nodes or as plain text methods). When the shader is generated it will contain only the code strictly necessary (and nothing else) for that shader to work. Without messy includes and whatnot. But wait, there's more! The generated shaders are part of a "ShaderCollection" structure that holds various technique mappings. For example technique A might use SM4, while technique B might use SM5. So a ShaderCollection object can hold different versions of the same shader type, making the choice of the correct version a simpler one. AND it also comes with shader preview functionality (which is still experimental).
I just noticed that I forgot to add it to my GitHub repository but it will be when I go back home.