Hi all,
Apologies if this is something daft on my part, or a known issue (I’ve searched to no avail).
I’ve got a really simple shader for flat shading geometry. It uses the following line to find the normal for each pixel, in the pixel shader, and shade accordingly:
float3 normal = cross(ddy(input.PositionWorld.xyz), ddx(input.PositionWorld.xyz));
All is well and good. Results are as expected…when compiling with SM 5. When I switch to 4_0_level_9_1, I get an error that the compiler cannot map to the pixel instruction set. Through a process of elimination, I’ve identified the problem as the intrinsic ‘ddy’ method. It just doesn’t like it at all. I can replace ddy with ddx, and the shader compiles fine (and obviously then just looks wrong).
I’m using the stable 3.2 installer, and targeting DirectX11. Like I said, compiling the shader for SM 5 is fine, but 4_0_9_1 isn’t.
Any ideas?