[SlimDX] Geometry shader with stream output - E_INVALIDARG

Started by
1 comment, last by Jimbobicus 12 years, 6 months ago
I'm trying to recreate the NVidia Cascades demo (sort of) using SlimDX and D3D11 but I keep running into a problem on creating the geometry shaders with stream output.
I'm running the debug runtime, but I'm not seeing any output from that. The only thing I get in the VS output window is: A first chance exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll

The unhandled exception window shows up and tells me that the error was an E_INVALIDARG. Which usually indicates an error on the stream output declaration, but I can't for the life of me see what that would be. Any help would be greatly appreciated!

My stream output declaration:
[source]
var sElement = new StreamOutputElement[]
{
new StreamOutputElement(0, "POSITION", 0, 0, 1, 0),
};
[/source]

Bytecode and geometry shader creation code:
[source]
bytecode = ShaderBytecode.CompileFromFile(StringTable.ShaderPath + "list_nonempty.gs",
"GS",
"gs_4_1",
ShaderFlags.Debug,
EffectFlags.None,
null,
includeHandler,
out error);
gShader = new GeometryShader(device, bytecode, sElement, new int[] { 4 }, GeometryShader.NoRasterizedStream);
[/source]

And my geometry shader code:
[source]
struct vs_to_gs
{
uint z8_y8_x8_case8 : OUTPUT;
};

struct gs_to_app
{
uint z8_y8_x8_case8 : POSITION;
};

[maxvertexcount(1)]
void GS(point vs_to_gs input[1], inout PointStream<gs_to_app> Stream)
{
// pull the case out of the input
uint cube_case = input[0].z8_y8_x8_case8 & 0xFF;
// check that the case is not 0
if(cube_case * (255 - cube_case) > 0)
{
// if the case is not zero add this voxel to the output stream
gs_to_app output;
output.z8_y8_x8_case8 = input[0].z8_y8_x8_case8;
Stream.Append(output);
}
}
[/source]
Advertisement
You should be getting a debug message if you created the device with DEBUG flag. I haven't done any managed stuff in a long time, but I think you have enable mixed mode debugging if you want to see the native debug output. Or you can use DebugView, or some other program that can view the debug output stream.
Thanks for the input! I haven't figured out how to get the D3D debug info to show in the output window (I've had it there before, so I'm not sure what happened...)

At any rate I used PIX to get the debug output and got the problem figured out. It was [font="Consolas,"]GeometryShader.NoRasterizedStream[/font] ..... Apparently that only works with D3D11 feature level. I've got a 10.1 card so there has to be a rasterized stream set. I changed it to 0 and it works fine.

This topic is closed to new replies.

Advertisement