Jump to content


d3d10 vertex declaration troubles


13 replies to this topic

#1 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2325 posts

Posted 24 March 2009 - 05:29 PM

I am having problems with the vertex declaration.
Is anyone else finding it hard getting it to work?

Ive followed the book completely - it works sometimes, but whenever
I go back to it to add another entity, I get blank screens and elements
dont seem to operate.

Is anyone else having these problems and know what it could be?

(im sorry I dont have code to show cause its on my other computer, but it all looks right completely to the book to me.)

#2 Goz

    Senior Member

  • Members
  • PipPipPipPip
  • 574 posts

Posted 24 March 2009 - 07:07 PM

Does the debug spew tell you anything useful?

#3 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2325 posts

Posted 25 March 2009 - 05:06 AM

Ive got the internet back on my work computer...


D3D10: ERROR: ID3D10Device::DrawIndexed: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible.
The reason is that Semantic 'TEXCOORD' is defined for mismatched hardware registers between the output stage and input stage.
[ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX ]





struct vertex

{

 VEC pos;

 float u;

 float v;

 VEC tan;

 VEC bit;

 VEC nor;

};



 LAYOUTDESC lay[] =

 {

  {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0,  D3D10_INPUT_PER_VERTEX_DATA, 0},  

  {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,    0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0}, 

  {"TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12+8,  D3D10_INPUT_PER_VERTEX_DATA, 0},  

  {"BITANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT,    0, 24+8, D3D10_INPUT_PER_VERTEX_DATA, 0}, 

  {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT,    0, 36+8, D3D10_INPUT_PER_VERTEX_DATA, 0}, 

 };





#4 Reedbeta

    DevMaster Staff

  • Administrators
  • 4969 posts
  • LocationBellevue, WA

Posted 25 March 2009 - 05:41 AM

Can we see the shader? It sounds like it thinks the output of one shader doesn't match the input to the next, e.g. vertex -> geometry or geometry -> pixel. The problem might be with one of those.
reedbeta.com - developer blog, OpenGL demos, and other projects

#5 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2325 posts

Posted 25 March 2009 - 05:45 AM




struct vs_input13

{

 float4 pos : POSITION; 

 float2 uv  : TEXCOORD0;

 float3 tan : TANGENT;

 float3 bit : BITANGENT;

 float3 nor : NORMAL;

};


struct ps_input13

{

 float4 pos : SV_POSITION;

 float3 lidir: TEXCOORD0;

 float2 uv : TEXCOORD1;

};



ps_input13 vs13(vs_input13 input)

{

 ps_input13 output = (ps_input13)0;

 output.pos = mul(input.pos, wvp);

 output.uv=input.uv;

 

 //float3x3 tbn=float3x3(input.tan,input.bit,input.nor);


 

 output.lidir=ldir;//mul(ldir, tbn);

   

 return output;

}



float4 ps13(ps_input13 input) : SV_Target

{

 float3 nor=nort.Sample(sstate, float2(input.uv.x,input.uv.y)).rgb;

 nor=nor*2-1;


 float light=dot(normalize(input.lidir),-nor);

 if(light<0) light=0;

 if(light>1) light=1;

 

 float4 col=nort.Sample(sstate, float2(input.uv.x,input.uv.y)).rgba;//*light;

 

 col.a=1.0f;

 

 return col;

}



technique10 normal

{

 pass P0

 {

  SetVertexShader(CompileShader(vs_4_0,vs13()));

  SetGeometryShader(NULL);

  SetPixelShader(CompileShader(ps_4_0,ps13()));

 }

}




does that help? It all looks right to me...

The error at the moment is the texcoord is refusing to work, all I get is a clamped output... a zero texel.
But depending on how I shuffle things around all sorts of things happen...

#6 JarkkoL

    Senior Member

  • Members
  • PipPipPipPip
  • 467 posts

Posted 25 March 2009 - 07:43 AM

This probably has nothing to do with your problem, but shouldn't BITANGENT be BINORMAL?

#7 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2325 posts

Posted 25 March 2009 - 12:40 PM

give me a break

#8 JarkkoL

    Senior Member

  • Members
  • PipPipPipPip
  • 467 posts

Posted 25 March 2009 - 01:10 PM

FYI, there is no such semantic as BITANGENT in d3d.

Edit: Just wondering, do your shaders have some stupidity like #define BITANGENT TEXCOORD

#9 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2325 posts

Posted 25 March 2009 - 01:24 PM

your an idiot.

#10 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2325 posts

Posted 25 March 2009 - 01:27 PM

just cause your not smart enough to figure out my problem...

#11 JarkkoL

    Senior Member

  • Members
  • PipPipPipPip
  • 467 posts

Posted 25 March 2009 - 01:47 PM

Neither are you and I'm not the one with the problem ;)

#12 Goz

    Senior Member

  • Members
  • PipPipPipPip
  • 574 posts

Posted 25 March 2009 - 02:33 PM

You could try answering the question Rouncer? Its really not a great plan to call people idiots when they are trying to help. You could always, ya know, help us to help you ...

As it goes I'd be intrigued as to why you are saying that position is 3 floats long and then declaring it in your vs_input struct as a float4 ... This causes the texturecoord in the input struct to be in a different position to what the vertex declaration says it should be ...

In future, though, drop the attitude. Those in glass houses should not throw stones.

Edit: Btw "Your" means belonging to you. "You're" means you are. Just so you know ;)

#13 Kenneth Gorking

    Senior Member

  • Members
  • PipPipPipPip
  • 911 posts

Posted 25 March 2009 - 04:04 PM

rouncer said:

your an idiot.
Please get a clue: http://msdn.microsof...(VS.85).aspx#VS

Learning this simple technique should also prove useful.
"Stupid bug! You go squish now!!" - Homer Simpson

#14 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2325 posts

Posted 26 March 2009 - 05:15 AM

im sorry jarkol, your probably a good programmer, i wouldnt know...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users