Vertex shader-pixel shader linker message

Started by
3 comments, last by dradon 20 years, 2 months ago
I''m getting a warning message in my program''s debug output from the VS->PS linker with the following text: Direct3D9: VS->PS Linker: X137: (Warning) Based on a pixel shader tex* instruction using texture coordinate set [1], the vertex shader is expected to output texcoord1.xyz. However the current vertex shader only outputs texcoord1.x. And the offending code in the pixel shader is something similar to (in HLSL): ... float4 Values = { some data }; Values *= InData.Number; // this is the offending line! ... Where InData is the pixel shader input with a float1 member named Number. After some experimenting, it seems no matter what I do, if I access InData.Number in ANY way, I get the aforementioned message. Can anyone explain to me why that is, and why Direct3D is convinced I''m using yz even though I''m only really using x? Thanks in advance!
Advertisement
Try "InData.Number.xxxx" instead?
enum Bool { True, False, FileNotFound };
Hmmm. I had tried swizzling but as I was double checking it I gleaned a bit more info. The warning only seems to show up if I involve InData.Number with the return value of the pixel shader in any way. For example:

float4 Out = { some numbers };
float4 SomeData = { some more numbers };
SomeData *= InData.Number.xxxx; // this is fine since SomeData isn''t returned
Out *= InData.Number.xxxx; // this causes the warning message...
return Out;

Does that make sense to anyone?
Yeah, that makes sense. The compiler does sophisticated data flow analysis. Because you don''t have much in the way of flow control or aliasing, it can actually do this significantly more aggressively than a C/C++ compiler.

If that swizzle generates an error, even though you write to the output X coordinate, then the warning is bogus, and you should file a bug report.
enum Bool { True, False, FileNotFound };
Okay, just to make sure I''m not missing anything silly, here''s some more in-depth sample code that generated the warning message:

in the effect file:
vertex shader inputs defined like so:
struct VS_INPUT
{
float4 vPos : POSITION;
};

and vertex shader output like so:
struct VS_OUTPUT
{
float4 vPos : POSITION;
float4 Color : COLOR;
float1 fFactor : TEXCOORD0; // here''s the problem member...
};

vertex shader similar to:
VS_OUTPUT VS_main(VS_INPUT In)
{
VS_OUTPUT Out = (VS_OUTPUT)0;
Out.vPos = In.vPos; // just an example, not too useful
Out.Color = float4( 0.5f, 0.5f, 0.5f, 1.0f }; // grey sounds good
Out.fFactor = 0.5f; // any value will do
}

pixel shader inputs like so:
struct PS_INPUT
{
float4 Color : COLOR;
float1 fFactor : TEXCOORD0;
};

and pixel shader similar to:
float4 PS_main(PS_INPUT In)
{
float4 Out = In.Color;
Out *= In.fFactor.xxxx; // this guy causes the warning message
return Out;
}

Anyone see why that should cause the warning message, or could it be a bogus warning?

Luckily I''ve worked around the issue with a little code restructuring so I no longer get the message, but I''m still curious to know the cause in case it crops up again or needs to be reported as a bug.

Thanks all

This topic is closed to new replies.

Advertisement