Hi guys
I am having some trouble with if statements in my pixel shader.
Texture2D shaderTextures[3];
SamplerState SampleType;
struct VS_Output
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
};
cbuffer Lights
{
float g;
float c;
float t;
}
float4 Blender(VS_Output input):SV_TARGET
{
float4 color1;
float4 color2;
float4 color3;
float4 color4;
if( g != 0 && c == 0 && t == 0)
{
color2 = shaderTextures[0].Sample(SampleType, input.tex);
color1 = color2 * g;
}
if( g == 0 && c != 0 && t == 0)
{
color3 = shaderTextures[1].Sample(SampleType, input.tex);
color1 = color3 * c;
}
if( g == 0 && c == 0 && t != 0)
{
color4 = shaderTexture[2].Sample(SampleType, input.tex);
color1 = color4 * t;
}
return color1;
}
If i remove the if blocks leaving any one of the statements inside,
D3DX11CompileFromFile is successful. But the moment i include any if control, it fails. Where am i going wrong?
Thanks
JB