Sign in to follow this  

HLSL Input/Output mismatch. Spot the problem?

This topic is 1104 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I think I have the input and output between vertex and geo shader right, but here is the error:

D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. Semantic 'TYPE' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX]

 

Here are the declarations on the c++ side:

struct Particle
{
	DirectX::XMFLOAT4 InitialPos;
	DirectX::XMFLOAT3 InitialVel;
	DirectX::XMFLOAT2 Size;
	float Age;
	unsigned int Type;
};

enum ParticleType
{
	standard,
	rain,
};

static D3D11_INPUT_ELEMENT_DESC ParticleVertexLayout[] =
{
	{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "VELOCITY", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "SIZE", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "AGE", 0, DXGI_FORMAT_R32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "TYPE", 0, DXGI_FORMAT_R32_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};

My struct that I use and we see the TYPE semantic.

 

struct Particle
{
	float4 InitialPosW : POSITION;
	float3 InitialVelW : VELOCITY;
	float2 SizeW : SIZE;
	float Age : AGE;
	uint Type : TYPE;
};

Here is the simple vertex shader:

Particle main( Particle vin)
{
	return vin;
}

And the more complex Geometry shader:

[maxvertexcount(6)]
void mainGS(point Particle gin[1], inout PointStream<Particle> ptStream)
{
  gin[0].Age += playingTime;
  
  if (gin[0].Type == PT_EMITTER)
  {
    // time to emit a new particle?
    if (gin[0].Age > 0.002f)
    {
      for (int i = 0; i < 5; ++i)
      {
	// Spread rain drops out above the camera.
	float3 vRandom = 35.0f*RandVec3((float)i / 5.0f);
	vRandom.y = 20.0f;

	Particle p;
	p.InitialPosW = float4((emitterPositionW.xyz + vRandom),1.0);
	p.InitialVelW = float3(0.0f, 0.0f, 0.0f);
	p.SizeW = float2(1.0f, 1.0f);
	p.Age = 0.0f;
	p.Type = PT_FLARE;

	ptStream.Append(p); 
      }
 
      // reset the time to emit  
      gin[0].Age = 0.0f; 
    }

    // always keep emitters
    ptStream.Append(gin[0]);
  }
  else
  {
    // Specify conditions to keep particle; this may vary from system to system.
    if (gin[0].Age <= 3.0f)
      ptStream.Append(gin[0]);

  }
}

GeometryShader gsStreamOut = ConstructGSWithSO(	CompileShader(gs_5_0, mainGS()),"POSITION.xyzw; VELOCITY.xyz; SIZE.xy; AGE.x; TYPE.x");

Anyone got an idea why I am getting this, I've seen this error before, but not when both are using the same input/output structure.

 

 

Edited by strimen

Share this post


Link to post
Share on other sites

This topic is 1104 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this