Sunday, April 10, 2011

DirectX / XNA shader test compiler in C#

You must have the fxc.exe directx compiler in the bin folder, it can be found in the direct x sdk.

This class provides an observable collection that can be used in WPF to show the list of shader profiles.

public static bool TryCompile(string code, ShaderModel model, string entrypoint, out string error)

Where code is the shader source code, model is an element prom the profile list, entry point is the main procedure for shaders that require it like the pixelshader, error is the error string if there is an error compiling.

No comments:

Post a Comment