Hi there! I'm working on a 2.5D XNA game which is quite pixel-shader heavy. So far I've been compiling shaders with PS 2.0, but as I'm experimenting with SSAO at the moment, I found myself hitting the instruction constraints of working with it.
But the trouble is, I can't get PS 3.0 shaders to work! They compile just fine and don't get any errors, but they don't seem to have any effect at all. Frustratingly, I haven't found anything on the internet that deals with this issue either, so I'm hoping someone can shed light on what's going wrong.
Here is a simple shader which should just render a sprite black:
sampler ColorSampler : register(s0);
float4 ShadowDirPS(float2 texCoord : TEXCOORD0) : COLOR0
{
float4 output = float4(0,0,0,0);
output.a = 1;
return output;
}
technique Shadowing
{
pass Pass0
{
PixelShader = compile ps_3_0 ShadowDirPS();
}
}
It works fine if I write 'compile ps_2_0 ShadowDirPS();' at the bottom and I get a black screen, but no effect if I replace it with ps_3_0.
This is the code where the shader gets called:
Game1.spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
ShadowDir.Begin();
foreach (EffectPass pass in ShadowDir.CurrentTechnique.Passes)
{
pass.Begin();
Game1.spriteBatch.Draw(DepthPass.GetTexture(), Vector2.Zero, Color.White);
pass.End();
}
Game1.spriteBatch.End();
ShadowDir.End();
There's probably something really simple and obvious that I'm not doing for it to work, but for all my searching, I've not been able to find anything that would talk about this issue - neither on MSDN nor on any other forums.
In case anyone is interested about the project: