I've made two shaders that share almost all the code except for a line that shouldn't change the result. That's the shared part of code:
struct VOut
{
float4 position : SV_POSITION;
float4 color : COLOR;
float4 ld1 : LD;
};
cbuffer LIGHT : register (cb0)
{
float4 light_direction;
float4 light_color;
};
cbuffer TRANSFORMATION_MATRIX : register (cb1)
{
float4x4 transformationMatrix;
};
cbuffer CAM_PROJ_MATRIX : register (cb2)
{
float4x4 cameraProjectionMatrix;
};
float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
return color;
}
The part that changes is the vertex shader:
VOut VShader(float3 position : POSITION, float4 color : COLOR)
{
VOut output;
float4 rpos = mul(transformationMatrix,float4(position, 1.0));
output.position = mul(cameraProjectionMatrix, rpos);
*output.ld1 = light_direction;*
output.color = color;
return output;
}
This one works fine, but if I change the line between asterisks (obviously the asterisks are not in the real code) to:
output.ld1 = float4(1.0,1.0,1.0,1.0);
then I don't see anything on the screen. How's this thing possible?
LD
is not a standard semantic, so it doesn't have any meaning. Try usingTEXCOORD0
to get a valid inter-stage interpolator. – Chuck Walbourn