I have this weird problem with a sampler in pixel shaders. When I take a sample from a sampler into an empty variable float4, I always get a black / transparent color. Therefore, if I use this, I get a black screen:
float4 PixelShaderFunction(float2 TextureCoordinate : TEXCOORD0) : COLOR0 { float2 uv = TextureCoordinate; float4 pixelColor = tex2D(implicitInputSampler, uv); //contrast pixelColor.rgb = ((pixelColor.rgb - 0.5f) * max(Contrast, 0)) + 0.5f; //brightness pixelColor.rgb = pixelColor.rgb + (Brightness - 1); // return final pixel color return pixelColor; }
I use this, but it works fine:
float4 PixelShaderFunction(float2 TextureCoordinate : TEXCOORD0) : COLOR0 { float2 uv = TextureCoordinate; float4 pixelColor = {0,0,0,1}; pixelColor += tex2D(implicitInputSampler, uv); //contrast pixelColor.rgb = ((pixelColor.rgb - 0.5f) * max(Contrast, 0)) + 0.5f; //brightness pixelColor.rgb = pixelColor.rgb + (Brightness - 1); // return final pixel color return pixelColor; }
This only happens in my dev environment at home on the AMD 4850 GPU. When I try to use some nVidias or AMD5850, it works anyway ...
What is the reason for this? Am I missing some initialization of the device?
Hooray!
source share