Shader worked before, but now it says that the shader isn't supported anymore

Viewed 73

I'm trying to make a sobel edge detection shader in Unity, but I have no shader knowledge. For the first part, I need to get the camera depth information which I did. After trying to develop the shader further (implementing the algorithm) I got this error: Shader warning in 'Custom/SobelEdgeDetectionShader': Custom/SobelEdgeDetectionShader shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

After trying to find a solution to the problem (which was a failure) I decided to delete the lines I wrote and revert the code back to the point where the shader worked, but the error persisted. Restarting Unity didn't work either.

Here is the shader:

Shader "Custom/SobelEdgeDetectionShader"
{
    Properties
    {
        _DepthLevel("Depth Level", Range(1, 3)) = 2
    }
        SubShader
    {
        UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"

        Pass
        {
            CGPROGRAM
            #pragma exclude_renderers d3d11

            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            uniform sampler2D_float _CameraDepthTexture;
            uniform fixed _DepthLevel;

            struct uinput
            {
                float4 pos : POSITION;
                half2 uv : TEXCOORD0;
            };

            struct uoutput
            {
                float4 pos : SV_POSITION;
                half2 uv : TEXCOORD0;
            };

            uoutput vert(uinput i)
            {
                uoutput o;
                o.pos = UnityObjectToClipPos(i.pos);
                o.uv = MultiplyUV(UNITY_MATRIX_TEXTURE0, i.uv);
                return o;
            }

            fixed4 frag(uoutput o) : COLOR
            {
                float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, o.uv);
                float linearDepth = Linear01Depth(depth);
                float4 depthInfo;

                depthInfo = fixed4(linearDepth, linearDepth, linearDepth, 1.0) * 10 * _DepthLevel;
                                       
                return depthInfo;
            }

            ENDCG
        }
    }
}

If I missed any important information, please let me know.

0 Answers
Related