(2.1) Geometry Shader Buffer Binding Fix

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
User avatar
SolarPortal
OGRE Contributor
OGRE Contributor
Posts: 203
Joined: Sat Jul 16, 2011 8:29 pm
Location: UK
x 51
Contact:

(2.1) Geometry Shader Buffer Binding Fix

Post by SolarPortal »

Hi, Just been scratching my head for the past day wondering why i could't pass my passbuffer from the HLMS to the geometry shader in the PBR system.
As it turns out, the buffer was never binding and instead was binding to a Compute Shader Slot.

Its a nice and easy fix though after pulling all the source apart to find the little blighter..

Go to OgreCbShaderBuffer.cpp line 72:
You will notice that it is binding the geometry shader to the compute shader slot :

Code: Select all

static_cast<ConstBufferPacked*>( cmd->bufferPacked )->bindBufferCS( cmd->slot );
Instead it should be:

Code: Select all

static_cast<ConstBufferPacked*>( cmd->bufferPacked )->bindBufferGS( cmd->slot );
Note the bindBufferXX function.. CS => GS

Hope this helps :)

p.s. Sorry if this has already been fixed, i havent updated my 2.1 build in some time now, but its possible its still there as i dont see many things about Geometry Shaders on the forums apart from a couple with Unlit.

Edit: Also, is this code chunk missing from the OgreD3D11RenderSystem.cpp 3278 approx:

Code: Select all

			
			/// Geometry Shader binding
			{
				if (mFeatureLevel >= D3D_FEATURE_LEVEL_10_0)
				{
					mDevice.GetImmediateContext()->GSSetShaderResources(static_cast<UINT>(0), static_cast<UINT>(opState->mTexturesCount), &opState->mTextures[0]);
					if (mDevice.isError())
					{
						String errorDescription = mDevice.getErrorDescription();
						OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
							"D3D11 device cannot set geometry shader resources\nError Description:" + errorDescription,
							"D3D11RenderSystem::_render");
					}
				}
			}
as all the other shader stages have the shader resources reset apart from the Geometry Shader?
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: (2.1) Geometry Shader Buffer Binding Fix

Post by dark_sylinc »

Thanks!

Done and done
Post Reply