Search code examples
shaderhlslpixel-shader

Discarding pixels in ps_2_0?


Everything I looked up online indicates it does microsoft documents etc (but doesn't mention version)... but when I do this code:

float4 main(in float4 mXYZ : POSITION,in float4 mColor : COLOR0,in float2 mUV : TEXCOORD0): COLOR0
        {
            float4 pixel;
            pixel=mColor;
            if (ShouldDiscard(mUV)) {discard;}
            else return pixel;
    }

the compile tells me:

error X3004: undeclared identifier 'discard'

Am I doing some wonky syntax here? Or do you have to discard some other way in PS_2_0?


Solution

  • Okay, found it myself... for posterity, in older HLSL, discard can be accomplished with "clip(-1);"