Directx dll from c#

Started by
1 comment, last by AverageJoeSSU 14 years, 1 month ago
Whilst this question is largly DirectX based, I think its going to result in a general programming reply, so I decided to place it here. Im wanting to create a C# application with GUI to compile my HLSL files and report back any errors. At the moment, Im just having the C# application call the fxc.exe application, with the HLSL file as one of the command line arguments, but the errors reported are obviously only seen in the console window of fxc.exe. Im wanting these errors to be passed back to the C# application, and be visible in the GUI. At the moment I see no way of doing this. From reading the documentation on fxc.exe, it mentions nothing about storing errors to a file, they only seem to be outputed to the console window. Whilst I could get this working with the XNA libraries, Im trying to avoid this as the rest of my engine uses the standard Directx libraries and C++. So it seems daft to have the XNA runtimes as one of the requirements purly to compile shaders. So Im thinking about loading one of the Directx .dlls in c#, and calling something like D3D10CompileEffectFromMemory() from C#. But I havent done anything like this before. So Im looking for some advice. The problem I see is that D3D10CompileEffectFromMemory(), requires as arguments, other types that are declared in the DirectX headers, such as ID3D10Blob. Which will contain the any errors reported and the compiled shader data.
Advertisement
Use SlimDX or look at redirecting output of programs.
This example may help, i followed the tutorial and was able to get it working with OpenGL and WPF.

------------------------------

redwoodpixel.com

This topic is closed to new replies.

Advertisement