PDA

View Full Version : d3d10 vertex declaration troubles


rouncer
03-24-2009, 10:29 AM
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.)

Goz
03-24-2009, 12:07 PM
Does the debug spew tell you anything useful?

rouncer
03-24-2009, 10:06 PM
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},
};

Reedbeta
03-24-2009, 10:41 PM
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.

rouncer
03-24-2009, 10:45 PM
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...

JarkkoL
03-25-2009, 12:43 AM
This probably has nothing to do with your problem, but shouldn't BITANGENT be BINORMAL?

rouncer
03-25-2009, 05:40 AM
give me a break

JarkkoL
03-25-2009, 06:10 AM
FYI, there is no such semantic as BITANGENT in d3d.

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

rouncer
03-25-2009, 06:24 AM
your an idiot.

rouncer
03-25-2009, 06:27 AM
just cause your not smart enough to figure out my problem...

JarkkoL
03-25-2009, 06:47 AM
Neither are you and I'm not the one with the problem ;)

Goz
03-25-2009, 07:33 AM
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 ;)

Kenneth Gorking
03-25-2009, 09:04 AM
your an idiot.
Please get a clue: http://msdn.microsoft.com/en-us/library/bb509647(VS.85).aspx#VS

Learning this simple technique (http://www.webmath.com/k8ipadd.html) should also prove useful.

rouncer
03-25-2009, 10:15 PM
im sorry jarkol, your probably a good programmer, i wouldnt know...