• Advertisement
Sign in to follow this  

DX10: Variable shader input size...?

This topic is 3491 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

Hi to all, I have a problem about a vertex shader (SM 4.0). I need to pass a variable number of texture coordinates to my vertex shader. So I wrote something like this: #define MAXTEXCOORD 4 // Maximum UV sets that could be passed... int numberOfUVPassed; // Effective UV sets passed. Used in the shaders... VSOutput VS(float4 Pos: POSITION, float4 Norm: NORMAL, float2 UV[MAXTEXCOORD]: TEXCOORD0) { // ... Code ... } Actually this compile and works on my nVidia Geforce 8600 GT with Microsoft DirectX SDK of November 2007 (I haven't tried other versions yet). Anyway, if I run my program in debug mode, I receive the following 3 error messages in the output window of Visual Studio (on the DrawIndexed call, when, for example I use a vertex buffer with only one set of UV coordinates): D3D10: ERROR: ID3D10Device:: DrawIndexed: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (TEXCOORD,1) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ] D3D10: ERROR: ID3D10Device:: DrawIndexed: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (TEXCOORD,2) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ] D3D10: ERROR: ID3D10Device:: DrawIndexed: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (TEXCOORD,3) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ] Despite these messages, the DrawIndexed draw the mesh correctly... but I'm afraid that this code could stop works in future with other videocard and/or drivers (I don't know if the SM4.0 specifications standardize the behaviour in situation like this or not). I'm afraid of these messages, especially because they are error messages and not warning one. What do you think about this? There are other way to pass a variable UV coordinates set to my shader? Or the only way is duplicating it tons of time? ( :no: ) Thanks in advance for any reply, - AGPX

Share this post


Link to post
Share on other sites
Advertisement
From the error, it looks like your input layout doesn't match the shader's input.

Share this post


Link to post
Share on other sites
"From the error, it looks like your input layout doesn't match the shader's input."

In my idea, the shader:

VSOutput VS(float4 Pos: POSITION, float4 Norm: NORMAL, float2 UV[4]: TEXCOORD0)
{
// ... Code ...
}

should be used with 4 different input layout:

1) position, normal and 1 texture coords
2) position, normal and 2 textures coords
3) position, normal and 3 textures coords
4) position, normal and 4 textures coords

Obviously, the only one that doesn't generate the error is the last one.

In the other 3 case, the shader seem works too, but I'm not sure if this is true with other systems. Perhaps the missing tex coord are set to zero? My question is if this shader is potentially "safe". If not, there are other way to pass a variable set of UV texture coords to the same shader without replicating it?

Share this post


Link to post
Share on other sites
I wasn't aware this is an intended usage scenario. My understanding up to now was that if you declare float2 UV[4] you're expected to stream them, period. Not that I'm 100% sure anymore (say I was 95% sure for D3D10 and 99% for other APIs) but my understanding was that the linker could inject implementation-specific or undefined data in the unlinked stuff.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement