Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Jimbobicus

Member Since 25 Jul 2011
Offline Last Active Jun 03 2014 01:36 PM

Topics I've Started

[SlimDX] Geometry shader with stream output - E_INVALIDARG

01 October 2011 - 08:54 AM

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:

var sElement = new StreamOutputElement[]

            {

                new StreamOutputElement(0, "POSITION", 0, 0, 1, 0),

            };



Bytecode and geometry shader creation code:

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);



And my geometry shader code:

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);

	}

}


PARTNERS