I'm trying to add edge detection post process which I tried to base off different demos, but I can't seem get it to work.
I try to compile shader with "ps_4_0_level_9_1" (have to keep it DX9 compatible) but it throws: "error X4532: cannot map expression to pixel shader instruction set" at line 11, but on other hand it works with "ps_4_0".
Here's my shader:
#define threshold 0.04
SamplerState texSampler : register(s0);
Texture2D<float> depthTex : register(t0);
float4 EdgeDetectionPS(float4 position : SV_POSITION, float2 texcoord : TEXCOORD0) : SV_TARGET {
float fCenter = depthTex.Sample(texSampler, texcoord);
float4 fEdges = {
depthTex.Sample(texSampler, texcoord, int2(-1, 0)),
depthTex.Sample(texSampler, texcoord, int2(0, -1)),
depthTex.Sample(texSampler, texcoord, int2(1, 0)),
depthTex.Sample(texSampler, texcoord, int2(0, 1)) // Line 11
};
float4 delta = abs(fCenter.xxxx - fEdges);
float4 edges = step(threshold / 10.0, delta);
if (dot(edges, 1.0) == 0.0)
discard;
return edges;}Anyone knows why this error happens, or how to fix it?
Thank you.
P.S. It doesn't work with "ps_4_0_level_9_3" either, but I don't know what's the difference






