                     float2 pixelLeftTexCoord = texCoord - float2(i * _MainTex_TexelSize.x, 0);
                     fixed pixelLeftAlpha = tex2D(_MainTex, pixelLeftTexCoord).a;
                     if (pixelLeftAlpha > alphaThreshold) return 1;
+
+                    if (i > outlineSize) break;
                 }
 
                 return 0;

                if (sampledColor.a > alphaThreshold) return 0;

                // Looking for an opaque pixel (sprite border from outise) around computed fragment with given depth (_OutlineSize).
                [unroll(10)]
                for (int i = 1; i < outlineSize + 1; i++)
                {
                    float2 pixelUpTexCoord = texCoord + float2(0, i * _MainTex_TexelSize.y);
                    fixed pixelUpAlpha = tex2D(_MainTex, pixelUpTexCoord).a;

            #pragma multi_compile _ ETC1_EXTERNAL_ALPHA
            #pragma multi_compile _ SPRITE_OUTLINE_OUTSIDE

            #ifndef SAMPLE_DEPTH_LIMIT
            #define SAMPLE_DEPTH_LIMIT 10
            #endif

            #ifdef UNITY_INSTANCING_ENABLED
            UNITY_INSTANCING_CBUFFER_START(PerDrawSprite)
            fixed4 unity_SpriteRendererColorArray[UNITY_INSTANCED_ARRAY_SIZE];
