hi folk,
I've met a problem, that I don't understand...
this is my simple pixel shader...
// Pixel shader input structure
struct PS_INPUT
{
float4 Position : POSITION;
float2 AlphaCoord : TEXCOORD0;
float2 TexCoord0 : TEXCOORD1;
float2 TexCoord1 : TEXCOORD2;
float2 TexCoord2 : TEXCOORD3;
float2 TexCoord3 : TEXCOORD4;
};
// Pixel shader output structure
struct PS_OUTPUT
{
float4 Color : COLOR0;
};
// Global variables
sampler2D AlphaTexture;
sampler2D Texture1;
sampler2D Texture2;
sampler2D Texture3;
sampler2D Texture0;
// Name: Simple Pixel Shader
PS_OUTPUT ps_main( in PS_INPUT In )
{
PS_OUTPUT Out;
float4 alphatex = tex2D(AlphaTexture, In.AlphaCoord).rgba;
float4 texture0 = tex2D(Texture0, In.TexCoord0);
float4 texture1 = tex2D(Texture1, In.TexCoord1);
float4 texture2 = tex2D(Texture2, In.TexCoord2);
float4 texture3 = tex2D(Texture3, In.TexCoord3);
Out.Color = (texture0 * alphatex.r)+
(texture1 * alphatex.g)+
(texture2 * alphatex.b)+
(texture3 * alphatex.a);
return(Out);
}
The Alpha texture, is a valid 32bit texture.. so it has 4 values: b,r,g,a
It is loaded from a 32bit .bmp file.
This shader gives me a compilation error..
the problem is in this line (texture3 * alphatex.a); where appears alphatex.a
If I delete it, all works fine.
So, I've thought that alphatex was a 24 bit only...
but if I add this code, where alphatex.a appears, I don't get errors.
float4 texture4 = (texture0 * alphatex.r)+
(texture1 * alphatex.g)+
(texture2 * alphatex.b)+
(texture3 * alphatex.a);
So, the problem is not in alphamap.a, because if it was an invalid parameter, I should get an error...
The problem comes back if I add Out.Color = texture4;
Is like if out.color (a float4 type) doesn't accept the 4th texture4 byte.
Why???!?
I don't understand...
you can see an error?
thanks for aids