Skip to content

When impellerc fails with a long shader compilation error, truncate it and output to a file#182786

Merged
auto-submit[bot] merged 14 commits intoflutter:masterfrom
b-luk:impellerctruncate
Feb 27, 2026
Merged

When impellerc fails with a long shader compilation error, truncate it and output to a file#182786
auto-submit[bot] merged 14 commits intoflutter:masterfrom
b-luk:impellerctruncate

Conversation

@b-luk
Copy link
Contributor

@b-luk b-luk commented Feb 23, 2026

This was suggested in #182400 (comment).
Fixes #182497

impellerc's SkSL validation produces a very long error message consisting of the full SkSL result as well as a potentially long list of errors.

When these are more than a few lines, output a truncated version to the stderr output. If the output was truncated, write the full message to a file in the temporary directory.

Adds a new --verbose flag to impellerc. If this flag is provided, the output is never truncated.

Update shader_compiler.dart to remove the "impellerc stdout" and "impellerc stderr" output from shader_compiler.dart. The output of impellerc is already shown when it is run with _processManager.start(). So printing the output again as part of the ShaderCompilerException message is redundant and adds a lot of clutter.

Before (this is very long):

❯ flutter run --local-engine-host host_debug_unopt_arm64 --local-engine host_debug_unopt_arm64 -d mac
Launching lib/main.dart on macOS in debug mode...
Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_geometry_blended.frag": Compiled to invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

uniform vec2 uSize;
uniform vec4 uOpticalProps;
uniform float uNumShapes;
uniform float uShapeData[96];

vec4 fragColor;

float uThickness;
float uRefractiveIndex;
float uBlend;

vec2 FLT_flutter_local_FlutterFragCoord()
{
    return flutter_FragCoord.xy;
}

float FLT_flutter_local_sdfSquircle(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    vec2 maxQ = max(q, vec2(0.0));
    return (min(max(q.x, q.y), 0.0) + sqrt((maxQ.x * maxQ.x) + (maxQ.y * maxQ.y))) - r;
}

float FLT_flutter_local_sdfEllipse(vec2 p, inout vec2 r)
{
    r = max(r, vec2(9.9999997473787516355514526367188e-05));
    vec2 invR = vec2(1.0) / r;
    vec2 invR2 = invR * invR;
    vec2 pInvR = p * invR;
    float k1 = length(pInvR);
    vec2 pInvR2 = p * invR2;
    float k2 = length(pInvR2);
    return (k1 * (k1 - 1.0)) / max(k2, 9.9999997473787516355514526367188e-05);
}

float FLT_flutter_local_sdfRRect(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    return (min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0)))) - r;
}

float FLT_flutter_local_getShapeSDF(float type, vec2 p, vec2 center, vec2 size, float r)
{
    if (type == 1.0)
    {
        vec2 param = p - center;
        vec2 param_1 = size / vec2(2.0);
        float param_2 = r;
        float _256 = FLT_flutter_local_sdfSquircle(param, param_1, param_2);
        return _256;
    }
    if (type == 2.0)
    {
        vec2 param_3 = p - center;
        vec2 param_4 = size / vec2(2.0);
        float _270 = FLT_flutter_local_sdfEllipse(param_3, param_4);
        return _270;
    }
    if (type == 3.0)
    {
        vec2 param_5 = p - center;
        vec2 param_6 = size / vec2(2.0);
        float param_7 = r;
        float _287 = FLT_flutter_local_sdfRRect(param_5, param_6, param_7);
        return _287;
    }
    return 1000000000.0;
}

float FLT_flutter_local_getShapeSDFFromArray(int index, vec2 p, float shapeData[96])
{
    int baseIndex = index * 6;
    float type = shapeData[baseIndex];
    vec2 center = vec2(shapeData[baseIndex + 1], shapeData[baseIndex + 2]);
    vec2 size = vec2(shapeData[baseIndex + 3], shapeData[baseIndex + 4]);
    float cornerRadius = shapeData[baseIndex + 5];
    float param = type;
    vec2 param_1 = p;
    vec2 param_2 = center;
    vec2 param_3 = size;
    float param_4 = cornerRadius;
    return FLT_flutter_local_getShapeSDF(param, param_1, param_2, param_3, param_4);
}

float FLT_flutter_local_smoothUnion(float d1, float d2, float k)
{
    if (k <= 0.0)
    {
        return min(d1, d2);
    }
    float e = max(k - abs(d1 - d2), 0.0);
    return min(d1, d2) - (((e * e) * 0.25) / k);
}

float FLT_flutter_local_sceneSDF(vec2 p, int numShapes, float shapeData[96], float blend)
{
    if (numShapes == 0)
    {
        return 1000000000.0;
    }
    int param = 0;
    vec2 param_1 = p;
    float param_2[96] = shapeData;
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
    if (numShapes <= 4)
    {
        if (numShapes >= 2)
        {
            int param_3 = 1;
            vec2 param_4 = p;
            float param_5[96] = shapeData;
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
            float param_6 = result;
            float param_7 = shapeSDF;
            float param_8 = blend;
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
        }
        if (numShapes >= 3)
        {
            int param_9 = 2;
            vec2 param_10 = p;
            float param_11[96] = shapeData;
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
            float param_12 = result;
            float param_13 = shapeSDF_1;
            float param_14 = blend;
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
        }
        if (numShapes >= 4)
        {
            int param_15 = 3;
            vec2 param_16 = p;
            float param_17[96] = shapeData;
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
            float param_18 = result;
            float param_19 = shapeSDF_2;
            float param_20 = blend;
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
        }
    }
    else
    {
        for (int i = 1; i < min(numShapes, 16); i++)
        {
            int param_21 = i;
            vec2 param_22 = p;
            float param_23[96] = shapeData;
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
            float param_24 = result;
            float param_25 = shapeSDF_3;
            float param_26 = blend;
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
        }
    }
    return result;
}

vec4 FLT_flutter_local_encodeDisplacementData(vec2 displacement, float maxDisplacement, float height, float thickness, float alpha)
{
    vec2 normalizedDisp = ((displacement / vec2(maxDisplacement)) * 0.5) + vec2(0.5);
    normalizedDisp = clamp(normalizedDisp, vec2(0.0), vec2(1.0));
    float _462;
    if (thickness > 0.0)
    {
        _462 = clamp(height / thickness, 0.0, 1.0);
    }
    else
    {
        _462 = 0.0;
    }
    float normalizedHeight = _462;
    return vec4(normalizedDisp.x, normalizedDisp.y, normalizedHeight, alpha);
}

void FLT_main()
{
    uThickness = uOpticalProps.z;
    uRefractiveIndex = uOpticalProps.x;
    uBlend = uOpticalProps.w;
    vec2 fragCoord = FLT_flutter_local_FlutterFragCoord();
    vec2 screenUV = vec2(fragCoord.x / uSize.x, fragCoord.y / uSize.y);
    vec2 param = fragCoord;
    int param_1 = int(uNumShapes);
    float param_2[96] = uShapeData;
    float param_3 = uBlend;
    float sd = FLT_flutter_local_sceneSDF(param, param_1, param_2, param_3);
    float foregroundAlpha = 1.0 - smoothstep(-2.0, 0.0, sd);
    if (foregroundAlpha < 0.00999999977648258209228515625)
    {
        fragColor = vec4(0.0);
        return;
    }
    float dx = dFdx(sd);
    float dy = dFdy(sd);
    float n_cos = max(uThickness + sd, 0.0) / uThickness;
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
    if ((sd >= 0.0) || (uThickness <= 0.0))
    {
        fragColor = vec4(0.0);
        return;
    }
    float x = uThickness + sd;
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
    float baseHeight = uThickness * 8.0;
    vec3 incident = vec3(0.0, 0.0, -1.0);
    float invRefractiveIndex = 1.0 / uRefractiveIndex;
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
    float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
    float maxDisplacement_1 = uThickness * 10.0;
    vec2 param_4 = displacement_1;
    float param_5 = maxDisplacement_1;
    float param_6 = height_1;
    float param_7 = uThickness;
    float param_8 = foregroundAlpha;
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
}

half4 main(float2 iFragCoord)
{
      flutter_FragCoord = float4(iFragCoord, 0, 0);
      FLT_main();
      return fragColor;
}

SkSL Error:
error: 111: initializers are not permitted on arrays (or structs containing arrays)
    float param_2[96] = shapeData;
                        ^^^^^^^^^
error: 112: unknown identifier 'param_2'
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
                                                                          ^^^^^^^
error: 119: initializers are not permitted on arrays (or structs containing arrays)
            float param_5[96] = shapeData;
                                ^^^^^^^^^
error: 120: unknown identifier 'param_5'
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
                                                                                      ^^^^^^^
error: 121: unknown identifier 'result'
            float param_6 = result;
                            ^^^^^^
error: 122: unknown identifier 'shapeSDF'
            float param_7 = shapeSDF;
                            ^^^^^^^^
error: 124: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
            ^^^^^^
error: 124: unknown identifier 'param_6'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
                                                   ^^^^^^^
error: 124: unknown identifier 'param_7'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
                                                            ^^^^^^^
error: 130: initializers are not permitted on arrays (or structs containing arrays)
            float param_11[96] = shapeData;
                                 ^^^^^^^^^
error: 131: unknown identifier 'param_11'
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
                                                                                         ^^^^^^^^
error: 132: unknown identifier 'result'
            float param_12 = result;
                             ^^^^^^
error: 133: unknown identifier 'shapeSDF_1'
            float param_13 = shapeSDF_1;
                             ^^^^^^^^^^
error: 135: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
            ^^^^^^
error: 135: unknown identifier 'param_12'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
                                                   ^^^^^^^^
error: 135: unknown identifier 'param_13'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
                                                             ^^^^^^^^
error: 141: initializers are not permitted on arrays (or structs containing arrays)
            float param_17[96] = shapeData;
                                 ^^^^^^^^^
error: 142: unknown identifier 'param_17'
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
                                                                                          ^^^^^^^^
error: 143: unknown identifier 'result'
            float param_18 = result;
                             ^^^^^^
error: 144: unknown identifier 'shapeSDF_2'
            float param_19 = shapeSDF_2;
                             ^^^^^^^^^^
error: 146: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
            ^^^^^^
error: 146: unknown identifier 'param_18'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
                                                   ^^^^^^^^
error: 146: unknown identifier 'param_19'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
                                                             ^^^^^^^^
error: 151: no match for min(int, int)
        for (int i = 1; i < min(numShapes, 16); i++)
                            ^^^^^^^^^^^^^^^^^^
error: 155: initializers are not permitted on arrays (or structs containing arrays)
            float param_23[96] = shapeData;
                                 ^^^^^^^^^
error: 156: unknown identifier 'param_23'
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
                                                                                          ^^^^^^^^
error: 157: unknown identifier 'result'
            float param_24 = result;
                             ^^^^^^
error: 158: unknown identifier 'shapeSDF_3'
            float param_25 = shapeSDF_3;
                             ^^^^^^^^^^
error: 160: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
            ^^^^^^
error: 160: unknown identifier 'param_24'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
                                                   ^^^^^^^^
error: 160: unknown identifier 'param_25'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
                                                             ^^^^^^^^
error: 163: unknown identifier 'result'
    return result;
           ^^^^^^
error: 192: initializers are not permitted on arrays (or structs containing arrays)
    float param_2[96] = uShapeData;
                        ^^^^^^^^^^
error: 194: unknown identifier 'param_2'
    float sd = FLT_flutter_local_sceneSDF(param, param_1, param_2, param_3);
                                                          ^^^^^^^
error: 195: unknown identifier 'sd'
    float foregroundAlpha = 1.0 - smoothstep(-2.0, 0.0, sd);
                                                        ^^
error: 196: unknown identifier 'foregroundAlpha'
    if (foregroundAlpha < 0.00999999977648258209228515625)
        ^^^^^^^^^^^^^^^
error: 201: unknown identifier 'sd'
    float dx = dFdx(sd);
                    ^^
error: 202: unknown identifier 'sd'
    float dy = dFdy(sd);
                    ^^
error: 203: unknown identifier 'sd'
    float n_cos = max(uThickness + sd, 0.0) / uThickness;
                                   ^^
error: 204: unknown identifier 'n_cos'
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
                                       ^^^^^
error: 204: unknown identifier 'n_cos'
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
                                               ^^^^^
error: 205: unknown identifier 'dx'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                 ^^
error: 205: unknown identifier 'n_cos'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                      ^^^^^
error: 205: unknown identifier 'dy'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                             ^^
error: 205: unknown identifier 'n_cos'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                                  ^^^^^
error: 205: unknown identifier 'n_sin'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                                         ^^^^^
error: 206: unknown identifier 'sd'
    if ((sd >= 0.0) || (uThickness <= 0.0))
         ^^
error: 211: unknown identifier 'sd'
    float x = uThickness + sd;
                           ^^
error: 212: unknown identifier 'x'
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
                                                                ^
error: 212: unknown identifier 'x'
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
                                                                    ^
error: 213: unknown identifier 'sqrtTerm'
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
                         ^^^^^^^^
error: 213: unknown identifier 'sd'
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
                                                     ^^
error: 217: unknown identifier 'normal'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                         ^^^^^^
error: 218: unknown identifier 'height_1'
    float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                               ^^^^^^^^
error: 218: unknown identifier 'baseRefract'
...   float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                                                                          ^^^^^^^^^^^
error: 219: unknown identifier 'baseRefract'
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
                          ^^^^^^^^^^^
error: 219: unknown identifier 'baseRefractLength'
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
                                           ^^^^^^^^^^^^^^^^^
error: 221: unknown identifier 'displacement_1'
    vec2 param_4 = displacement_1;
                   ^^^^^^^^^^^^^^
error: 223: unknown identifier 'height_1'
    float param_6 = height_1;
                    ^^^^^^^^
error: 225: unknown identifier 'foregroundAlpha'
    float param_8 = foregroundAlpha;
                    ^^^^^^^^^^^^^^^
error: 226: unknown identifier 'param_4'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                         ^^^^^^^
error: 226: unknown identifier 'param_6'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                                           ^^^^^^^
error: 226: unknown identifier 'param_8'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                                                          ^^^^^^^
63 errors



Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_arbitrary.frag": Compiled to invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

uniform vec2 uSize;
uniform vec2 uForegroundSize;
uniform vec4 uGlassColor;
uniform vec4 uOpticalProps;
uniform vec4 uLightConfig;
uniform vec2 uTransformData;
uniform vec2 uLightDirection;
uniform mat4 uTransform;
uniform shader uBackgroundTexture;
uniform half2 uBackgroundTexture_size;
uniform shader uForegroundTexture;
uniform half2 uForegroundTexture_size;
uniform shader uForegroundBlurredTexture;
uniform half2 uForegroundBlurredTexture_size;

vec4 fragColor;

float uChromaticAberration;
float uLightAngle;
float uLightIntensity;
float uAmbientStrength;
float uThickness;
float uRefractiveIndex;
vec2 uOffset;
float uSaturation;
float uGaussianBlur;

vec2 FLT_flutter_local_FlutterFragCoord()
{
    return flutter_FragCoord.xy;
}

float FLT_flutter_local_computeY(float coordY, vec2 size)
{
    return coordY / size.y;
}

float FLT_flutter_local_approximateSDF(float blurredAlpha, float thickness)
{
    float normalizedDistance = smoothstep(0.0, 1.0, blurredAlpha);
    return (-normalizedDistance) * thickness;
}

vec2 FLT_flutter_local_findShapeCenter(vec2 currentUV)
{
    vec2 texelSize = vec2(2.0) / uForegroundSize;
    vec2 centerSum = vec2(0.0);
    float totalAlpha = 0.0;
    int sampleRadius = 10;
    int _692 = -sampleRadius;
    for (int y = _692; y <= sampleRadius; y++)
    {
        int _703 = -sampleRadius;
        for (int x = _703; x <= sampleRadius; x++)
        {
            vec2 sampleUV = currentUV + (vec2(float(x), float(y)) * texelSize);
            bool _724 = sampleUV.x >= 0.0;
            bool _730;
            if (_724)
            {
                _730 = sampleUV.x <= 1.0;
            }
            else
            {
                _730 = _724;
            }
            bool _736;
            if (_730)
            {
                _736 = sampleUV.y >= 0.0;
            }
            else
            {
                _736 = _730;
            }
            bool _742;
            if (_736)
            {
                _742 = sampleUV.y <= 1.0;
            }
            else
            {
                _742 = _736;
            }
            if (_742)
            {
                float alpha = uForegroundTexture.eval(uForegroundTexture_size * ( sampleUV)).w;
                if (alpha > 0.100000001490116119384765625)
                {
                    centerSum += (sampleUV * alpha);
                    totalAlpha += alpha;
                }
            }
        }
    }
    vec2 _771;
    if (totalAlpha > 0.0)
    {
        _771 = centerSum / vec2(totalAlpha);
    }
    else
    {
        _771 = currentUV;
    }
    return _771;
}

vec3 FLT_flutter_local_getReconstructedNormal(vec2 p, float thickness)
{
    vec2 uv = p / uForegroundSize;
    if (uForegroundTexture.eval(uForegroundTexture_size * ( uv)).w < 0.00999999977648258209228515625)
    {
        return vec3(0.0, 0.0, 1.0);
    }
    vec2 param = uv;
    vec2 shapeCenter = FLT_flutter_local_findShapeCenter(param);
    vec2 centerToPoint = uv - shapeCenter;
    if (length(centerToPoint) < 0.001000000047497451305389404296875)
    {
        return vec3(0.0, 0.0, 1.0);
    }
    vec2 outwardDirection = normalize(centerToPoint);
    float blurredAlpha = uForegroundBlurredTexture.eval(uForegroundBlurredTexture_size * ( uv)).w;
    float sharpAlpha = uForegroundTexture.eval(uForegroundTexture_size * ( uv)).w;
    float edgeDistance = smoothstep(0.0, 1.0, blurredAlpha);
    float normalExponent = 0.20000000298023223876953125;
    float normalZ = pow(edgeDistance, normalExponent);
    float xyScale = sqrt(max(0.0, 1.0 - (normalZ * normalZ)));
    return normalize(vec3(outwardDirection * xyScale, normalZ));
}

vec3 FLT_flutter_local_getNormal(vec2 p, float thickness)
{
    vec2 param = p;
    float param_1 = thickness;
    return FLT_flutter_local_getReconstructedNormal(param, param_1);
}

float FLT_flutter_local_getHeight(float sd, float thickness)
{
    if ((sd >= 0.0) || (thickness <= 0.0))
    {
        return 0.0;
    }
    if (sd < (-thickness))
    {
        return thickness;
    }
    float x = thickness + sd;
    return sqrt(max(0.0, (thickness * thickness) - (x * x)));
}

vec4 FLT_flutter_local_calculateRefraction(vec2 screenUV, vec3 normal, float height, float thickness, float refractiveIndex, float chromaticAberration, vec2 uSize_1, shader backgroundTexture, float blurRadius, out vec2 refractionDisplacement)
{
    float baseHeight = thickness * 8.0;
    vec3 incident = vec3(0.0, 0.0, -1.0);
    float invRefractiveIndex = 1.0 / refractiveIndex;
    vec2 invUSize = vec2(1.0) / uSize_1;
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
    refractionDisplacement = baseDisplacement;
    if (chromaticAberration < 0.001000000047497451305389404296875)
    {
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
    }
    float dispersionStrength = chromaticAberration * 0.5;
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
    vec2 redUV = screenUV + (redOffset * invUSize);
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
    vec2 blueUV = screenUV + (blueOffset * invUSize);
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
    return vec4(red, greenSample.y, blue, greenSample.w);
}

vec3 FLT_flutter_local_getHighlightColor(vec3 backgroundColor, float targetBrightness)
{
    float luminance = dot(backgroundColor, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    float maxComponent = max(max(backgroundColor.x, backgroundColor.y), backgroundColor.z);
    float minComponent = min(min(backgroundColor.x, backgroundColor.y), backgroundColor.z);
    float _189;
    if (maxComponent > 0.0)
    {
        _189 = (maxComponent - minComponent) / maxComponent;
    }
    else
    {
        _189 = 0.0;
    }
    float saturation = _189;
    vec3 coloredHighlight = vec3(targetBrightness);
    if (luminance > 0.001000000047497451305389404296875)
    {
        vec3 normalizedBackground = backgroundColor / vec3(luminance);
        coloredHighlight = normalizedBackground * targetBrightness;
        float saturationBoost = 1.2999999523162841796875;
        vec3 gray = vec3(dot(coloredHighlight, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625)));
        coloredHighlight = mix(gray, coloredHighlight, vec3(saturationBoost));
        coloredHighlight = min(coloredHighlight, vec3(1.0));
    }
    float luminanceFactor = smoothstep(0.0, 0.60000002384185791015625, luminance);
    float saturationFactor = smoothstep(0.0, 0.4000000059604644775390625, saturation);
    float colorInfluence = luminanceFactor * saturationFactor;
    vec3 whiteHighlight = vec3(targetBrightness);
    return mix(whiteHighlight, coloredHighlight, vec3(colorInfluence));
}

vec3 FLT_flutter_local_calculateLighting(vec2 uv, vec3 normal, float sd, float thickness, float height, vec2 lightDirection, float lightIntensity, float ambientStrength, vec3 backgroundColor)
{
    float _286;
    if (thickness > 0.0)
    {
        _286 = height / thickness;
    }
    else
    {
        _286 = 0.0;
    }
    float normalizedHeight = _286;
    float shape = clamp((1.0 - normalizedHeight) * 1.11099994182586669921875, 0.0, 1.0);
    if (shape < 0.00999999977648258209228515625)
    {
        return vec3(0.0);
    }
    float thicknessFactor = clamp((thickness - 5.0) * 0.5, 0.0, 1.0);
    if (thicknessFactor < 0.00999999977648258209228515625)
    {
        return vec3(0.0);
    }
    float rimWidth = 1.5;
    float k = 0.88999998569488525390625;
    float x = sd / rimWidth;
    float rimFactor = 1.0 / (1.0 + ((k * x) * x));
    if ((rimFactor < 0.00999999977648258209228515625) || (lightIntensity < 0.00999999977648258209228515625))
    {
        return vec3(0.0);
    }
    vec2 normalXY = normal.xy;
    float mainLightInfluence = max(0.0, dot(normalXY, lightDirection));
    float oppositeLightInfluence = max(0.0, dot(normalXY, -lightDirection));
    float totalInfluence = mainLightInfluence + (oppositeLightInfluence * 0.800000011920928955078125);
    vec3 param = backgroundColor;
    float param_1 = 1.0;
    vec3 highlightColor = FLT_flutter_local_getHighlightColor(param, param_1);
    vec3 directionalRim = (((highlightColor * 0.699999988079071044921875) * (totalInfluence * totalInfluence)) * lightIntensity) * 2.0;
    vec3 ambientRim = (highlightColor * 0.4000000059604644775390625) * ambientStrength;
    vec3 totalRimLight = (directionalRim + ambientRim) * rimFactor;
    return (totalRimLight * thicknessFactor) * shape;
}

vec4 FLT_flutter_local_applyGlassColor(vec4 liquidColor, vec4 glassColor)
{
    vec4 finalColor = liquidColor;
    if (glassColor.w > 0.0)
    {
        float glassLuminance = dot(glassColor.xyz, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
        if (glassLuminance < 0.5)
        {
            vec3 darkened = liquidColor.xyz * (glassColor.xyz * 2.0);
            vec3 _544 = mix(liquidColor.xyz, darkened, vec3(glassColor.w));
            finalColor.x = _544.x;
            finalColor.y = _544.y;
            finalColor.z = _544.z;
        }
        else
        {
            vec3 invLiquid = vec3(1.0) - liquidColor.xyz;
            vec3 invGlass = vec3(1.0) - glassColor.xyz;
            vec3 screened = vec3(1.0) - (invLiquid * invGlass);
            vec3 _571 = mix(liquidColor.xyz, screened, vec3(glassColor.w));
            finalColor.x = _571.x;
            finalColor.y = _571.y;
            finalColor.z = _571.z;
        }
        finalColor.w = liquidColor.w;
    }
    return finalColor;
}

vec3 FLT_flutter_local_applySaturation(vec3 color, float saturation)
{
    float luminance = dot(color, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    vec3 saturatedColor = mix(vec3(luminance), color, vec3(saturation));
    return clamp(saturatedColor, vec3(0.0), vec3(1.0));
}

vec4 FLT_flutter_local_renderLiquidGlass(vec2 screenUV, vec2 p, vec2 uSize_1, float sd, float thickness, float refractiveIndex, float chromaticAberration, vec4 glassColor, vec2 lightDirection, float lightIntensity, float ambientStrength, shader backgroundTexture, vec3 normal, float foregroundAlpha, float gaussianBlur, float saturation)
{
    float param = sd;
    float param_1 = thickness;
    float height = FLT_flutter_local_getHeight(param, param_1);
    vec2 param_2 = screenUV;
    vec3 param_3 = normal;
    float param_4 = height;
    float param_5 = thickness;
    float param_6 = refractiveIndex;
    float param_7 = chromaticAberration;
    vec2 param_8 = uSize_1;
    float param_9 = gaussianBlur;
    vec2 param_10;
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
    vec2 refractionDisplacement = param_10;
    vec4 refractColor = _609;
    vec3 backgroundColor = refractColor.xyz;
    vec2 param_11 = screenUV;
    vec3 param_12 = normal;
    float param_13 = sd;
    float param_14 = thickness;
    float param_15 = height;
    vec2 param_16 = lightDirection;
    float param_17 = lightIntensity;
    float param_18 = ambientStrength;
    vec3 param_19 = backgroundColor;
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
    vec4 param_20 = refractColor;
    vec4 param_21 = glassColor;
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
    vec4 _641 = finalColor;
    vec3 _643 = _641.xyz + lighting;
    finalColor.x = _643.x;
    finalColor.y = _643.y;
    finalColor.z = _643.z;
    vec3 param_22 = finalColor.xyz;
    float param_23 = saturation;
    vec3 _655 = FLT_flutter_local_applySaturation(param_22, param_23);
    finalColor.x = _655.x;
    finalColor.y = _655.y;
    finalColor.z = _655.z;
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
}

void FLT_main()
{
    uChromaticAberration = uOpticalProps.y;
    uLightAngle = uLightConfig.x;
    uLightIntensity = uLightConfig.y;
    uAmbientStrength = uLightConfig.z;
    uThickness = uOpticalProps.z;
    uRefractiveIndex = uOpticalProps.x;
    uOffset = uTransformData;
    uSaturation = uLightConfig.w;
    uGaussianBlur = uOpticalProps.w;
    vec2 fragCoord = FLT_flutter_local_FlutterFragCoord();
    float param_24 = fragCoord.y;
    vec2 param_25 = uSize;
    float screenY = FLT_flutter_local_computeY(param_24, param_25);
    vec2 screenUV_1 = vec2(fragCoord.x / uSize.x, screenY);
    vec2 layerLocalCoord = fragCoord - uOffset;
    vec4 transformedCoord = uTransform * vec4(layerLocalCoord, 0.0, 1.0);
    float param_26 = transformedCoord.y;
    vec2 param_27 = uForegroundSize;
    float layerY = FLT_flutter_local_computeY(param_26, param_27);
    vec2 layerUV = vec2(transformedCoord.x / uForegroundSize.x, layerY);
    bool _906 = layerUV.x < 0.0;
    bool _913;
    if (!_906)
    {
        _913 = layerUV.x > 1.0;
    }
    else
    {
        _913 = _906;
    }
    bool _920;
    if (!_913)
    {
        _920 = layerUV.y < 0.0;
    }
    else
    {
        _920 = _913;
    }
    bool _927;
    if (!_920)
    {
        _927 = layerUV.y > 1.0;
    }
    else
    {
        _927 = _920;
    }
    if (_927)
    {
        fragColor = uBackgroundTexture.eval(uBackgroundTexture_size * ( screenUV_1));
        return;
    }
    vec4 foregroundColor = uForegroundTexture.eval(uForegroundTexture_size * ( layerUV));
    if (foregroundColor.w < 0.001000000047497451305389404296875)
    {
        fragColor = uBackgroundTexture.eval(uBackgroundTexture_size * ( screenUV_1));
        return;
    }
    vec4 blurred = uForegroundBlurredTexture.eval(uForegroundBlurredTexture_size * ( layerUV));
    float param_28 = blurred.w;
    float param_29 = uThickness;
    float sd_1 = FLT_flutter_local_approximateSDF(param_28, param_29);
    vec2 param_30 = transformedCoord.xy;
    float param_31 = uThickness;
    vec3 normal_1 = FLT_flutter_local_getNormal(param_30, param_31);
    vec2 param_32 = screenUV_1;
    vec2 param_33 = fragCoord;
    vec2 param_34 = uSize;
    float param_35 = sd_1;
    float param_36 = uThickness;
    float param_37 = uRefractiveIndex;
    float param_38 = uChromaticAberration;
    vec4 param_39 = uGlassColor;
    vec2 param_40 = uLightDirection;
    float param_41 = uLightIntensity;
    float param_42 = uAmbientStrength;
    vec3 param_43 = normal_1;
    float param_44 = foregroundColor.w;
    float param_45 = uGaussianBlur;
    float param_46 = uSaturation;
    fragColor = FLT_flutter_local_renderLiquidGlass(param_32, param_33, param_34, param_35, param_36, param_37, param_38, param_39, param_40, param_41, param_42, uBackgroundTexture, param_43, param_44, param_45, param_46);
}

half4 main(float2 iFragCoord)
{
      flutter_FragCoord = float4(iFragCoord, 0, 0);
      FLT_main();
      return fragColor;
}

SkSL Error:
error: 58: loop index initializer must be a constant expression
        for (int x = _703; x <= sampleRadius; x++)
             ^^^^^^^^^^^^
error: 55: loop index initializer must be a constant expression
    for (int y = _692; y <= sampleRadius; y++)
         ^^^^^^^^^^^^
error: 157: parameters of type 'shader' not allowed
...mal, float height, float thickness, float refractiveIndex, float chromaticAberration, vec2 uSize_1, shader backgroundTexture, float blurRadius, out vec2 refractionDisplacement)
                                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^
error: 159: unknown identifier 'thickness'
    float baseHeight = thickness * 8.0;
                       ^^^^^^^^^
error: 161: unknown identifier 'refractiveIndex'
    float invRefractiveIndex = 1.0 / refractiveIndex;
                                     ^^^^^^^^^^^^^^^
error: 162: unknown identifier 'uSize_1'
    vec2 invUSize = vec2(1.0) / uSize_1;
                                ^^^^^^^
error: 163: unknown identifier 'normal'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                         ^^^^^^
error: 163: unknown identifier 'invRefractiveIndex'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                                 ^^^^^^^^^^^^^^^^^^
error: 164: unknown identifier 'height'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                               ^^^^^^
error: 164: unknown identifier 'baseHeight'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                        ^^^^^^^^^^
error: 164: unknown identifier 'baseRefract'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                                                                          ^^^^^^^^^^^
error: 165: unknown identifier 'baseRefract'
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
                            ^^^^^^^^^^^
error: 165: unknown identifier 'baseRefractLength'
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
                                             ^^^^^^^^^^^^^^^^^
error: 166: unknown identifier 'refractionDisplacement'
    refractionDisplacement = baseDisplacement;
    ^^^^^^^^^^^^^^^^^^^^^^
error: 166: unknown identifier 'baseDisplacement'
    refractionDisplacement = baseDisplacement;
                             ^^^^^^^^^^^^^^^^
error: 167: unknown identifier 'chromaticAberration'
    if (chromaticAberration < 0.001000000047497451305389404296875)
        ^^^^^^^^^^^^^^^^^^^
error: 169: unknown identifier 'screenUV'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                           ^^^^^^^^
error: 169: unknown identifier 'baseDisplacement'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                                       ^^^^^^^^^^^^^^^^
error: 169: unknown identifier 'invUSize'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                                                          ^^^^^^^^
error: 170: unknown identifier 'backgroundTexture'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
               ^^^^^^^^^^^^^^^^^
error: 170: unknown identifier 'backgroundTexture_size'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
                                      ^^^^^^^^^^^^^^^^^^^^^^
error: 170: unknown identifier 'refractedUV'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
                                                                 ^^^^^^^^^^^
error: 172: unknown identifier 'chromaticAberration'
    float dispersionStrength = chromaticAberration * 0.5;
                               ^^^^^^^^^^^^^^^^^^^
error: 173: unknown identifier 'baseDisplacement'
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
                     ^^^^^^^^^^^^^^^^
error: 173: unknown identifier 'dispersionStrength'
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
                                               ^^^^^^^^^^^^^^^^^^
error: 174: unknown identifier 'baseDisplacement'
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
                      ^^^^^^^^^^^^^^^^
error: 174: unknown identifier 'dispersionStrength'
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
                                                ^^^^^^^^^^^^^^^^^^
error: 175: unknown identifier 'screenUV'
    vec2 redUV = screenUV + (redOffset * invUSize);
                 ^^^^^^^^
error: 175: unknown identifier 'redOffset'
    vec2 redUV = screenUV + (redOffset * invUSize);
                             ^^^^^^^^^
error: 175: unknown identifier 'invUSize'
    vec2 redUV = screenUV + (redOffset * invUSize);
                                         ^^^^^^^^
error: 176: unknown identifier 'screenUV'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                   ^^^^^^^^
error: 176: unknown identifier 'baseDisplacement'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                               ^^^^^^^^^^^^^^^^
error: 176: unknown identifier 'invUSize'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                                                  ^^^^^^^^
error: 177: unknown identifier 'screenUV'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                  ^^^^^^^^
error: 177: unknown identifier 'blueOffset'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                              ^^^^^^^^^^
error: 177: unknown identifier 'invUSize'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                                           ^^^^^^^^
error: 178: unknown identifier 'backgroundTexture'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                ^^^^^^^^^^^^^^^^^
error: 178: unknown identifier 'backgroundTexture_size'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                                       ^^^^^^^^^^^^^^^^^^^^^^
error: 178: unknown identifier 'redUV'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                                                                  ^^^^^
error: 179: unknown identifier 'backgroundTexture'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                       ^^^^^^^^^^^^^^^^^
error: 179: unknown identifier 'backgroundTexture_size'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                                              ^^^^^^^^^^^^^^^^^^^^^^
error: 179: unknown identifier 'greenUV'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                                                                         ^^^^^^^
error: 180: unknown identifier 'backgroundTexture'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                 ^^^^^^^^^^^^^^^^^
error: 180: unknown identifier 'backgroundTexture_size'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                                        ^^^^^^^^^^^^^^^^^^^^^^
error: 180: unknown identifier 'blueUV'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                                                                   ^^^^^^
error: 181: unknown identifier 'red'
    return vec4(red, greenSample.y, blue, greenSample.w);
                ^^^
error: 181: unknown identifier 'greenSample'
    return vec4(red, greenSample.y, blue, greenSample.w);
                     ^^^^^^^^^^^
error: 181: unknown identifier 'blue'
    return vec4(red, greenSample.y, blue, greenSample.w);
                                    ^^^^
error: 181: unknown identifier 'greenSample'
    return vec4(red, greenSample.y, blue, greenSample.w);
                                          ^^^^^^^^^^^
error: 295: parameters of type 'shader' not allowed
...maticAberration, vec4 glassColor, vec2 lightDirection, float lightIntensity, float ambientStrength, shader backgroundTexture, vec3 normal, float foregroundAlpha, float gaussianBlur, float saturation)
                                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^
error: 297: unknown identifier 'sd'
    float param = sd;
                  ^^
error: 298: unknown identifier 'thickness'
    float param_1 = thickness;
                    ^^^^^^^^^
error: 299: unknown identifier 'param'
    float height = FLT_flutter_local_getHeight(param, param_1);
                                               ^^^^^
error: 299: unknown identifier 'param_1'
    float height = FLT_flutter_local_getHeight(param, param_1);
                                                      ^^^^^^^
error: 300: unknown identifier 'screenUV'
    vec2 param_2 = screenUV;
                   ^^^^^^^^
error: 301: unknown identifier 'normal'
    vec3 param_3 = normal;
                   ^^^^^^
error: 302: unknown identifier 'height'
    float param_4 = height;
                    ^^^^^^
error: 303: unknown identifier 'thickness'
    float param_5 = thickness;
                    ^^^^^^^^^
error: 304: unknown identifier 'refractiveIndex'
    float param_6 = refractiveIndex;
                    ^^^^^^^^^^^^^^^
error: 305: unknown identifier 'chromaticAberration'
    float param_7 = chromaticAberration;
                    ^^^^^^^^^^^^^^^^^^^
error: 306: unknown identifier 'uSize_1'
    vec2 param_8 = uSize_1;
                   ^^^^^^^
error: 307: unknown identifier 'gaussianBlur'
    float param_9 = gaussianBlur;
                    ^^^^^^^^^^^^
error: 309: unknown identifier 'FLT_flutter_local_calculateRefraction'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10...
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: 309: unknown identifier 'param_2'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                      ^^^^^^^
error: 309: unknown identifier 'param_3'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                               ^^^^^^^
error: 309: unknown identifier 'param_4'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                        ^^^^^^^
error: 309: unknown identifier 'param_5'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                 ^^^^^^^
error: 309: unknown identifier 'param_6'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 309: unknown identifier 'param_7'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 309: unknown identifier 'param_8'
... _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 309: unknown identifier 'backgroundTexture'
...LT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^^^^^^^^^^^
error: 309: unknown identifier 'param_9'
...lculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 311: unknown identifier '_609'
    vec4 refractColor = _609;
                        ^^^^
error: 312: unknown identifier 'refractColor'
    vec3 backgroundColor = refractColor.xyz;
                           ^^^^^^^^^^^^
error: 313: unknown identifier 'screenUV'
    vec2 param_11 = screenUV;
                    ^^^^^^^^
error: 314: unknown identifier 'normal'
    vec3 param_12 = normal;
                    ^^^^^^
error: 315: unknown identifier 'sd'
    float param_13 = sd;
                     ^^
error: 316: unknown identifier 'thickness'
    float param_14 = thickness;
                     ^^^^^^^^^
error: 317: unknown identifier 'height'
    float param_15 = height;
                     ^^^^^^
error: 318: unknown identifier 'lightDirection'
    vec2 param_16 = lightDirection;
                    ^^^^^^^^^^^^^^
error: 319: unknown identifier 'lightIntensity'
    float param_17 = lightIntensity;
                     ^^^^^^^^^^^^^^
error: 320: unknown identifier 'ambientStrength'
    float param_18 = ambientStrength;
                     ^^^^^^^^^^^^^^^
error: 321: unknown identifier 'backgroundColor'
    vec3 param_19 = backgroundColor;
                    ^^^^^^^^^^^^^^^
error: 322: unknown identifier 'param_11'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                        ^^^^^^^^
error: 322: unknown identifier 'param_12'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                  ^^^^^^^^
error: 322: unknown identifier 'param_13'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                            ^^^^^^^^
error: 322: unknown identifier 'param_14'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                      ^^^^^^^^
error: 322: unknown identifier 'param_15'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 322: unknown identifier 'param_16'
...c3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 322: unknown identifier 'param_17'
...g = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 322: unknown identifier 'param_18'
...utter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 322: unknown identifier 'param_19'
...l_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 323: unknown identifier 'refractColor'
    vec4 param_20 = refractColor;
                    ^^^^^^^^^^^^
error: 324: unknown identifier 'glassColor'
    vec4 param_21 = glassColor;
                    ^^^^^^^^^^
error: 325: unknown identifier 'param_20'
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
                                                        ^^^^^^^^
error: 325: unknown identifier 'param_21'
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
                                                                  ^^^^^^^^
error: 326: unknown identifier 'finalColor'
    vec4 _641 = finalColor;
                ^^^^^^^^^^
error: 327: unknown identifier '_641'
    vec3 _643 = _641.xyz + lighting;
                ^^^^
error: 327: unknown identifier 'lighting'
    vec3 _643 = _641.xyz + lighting;
                           ^^^^^^^^
error: 328: unknown identifier 'finalColor'
    finalColor.x = _643.x;
    ^^^^^^^^^^
error: 328: unknown identifier '_643'
    finalColor.x = _643.x;
                   ^^^^
error: 329: unknown identifier 'finalColor'
    finalColor.y = _643.y;
    ^^^^^^^^^^
error: 329: unknown identifier '_643'
    finalColor.y = _643.y;
                   ^^^^
error: 330: unknown identifier 'finalColor'
    finalColor.z = _643.z;
    ^^^^^^^^^^
error: 330: unknown identifier '_643'
    finalColor.z = _643.z;
                   ^^^^
error: 331: unknown identifier 'finalColor'
    vec3 param_22 = finalColor.xyz;
                    ^^^^^^^^^^
error: 332: unknown identifier 'saturation'
    float param_23 = saturation;
                     ^^^^^^^^^^
error: 333: unknown identifier 'param_22'
    vec3 _655 = FLT_flutter_local_applySaturation(param_22, param_23);
                                                  ^^^^^^^^
error: 333: unknown identifier 'param_23'
    vec3 _655 = FLT_flutter_local_applySaturation(param_22, param_23);
                                                            ^^^^^^^^
error: 334: unknown identifier 'finalColor'
    finalColor.x = _655.x;
    ^^^^^^^^^^
error: 334: unknown identifier '_655'
    finalColor.x = _655.x;
                   ^^^^
error: 335: unknown identifier 'finalColor'
    finalColor.y = _655.y;
    ^^^^^^^^^^
error: 335: unknown identifier '_655'
    finalColor.y = _655.y;
                   ^^^^
error: 336: unknown identifier 'finalColor'
    finalColor.z = _655.z;
    ^^^^^^^^^^
error: 336: unknown identifier '_655'
    finalColor.z = _655.z;
                   ^^^^
error: 337: unknown identifier 'finalColor'
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
                          ^^^^^^^^^^
error: 337: unknown identifier 'foregroundAlpha'
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
                                           ^^^^^^^^^^^^^^^
error: 423: unknown identifier 'FLT_flutter_local_renderLiquidGlass'
    fragColor = FLT_flutter_local_renderLiquidGlass(param_32, param_33, param_34, param_35, param_36, param_37, param_38, param_39, param_40, param_41,...
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118 errors



Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_filter.frag": Compiled to invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

uniform vec2 uSize;
uniform vec4 uGlassColor;
uniform vec4 uOpticalProps;
uniform vec4 uLightConfig;
uniform vec2 uLightDirection;
uniform float uNumShapes;
uniform float uShapeData[96];
uniform shader uBlurredTexture;
uniform half2 uBlurredTexture_size;

vec4 fragColor;

float uChromaticAberration;
float uLightAngle;
float uLightIntensity;
float uAmbientStrength;
float uThickness;
float uRefractiveIndex;
float uBlend;
float uSaturation;

vec2 FLT_flutter_local_FlutterFragCoord()
{
    return flutter_FragCoord.xy;
}

float FLT_flutter_local_sdfSquircle(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    vec2 maxQ = max(q, vec2(0.0));
    return (min(max(q.x, q.y), 0.0) + sqrt((maxQ.x * maxQ.x) + (maxQ.y * maxQ.y))) - r;
}

float FLT_flutter_local_sdfEllipse(vec2 p, inout vec2 r)
{
    r = max(r, vec2(9.9999997473787516355514526367188e-05));
    vec2 invR = vec2(1.0) / r;
    vec2 invR2 = invR * invR;
    vec2 pInvR = p * invR;
    float k1 = length(pInvR);
    vec2 pInvR2 = p * invR2;
    float k2 = length(pInvR2);
    return (k1 * (k1 - 1.0)) / max(k2, 9.9999997473787516355514526367188e-05);
}

float FLT_flutter_local_sdfRRect(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    return (min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0)))) - r;
}

float FLT_flutter_local_getShapeSDF(float type, vec2 p, vec2 center, vec2 size, float r)
{
    if (type == 1.0)
    {
        vec2 param = p - center;
        vec2 param_1 = size / vec2(2.0);
        float param_2 = r;
        float _844 = FLT_flutter_local_sdfSquircle(param, param_1, param_2);
        return _844;
    }
    if (type == 2.0)
    {
        vec2 param_3 = p - center;
        vec2 param_4 = size / vec2(2.0);
        float _858 = FLT_flutter_local_sdfEllipse(param_3, param_4);
        return _858;
    }
    if (type == 3.0)
    {
        vec2 param_5 = p - center;
        vec2 param_6 = size / vec2(2.0);
        float param_7 = r;
        float _875 = FLT_flutter_local_sdfRRect(param_5, param_6, param_7);
        return _875;
    }
    return 1000000000.0;
}

float FLT_flutter_local_getShapeSDFFromArray(int index, vec2 p, float shapeData[96])
{
    int baseIndex = index * 6;
    float type = shapeData[baseIndex];
    vec2 center = vec2(shapeData[baseIndex + 1], shapeData[baseIndex + 2]);
    vec2 size = vec2(shapeData[baseIndex + 3], shapeData[baseIndex + 4]);
    float cornerRadius = shapeData[baseIndex + 5];
    float param = type;
    vec2 param_1 = p;
    vec2 param_2 = center;
    vec2 param_3 = size;
    float param_4 = cornerRadius;
    return FLT_flutter_local_getShapeSDF(param, param_1, param_2, param_3, param_4);
}

float FLT_flutter_local_smoothUnion(float d1, float d2, float k)
{
    if (k <= 0.0)
    {
        return min(d1, d2);
    }
    float e = max(k - abs(d1 - d2), 0.0);
    return min(d1, d2) - (((e * e) * 0.25) / k);
}

float FLT_flutter_local_sceneSDF(vec2 p, int numShapes, float shapeData[96], float blend)
{
    if (numShapes == 0)
    {
        return 1000000000.0;
    }
    int param = 0;
    vec2 param_1 = p;
    float param_2[96] = shapeData;
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
    if (numShapes <= 4)
    {
        if (numShapes >= 2)
        {
            int param_3 = 1;
            vec2 param_4 = p;
            float param_5[96] = shapeData;
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
            float param_6 = result;
            float param_7 = shapeSDF;
            float param_8 = blend;
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
        }
        if (numShapes >= 3)
        {
            int param_9 = 2;
            vec2 param_10 = p;
            float param_11[96] = shapeData;
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
            float param_12 = result;
            float param_13 = shapeSDF_1;
            float param_14 = blend;
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
        }
        if (numShapes >= 4)
        {
            int param_15 = 3;
            vec2 param_16 = p;
            float param_17[96] = shapeData;
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
            float param_18 = result;
            float param_19 = shapeSDF_2;
            float param_20 = blend;
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
        }
    }
    else
    {
        for (int i = 1; i < min(numShapes, 16); i++)
        {
            int param_21 = i;
            vec2 param_22 = p;
            float param_23[96] = shapeData;
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
            float param_24 = result;
            float param_25 = shapeSDF_3;
            float param_26 = blend;
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
        }
    }
    return result;
}

vec3 FLT_flutter_local_getNormal(float sd, float thickness)
{
    float dx = dFdx(sd);
    float dy = dFdy(sd);
    float n_cos = max(thickness + sd, 0.0) / thickness;
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
    return normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
}

float FLT_flutter_local_getHeight(float sd, float thickness)
{
    if ((sd >= 0.0) || (thickness <= 0.0))
    {
        return 0.0;
    }
    if (sd < (-thickness))
    {
        return thickness;
    }
    float x = thickness + sd;
    return sqrt(max(0.0, (thickness * thickness) - (x * x)));
}

vec4 FLT_flutter_local_calculateRefraction(vec2 screenUV, vec3 normal, float height, float thickness, float refractiveIndex, float chromaticAberration, vec2 uSize_1, shader backgroundTexture, float blurRadius, out vec2 refractionDisplacement)
{
    float baseHeight = thickness * 8.0;
    vec3 incident = vec3(0.0, 0.0, -1.0);
    float invRefractiveIndex = 1.0 / refractiveIndex;
    vec2 invUSize = vec2(1.0) / uSize_1;
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
    refractionDisplacement = baseDisplacement;
    if (chromaticAberration < 0.001000000047497451305389404296875)
    {
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
    }
    float dispersionStrength = chromaticAberration * 0.5;
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
    vec2 redUV = screenUV + (redOffset * invUSize);
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
    vec2 blueUV = screenUV + (blueOffset * invUSize);
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
    return vec4(red, greenSample.y, blue, greenSample.w);
}

vec3 FLT_flutter_local_getHighlightColor(vec3 backgroundColor, float targetBrightness)
{
    float luminance = dot(backgroundColor, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    float maxComponent = max(max(backgroundColor.x, backgroundColor.y), backgroundColor.z);
    float minComponent = min(min(backgroundColor.x, backgroundColor.y), backgroundColor.z);
    float _210;
    if (maxComponent > 0.0)
    {
        _210 = (maxComponent - minComponent) / maxComponent;
    }
    else
    {
        _210 = 0.0;
    }
    float saturation = _210;
    vec3 coloredHighlight = vec3(targetBrightness);
    if (luminance > 0.001000000047497451305389404296875)
    {
        vec3 normalizedBackground = backgroundColor / vec3(luminance);
        coloredHighlight = normalizedBackground * targetBrightness;
        float saturationBoost = 1.2999999523162841796875;
        vec3 gray = vec3(dot(coloredHighlight, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625)));
        coloredHighlight = mix(gray, coloredHighlight, vec3(saturationBoost));
        coloredHighlight = min(coloredHighlight, vec3(1.0));
    }
    float luminanceFactor = smoothstep(0.0, 0.60000002384185791015625, luminance);
    float saturationFactor = smoothstep(0.0, 0.4000000059604644775390625, saturation);
    float colorInfluence = luminanceFactor * saturationFactor;
    vec3 whiteHighlight = vec3(targetBrightness);
    return mix(whiteHighlight, coloredHighlight, vec3(colorInfluence));
}

vec3 FLT_flutter_local_calculateLighting(vec2 uv, vec3 normal, float sd, float thickness, float height, vec2 lightDirection, float lightIntensity, float ambientStrength, vec3 backgroundColor)
{
    float _307;
    if (thickness > 0.0)
    {
        _307 = height / thickness;
    }
    else
    {
        _307 = 0.0;
    }
    float normalizedHeight = _307;
    float shape = clamp((1.0 - normalizedHeight) * 1.11099994182586669921875, 0.0, 1.0);
    if (shape < 0.00999999977648258209228515625)
    {
        return vec3(0.0);
    }
    float thicknessFactor = clamp((thickness - 5.0) * 0.5, 0.0, 1.0);
    if (thicknessFactor < 0.00999999977648258209228515625)
    {
        return vec3(0.0);
    }
    float rimWidth = 1.5;
    float k = 0.88999998569488525390625;
    float x = sd / rimWidth;
    float rimFactor = 1.0 / (1.0 + ((k * x) * x));
    if ((rimFactor < 0.00999999977648258209228515625) || (lightIntensity < 0.00999999977648258209228515625))
    {
        return vec3(0.0);
    }
    vec2 normalXY = normal.xy;
    float mainLightInfluence = max(0.0, dot(normalXY, lightDirection));
    float oppositeLightInfluence = max(0.0, dot(normalXY, -lightDirection));
    float totalInfluence = mainLightInfluence + (oppositeLightInfluence * 0.800000011920928955078125);
    vec3 param = backgroundColor;
    float param_1 = 1.0;
    vec3 highlightColor = FLT_flutter_local_getHighlightColor(param, param_1);
    vec3 directionalRim = (((highlightColor * 0.699999988079071044921875) * (totalInfluence * totalInfluence)) * lightIntensity) * 2.0;
    vec3 ambientRim = (highlightColor * 0.4000000059604644775390625) * ambientStrength;
    vec3 totalRimLight = (directionalRim + ambientRim) * rimFactor;
    return (totalRimLight * thicknessFactor) * shape;
}

vec4 FLT_flutter_local_applyGlassColor(vec4 liquidColor, vec4 glassColor)
{
    vec4 finalColor = liquidColor;
    if (glassColor.w > 0.0)
    {
        float glassLuminance = dot(glassColor.xyz, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
        if (glassLuminance < 0.5)
        {
            vec3 darkened = liquidColor.xyz * (glassColor.xyz * 2.0);
            vec3 _565 = mix(liquidColor.xyz, darkened, vec3(glassColor.w));
            finalColor.x = _565.x;
            finalColor.y = _565.y;
            finalColor.z = _565.z;
        }
        else
        {
            vec3 invLiquid = vec3(1.0) - liquidColor.xyz;
            vec3 invGlass = vec3(1.0) - glassColor.xyz;
            vec3 screened = vec3(1.0) - (invLiquid * invGlass);
            vec3 _592 = mix(liquidColor.xyz, screened, vec3(glassColor.w));
            finalColor.x = _592.x;
            finalColor.y = _592.y;
            finalColor.z = _592.z;
        }
        finalColor.w = liquidColor.w;
    }
    return finalColor;
}

vec3 FLT_flutter_local_applySaturation(vec3 color, float saturation)
{
    float luminance = dot(color, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    vec3 saturatedColor = mix(vec3(luminance), color, vec3(saturation));
    return clamp(saturatedColor, vec3(0.0), vec3(1.0));
}

vec4 FLT_flutter_local_renderLiquidGlass(vec2 screenUV, vec2 p, vec2 uSize_1, float sd, float thickness, float refractiveIndex, float chromaticAberration, vec4 glassColor, vec2 lightDirection, float lightIntensity, float ambientStrength, shader backgroundTexture, vec3 normal, float foregroundAlpha, float gaussianBlur, float saturation)
{
    float param = sd;
    float param_1 = thickness;
    float height = FLT_flutter_local_getHeight(param, param_1);
    vec2 param_2 = screenUV;
    vec3 param_3 = normal;
    float param_4 = height;
    float param_5 = thickness;
    float param_6 = refractiveIndex;
    float param_7 = chromaticAberration;
    vec2 param_8 = uSize_1;
    float param_9 = gaussianBlur;
    vec2 param_10;
    vec4 _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
    vec2 refractionDisplacement = param_10;
    vec4 refractColor = _630;
    vec3 backgroundColor = refractColor.xyz;
    vec2 param_11 = screenUV;
    vec3 param_12 = normal;
    float param_13 = sd;
    float param_14 = thickness;
    float param_15 = height;
    vec2 param_16 = lightDirection;
    float param_17 = lightIntensity;
    float param_18 = ambientStrength;
    vec3 param_19 = backgroundColor;
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
    vec4 param_20 = refractColor;
    vec4 param_21 = glassColor;
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
    vec4 _662 = finalColor;
    vec3 _664 = _662.xyz + lighting;
    finalColor.x = _664.x;
    finalColor.y = _664.y;
    finalColor.z = _664.z;
    vec3 param_22 = finalColor.xyz;
    float param_23 = saturation;
    vec3 _676 = FLT_flutter_local_applySaturation(param_22, param_23);
    finalColor.x = _676.x;
    finalColor.y = _676.y;
    finalColor.z = _676.z;
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
}

void FLT_main()
{
    uChromaticAberration = uOpticalProps.y;
    uLightAngle = uLightConfig.x;
    uLightIntensity = uLightConfig.y;
    uAmbientStrength = uLightConfig.z;
    uThickness = uOpticalProps.z;
    uRefractiveIndex = uOpticalProps.x;
    uBlend = uOpticalProps.w;
    uSaturation = uLightConfig.w;
    vec2 fragCoord = FLT_flutter_local_FlutterFragCoord();
    vec2 screenUV_1 = vec2(fragCoord.x / uSize.x, fragCoord.y / uSize.y);
    vec2 param_24 = fragCoord;
    int param_25 = int(uNumShapes);
    float param_26[96] = uShapeData;
    float param_27 = uBlend;
    float sd_1 = FLT_flutter_local_sceneSDF(param_24, param_25, param_26, param_27);
    float foregroundAlpha_1 = 1.0 - smoothstep(-2.0, 0.0, sd_1);
    if (foregroundAlpha_1 < 0.00999999977648258209228515625)
    {
        fragColor = vec4(0.0);
        return;
    }
    float param_28 = sd_1;
    float param_29 = uThickness;
    vec3 normal_1 = FLT_flutter_local_getNormal(param_28, param_29);
    vec2 param_30 = screenUV_1;
    vec2 param_31 = fragCoord;
    vec2 param_32 = uSize;
    float param_33 = sd_1;
    float param_34 = uThickness;
    float param_35 = uRefractiveIndex;
    float param_36 = uChromaticAberration;
    vec4 param_37 = uGlassColor;
    vec2 param_38 = uLightDirection;
    float param_39 = uLightIntensity;
    float param_40 = uAmbientStrength;
    vec3 param_41 = normal_1;
    float param_42 = foregroundAlpha_1;
    float param_43 = 0.0;
    float param_44 = uSaturation;
    fragColor = FLT_flutter_local_renderLiquidGlass(param_30, param_31, param_32, param_33, param_34, param_35, param_36, param_37, param_38, param_39, param_40, uBlurredTexture, param_41, param_42, param_43, param_44);
}

half4 main(float2 iFragCoord)
{
      flutter_FragCoord = float4(iFragCoord, 0, 0);
      FLT_main();
      return fragColor;
}

SkSL Error:
error: 121: initializers are not permitted on arrays (or structs containing arrays)
    float param_2[96] = shapeData;
                        ^^^^^^^^^
error: 122: unknown identifier 'param_2'
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
                                                                          ^^^^^^^
error: 129: initializers are not permitted on arrays (or structs containing arrays)
            float param_5[96] = shapeData;
                                ^^^^^^^^^
error: 130: unknown identifier 'param_5'
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
                                                                                      ^^^^^^^
error: 131: unknown identifier 'result'
            float param_6 = result;
                            ^^^^^^
error: 132: unknown identifier 'shapeSDF'
            float param_7 = shapeSDF;
                            ^^^^^^^^
error: 134: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
            ^^^^^^
error: 134: unknown identifier 'param_6'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
                                                   ^^^^^^^
error: 134: unknown identifier 'param_7'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
                                                            ^^^^^^^
error: 140: initializers are not permitted on arrays (or structs containing arrays)
            float param_11[96] = shapeData;
                                 ^^^^^^^^^
error: 141: unknown identifier 'param_11'
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
                                                                                         ^^^^^^^^
error: 142: unknown identifier 'result'
            float param_12 = result;
                             ^^^^^^
error: 143: unknown identifier 'shapeSDF_1'
            float param_13 = shapeSDF_1;
                             ^^^^^^^^^^
error: 145: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
            ^^^^^^
error: 145: unknown identifier 'param_12'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
                                                   ^^^^^^^^
error: 145: unknown identifier 'param_13'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
                                                             ^^^^^^^^
error: 151: initializers are not permitted on arrays (or structs containing arrays)
            float param_17[96] = shapeData;
                                 ^^^^^^^^^
error: 152: unknown identifier 'param_17'
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
                                                                                          ^^^^^^^^
error: 153: unknown identifier 'result'
            float param_18 = result;
                             ^^^^^^
error: 154: unknown identifier 'shapeSDF_2'
            float param_19 = shapeSDF_2;
                             ^^^^^^^^^^
error: 156: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
            ^^^^^^
error: 156: unknown identifier 'param_18'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
                                                   ^^^^^^^^
error: 156: unknown identifier 'param_19'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
                                                             ^^^^^^^^
error: 161: no match for min(int, int)
        for (int i = 1; i < min(numShapes, 16); i++)
                            ^^^^^^^^^^^^^^^^^^
error: 165: initializers are not permitted on arrays (or structs containing arrays)
            float param_23[96] = shapeData;
                                 ^^^^^^^^^
error: 166: unknown identifier 'param_23'
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
                                                                                          ^^^^^^^^
error: 167: unknown identifier 'result'
            float param_24 = result;
                             ^^^^^^
error: 168: unknown identifier 'shapeSDF_3'
            float param_25 = shapeSDF_3;
                             ^^^^^^^^^^
error: 170: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
            ^^^^^^
error: 170: unknown identifier 'param_24'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
                                                   ^^^^^^^^
error: 170: unknown identifier 'param_25'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
                                                             ^^^^^^^^
error: 173: unknown identifier 'result'
    return result;
           ^^^^^^
error: 178: no match for dFdx(float)
    float dx = dFdx(sd);
               ^^^^^^^^
error: 179: no match for dFdy(float)
    float dy = dFdy(sd);
               ^^^^^^^^
error: 182: unknown identifier 'dx'
    return normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                          ^^
error: 182: unknown identifier 'dy'
    return normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                      ^^
error: 199: parameters of type 'shader' not allowed
...mal, float height, float thickness, float refractiveIndex, float chromaticAberration, vec2 uSize_1, shader backgroundTexture, float blurRadius, out vec2 refractionDisplacement)
                                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^
error: 201: unknown identifier 'thickness'
    float baseHeight = thickness * 8.0;
                       ^^^^^^^^^
error: 203: unknown identifier 'refractiveIndex'
    float invRefractiveIndex = 1.0 / refractiveIndex;
                                     ^^^^^^^^^^^^^^^
error: 204: unknown identifier 'uSize_1'
    vec2 invUSize = vec2(1.0) / uSize_1;
                                ^^^^^^^
error: 205: unknown identifier 'normal'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                         ^^^^^^
error: 205: unknown identifier 'invRefractiveIndex'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                                 ^^^^^^^^^^^^^^^^^^
error: 206: unknown identifier 'height'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                               ^^^^^^
error: 206: unknown identifier 'baseHeight'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                        ^^^^^^^^^^
error: 206: unknown identifier 'baseRefract'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                                                                          ^^^^^^^^^^^
error: 207: unknown identifier 'baseRefract'
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
                            ^^^^^^^^^^^
error: 207: unknown identifier 'baseRefractLength'
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
                                             ^^^^^^^^^^^^^^^^^
error: 208: unknown identifier 'refractionDisplacement'
    refractionDisplacement = baseDisplacement;
    ^^^^^^^^^^^^^^^^^^^^^^
error: 208: unknown identifier 'baseDisplacement'
    refractionDisplacement = baseDisplacement;
                             ^^^^^^^^^^^^^^^^
error: 209: unknown identifier 'chromaticAberration'
    if (chromaticAberration < 0.001000000047497451305389404296875)
        ^^^^^^^^^^^^^^^^^^^
error: 211: unknown identifier 'screenUV'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                           ^^^^^^^^
error: 211: unknown identifier 'baseDisplacement'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                                       ^^^^^^^^^^^^^^^^
error: 211: unknown identifier 'invUSize'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                                                          ^^^^^^^^
error: 212: unknown identifier 'backgroundTexture'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
               ^^^^^^^^^^^^^^^^^
error: 212: unknown identifier 'backgroundTexture_size'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
                                      ^^^^^^^^^^^^^^^^^^^^^^
error: 212: unknown identifier 'refractedUV'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
                                                                 ^^^^^^^^^^^
error: 214: unknown identifier 'chromaticAberration'
    float dispersionStrength = chromaticAberration * 0.5;
                               ^^^^^^^^^^^^^^^^^^^
error: 215: unknown identifier 'baseDisplacement'
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
                     ^^^^^^^^^^^^^^^^
error: 215: unknown identifier 'dispersionStrength'
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
                                               ^^^^^^^^^^^^^^^^^^
error: 216: unknown identifier 'baseDisplacement'
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
                      ^^^^^^^^^^^^^^^^
error: 216: unknown identifier 'dispersionStrength'
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
                                                ^^^^^^^^^^^^^^^^^^
error: 217: unknown identifier 'screenUV'
    vec2 redUV = screenUV + (redOffset * invUSize);
                 ^^^^^^^^
error: 217: unknown identifier 'redOffset'
    vec2 redUV = screenUV + (redOffset * invUSize);
                             ^^^^^^^^^
error: 217: unknown identifier 'invUSize'
    vec2 redUV = screenUV + (redOffset * invUSize);
                                         ^^^^^^^^
error: 218: unknown identifier 'screenUV'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                   ^^^^^^^^
error: 218: unknown identifier 'baseDisplacement'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                               ^^^^^^^^^^^^^^^^
error: 218: unknown identifier 'invUSize'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                                                  ^^^^^^^^
error: 219: unknown identifier 'screenUV'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                  ^^^^^^^^
error: 219: unknown identifier 'blueOffset'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                              ^^^^^^^^^^
error: 219: unknown identifier 'invUSize'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                                           ^^^^^^^^
error: 220: unknown identifier 'backgroundTexture'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                ^^^^^^^^^^^^^^^^^
error: 220: unknown identifier 'backgroundTexture_size'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                                       ^^^^^^^^^^^^^^^^^^^^^^
error: 220: unknown identifier 'redUV'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                                                                  ^^^^^
error: 221: unknown identifier 'backgroundTexture'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                       ^^^^^^^^^^^^^^^^^
error: 221: unknown identifier 'backgroundTexture_size'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                                              ^^^^^^^^^^^^^^^^^^^^^^
error: 221: unknown identifier 'greenUV'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                                                                         ^^^^^^^
error: 222: unknown identifier 'backgroundTexture'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                 ^^^^^^^^^^^^^^^^^
error: 222: unknown identifier 'backgroundTexture_size'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                                        ^^^^^^^^^^^^^^^^^^^^^^
error: 222: unknown identifier 'blueUV'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                                                                   ^^^^^^
error: 223: unknown identifier 'red'
    return vec4(red, greenSample.y, blue, greenSample.w);
                ^^^
error: 223: unknown identifier 'greenSample'
    return vec4(red, greenSample.y, blue, greenSample.w);
                     ^^^^^^^^^^^
error: 223: unknown identifier 'blue'
    return vec4(red, greenSample.y, blue, greenSample.w);
                                    ^^^^
error: 223: unknown identifier 'greenSample'
    return vec4(red, greenSample.y, blue, greenSample.w);
                                          ^^^^^^^^^^^
error: 337: parameters of type 'shader' not allowed
...maticAberration, vec4 glassColor, vec2 lightDirection, float lightIntensity, float ambientStrength, shader backgroundTexture, vec3 normal, float foregroundAlpha, float gaussianBlur, float saturation)
                                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^
error: 339: unknown identifier 'sd'
    float param = sd;
                  ^^
error: 340: unknown identifier 'thickness'
    float param_1 = thickness;
                    ^^^^^^^^^
error: 341: unknown identifier 'param'
    float height = FLT_flutter_local_getHeight(param, param_1);
                                               ^^^^^
error: 341: unknown identifier 'param_1'
    float height = FLT_flutter_local_getHeight(param, param_1);
                                                      ^^^^^^^
error: 342: unknown identifier 'screenUV'
    vec2 param_2 = screenUV;
                   ^^^^^^^^
error: 343: unknown identifier 'normal'
    vec3 param_3 = normal;
                   ^^^^^^
error: 344: unknown identifier 'height'
    float param_4 = height;
                    ^^^^^^
error: 345: unknown identifier 'thickness'
    float param_5 = thickness;
                    ^^^^^^^^^
error: 346: unknown identifier 'refractiveIndex'
    float param_6 = refractiveIndex;
                    ^^^^^^^^^^^^^^^
error: 347: unknown identifier 'chromaticAberration'
    float param_7 = chromaticAberration;
                    ^^^^^^^^^^^^^^^^^^^
error: 348: unknown identifier 'uSize_1'
    vec2 param_8 = uSize_1;
                   ^^^^^^^
error: 349: unknown identifier 'gaussianBlur'
    float param_9 = gaussianBlur;
                    ^^^^^^^^^^^^
error: 351: unknown identifier 'FLT_flutter_local_calculateRefraction'
    vec4 _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10...
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: 351: unknown identifier 'param_2'
    vec4 _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                      ^^^^^^^
error: 351: unknown identifier 'param_3'
    vec4 _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                               ^^^^^^^
error: 351: unknown identifier 'param_4'
    vec4 _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                        ^^^^^^^
error: 351: unknown identifier 'param_5'
    vec4 _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                 ^^^^^^^
error: 351: unknown identifier 'param_6'
    vec4 _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 351: unknown identifier 'param_7'
    vec4 _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 351: unknown identifier 'param_8'
... _630 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 351: unknown identifier 'backgroundTexture'
...LT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^^^^^^^^^^^
error: 351: unknown identifier 'param_9'
...lculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 353: unknown identifier '_630'
    vec4 refractColor = _630;
                        ^^^^
error: 354: unknown identifier 'refractColor'
    vec3 backgroundColor = refractColor.xyz;
                           ^^^^^^^^^^^^
error: 355: unknown identifier 'screenUV'
    vec2 param_11 = screenUV;
                    ^^^^^^^^
error: 356: unknown identifier 'normal'
    vec3 param_12 = normal;
                    ^^^^^^
error: 357: unknown identifier 'sd'
    float param_13 = sd;
                     ^^
error: 358: unknown identifier 'thickness'
    float param_14 = thickness;
                     ^^^^^^^^^
error: 359: unknown identifier 'height'
    float param_15 = height;
                     ^^^^^^
error: 360: unknown identifier 'lightDirection'
    vec2 param_16 = lightDirection;
                    ^^^^^^^^^^^^^^
error: 361: unknown identifier 'lightIntensity'
    float param_17 = lightIntensity;
                     ^^^^^^^^^^^^^^
error: 362: unknown identifier 'ambientStrength'
    float param_18 = ambientStrength;
                     ^^^^^^^^^^^^^^^
error: 363: unknown identifier 'backgroundColor'
    vec3 param_19 = backgroundColor;
                    ^^^^^^^^^^^^^^^
error: 364: unknown identifier 'param_11'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                        ^^^^^^^^
error: 364: unknown identifier 'param_12'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                  ^^^^^^^^
error: 364: unknown identifier 'param_13'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                            ^^^^^^^^
error: 364: unknown identifier 'param_14'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                      ^^^^^^^^
error: 364: unknown identifier 'param_15'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 364: unknown identifier 'param_16'
...c3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 364: unknown identifier 'param_17'
...g = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 364: unknown identifier 'param_18'
...utter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 364: unknown identifier 'param_19'
...l_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 365: unknown identifier 'refractColor'
    vec4 param_20 = refractColor;
                    ^^^^^^^^^^^^
error: 366: unknown identifier 'glassColor'
    vec4 param_21 = glassColor;
                    ^^^^^^^^^^
error: 367: unknown identifier 'param_20'
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
                                                        ^^^^^^^^
error: 367: unknown identifier 'param_21'
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
                                                                  ^^^^^^^^
error: 368: unknown identifier 'finalColor'
    vec4 _662 = finalColor;
                ^^^^^^^^^^
error: 369: unknown identifier '_662'
    vec3 _664 = _662.xyz + lighting;
                ^^^^
error: 369: unknown identifier 'lighting'
    vec3 _664 = _662.xyz + lighting;
                           ^^^^^^^^
error: 370: unknown identifier 'finalColor'
    finalColor.x = _664.x;
    ^^^^^^^^^^
error: 370: unknown identifier '_664'
    finalColor.x = _664.x;
                   ^^^^
error: 371: unknown identifier 'finalColor'
    finalColor.y = _664.y;
    ^^^^^^^^^^
error: 371: unknown identifier '_664'
    finalColor.y = _664.y;
                   ^^^^
error: 372: unknown identifier 'finalColor'
    finalColor.z = _664.z;
    ^^^^^^^^^^
error: 372: unknown identifier '_664'
    finalColor.z = _664.z;
                   ^^^^
error: 373: unknown identifier 'finalColor'
    vec3 param_22 = finalColor.xyz;
                    ^^^^^^^^^^
error: 374: unknown identifier 'saturation'
    float param_23 = saturation;
                     ^^^^^^^^^^
error: 375: unknown identifier 'param_22'
    vec3 _676 = FLT_flutter_local_applySaturation(param_22, param_23);
                                                  ^^^^^^^^
error: 375: unknown identifier 'param_23'
    vec3 _676 = FLT_flutter_local_applySaturation(param_22, param_23);
                                                            ^^^^^^^^
error: 376: unknown identifier 'finalColor'
    finalColor.x = _676.x;
    ^^^^^^^^^^
error: 376: unknown identifier '_676'
    finalColor.x = _676.x;
                   ^^^^
error: 377: unknown identifier 'finalColor'
    finalColor.y = _676.y;
    ^^^^^^^^^^
error: 377: unknown identifier '_676'
    finalColor.y = _676.y;
                   ^^^^
error: 378: unknown identifier 'finalColor'
    finalColor.z = _676.z;
    ^^^^^^^^^^
error: 378: unknown identifier '_676'
    finalColor.z = _676.z;
                   ^^^^
error: 379: unknown identifier 'finalColor'
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
                          ^^^^^^^^^^
error: 379: unknown identifier 'foregroundAlpha'
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
                                           ^^^^^^^^^^^^^^^
error: 396: initializers are not permitted on arrays (or structs containing arrays)
    float param_26[96] = uShapeData;
                         ^^^^^^^^^^
error: 398: unknown identifier 'param_26'
    float sd_1 = FLT_flutter_local_sceneSDF(param_24, param_25, param_26, param_27);
                                                                ^^^^^^^^
error: 399: unknown identifier 'sd_1'
    float foregroundAlpha_1 = 1.0 - smoothstep(-2.0, 0.0, sd_1);
                                                          ^^^^
error: 400: unknown identifier 'foregroundAlpha_1'
    if (foregroundAlpha_1 < 0.00999999977648258209228515625)
        ^^^^^^^^^^^^^^^^^
error: 405: unknown identifier 'sd_1'
    float param_28 = sd_1;
                     ^^^^
error: 407: unknown identifier 'param_28'
    vec3 normal_1 = FLT_flutter_local_getNormal(param_28, param_29);
                                                ^^^^^^^^
error: 411: unknown identifier 'sd_1'
    float param_33 = sd_1;
                     ^^^^
error: 419: unknown identifier 'normal_1'
    vec3 param_41 = normal_1;
                    ^^^^^^^^
error: 420: unknown identifier 'foregroundAlpha_1'
    float param_42 = foregroundAlpha_1;
                     ^^^^^^^^^^^^^^^^^
error: 423: unknown identifier 'FLT_flutter_local_renderLiquidGlass'
    fragColor = FLT_flutter_local_renderLiquidGlass(param_30, param_31, param_32, param_33, param_34, param_35, param_36, param_37, param_38, param_39,...
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: 423: unknown identifier 'param_33'
    fragColor = FLT_flutter_local_renderLiquidGlass(param_30, param_31, param_32, param_33, param_34, param_35, param_36, param_37, param_38, param_39, param_40, uBlurredTexture, param_41, p...
                                                                                  ^^^^^^^^
error: 423: unknown identifier 'param_41'
...2, param_33, param_34, param_35, param_36, param_37, param_38, param_39, param_40, uBlurredTexture, param_41, param_42, param_43, param_44);
                                                                                          ^^^^^^^^
error: 423: unknown identifier 'param_42'
...3, param_34, param_35, param_36, param_37, param_38, param_39, param_40, uBlurredTexture, param_41, param_42, param_43, param_44);
                                                                                          ^^^^^^^^
164 errors



Target debug_macos_bundle_flutter_assets failed: ShaderCompilerException: Shader compilation of "/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_geometry_blended.frag" to "/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/example/build/macos/Build/Products/Debug/App.framework/Versions/A/Resources/flutter_assets/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_geometry_blended.frag" failed with exit code 1.
impellerc stdout:

impellerc stderr:
Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_geometry_blended.frag": Compiled to invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

uniform vec2 uSize;
uniform vec4 uOpticalProps;
uniform float uNumShapes;
uniform float uShapeData[96];

vec4 fragColor;

float uThickness;
float uRefractiveIndex;
float uBlend;

vec2 FLT_flutter_local_FlutterFragCoord()
{
    return flutter_FragCoord.xy;
}

float FLT_flutter_local_sdfSquircle(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    vec2 maxQ = max(q, vec2(0.0));
    return (min(max(q.x, q.y), 0.0) + sqrt((maxQ.x * maxQ.x) + (maxQ.y * maxQ.y))) - r;
}

float FLT_flutter_local_sdfEllipse(vec2 p, inout vec2 r)
{
    r = max(r, vec2(9.9999997473787516355514526367188e-05));
    vec2 invR = vec2(1.0) / r;
    vec2 invR2 = invR * invR;
    vec2 pInvR = p * invR;
    float k1 = length(pInvR);
    vec2 pInvR2 = p * invR2;
    float k2 = length(pInvR2);
    return (k1 * (k1 - 1.0)) / max(k2, 9.9999997473787516355514526367188e-05);
}

float FLT_flutter_local_sdfRRect(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    return (min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0)))) - r;
}

float FLT_flutter_local_getShapeSDF(float type, vec2 p, vec2 center, vec2 size, float r)
{
    if (type == 1.0)
    {
        vec2 param = p - center;
        vec2 param_1 = size / vec2(2.0);
        float param_2 = r;
        float _256 = FLT_flutter_local_sdfSquircle(param, param_1, param_2);
        return _256;
    }
    if (type == 2.0)
    {
        vec2 param_3 = p - center;
        vec2 param_4 = size / vec2(2.0);
        float _270 = FLT_flutter_local_sdfEllipse(param_3, param_4);
        return _270;
    }
    if (type == 3.0)
    {
        vec2 param_5 = p - center;
        vec2 param_6 = size / vec2(2.0);
        float param_7 = r;
        float _287 = FLT_flutter_local_sdfRRect(param_5, param_6, param_7);
        return _287;
    }
    return 1000000000.0;
}

float FLT_flutter_local_getShapeSDFFromArray(int index, vec2 p, float shapeData[96])
{
    int baseIndex = index * 6;
    float type = shapeData[baseIndex];
    vec2 center = vec2(shapeData[baseIndex + 1], shapeData[baseIndex + 2]);
    vec2 size = vec2(shapeData[baseIndex + 3], shapeData[baseIndex + 4]);
    float cornerRadius = shapeData[baseIndex + 5];
    float param = type;
    vec2 param_1 = p;
    vec2 param_2 = center;
    vec2 param_3 = size;
    float param_4 = cornerRadius;
    return FLT_flutter_local_getShapeSDF(param, param_1, param_2, param_3, param_4);
}

float FLT_flutter_local_smoothUnion(float d1, float d2, float k)
{
    if (k <= 0.0)
    {
        return min(d1, d2);
    }
    float e = max(k - abs(d1 - d2), 0.0);
    return min(d1, d2) - (((e * e) * 0.25) / k);
}

float FLT_flutter_local_sceneSDF(vec2 p, int numShapes, float shapeData[96], float blend)
{
    if (numShapes == 0)
    {
        return 1000000000.0;
    }
    int param = 0;
    vec2 param_1 = p;
    float param_2[96] = shapeData;
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
    if (numShapes <= 4)
    {
        if (numShapes >= 2)
        {
            int param_3 = 1;
            vec2 param_4 = p;
            float param_5[96] = shapeData;
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
            float param_6 = result;
            float param_7 = shapeSDF;
            float param_8 = blend;
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
        }
        if (numShapes >= 3)
        {
            int param_9 = 2;
            vec2 param_10 = p;
            float param_11[96] = shapeData;
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
            float param_12 = result;
            float param_13 = shapeSDF_1;
            float param_14 = blend;
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
        }
        if (numShapes >= 4)
        {
            int param_15 = 3;
            vec2 param_16 = p;
            float param_17[96] = shapeData;
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
            float param_18 = result;
            float param_19 = shapeSDF_2;
            float param_20 = blend;
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
        }
    }
    else
    {
        for (int i = 1; i < min(numShapes, 16); i++)
        {
            int param_21 = i;
            vec2 param_22 = p;
            float param_23[96] = shapeData;
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
            float param_24 = result;
            float param_25 = shapeSDF_3;
            float param_26 = blend;
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
        }
    }
    return result;
}

vec4 FLT_flutter_local_encodeDisplacementData(vec2 displacement, float maxDisplacement, float height, float thickness, float alpha)
{
    vec2 normalizedDisp = ((displacement / vec2(maxDisplacement)) * 0.5) + vec2(0.5);
    normalizedDisp = clamp(normalizedDisp, vec2(0.0), vec2(1.0));
    float _462;
    if (thickness > 0.0)
    {
        _462 = clamp(height / thickness, 0.0, 1.0);
    }
    else
    {
        _462 = 0.0;
    }
    float normalizedHeight = _462;
    return vec4(normalizedDisp.x, normalizedDisp.y, normalizedHeight, alpha);
}

void FLT_main()
{
    uThickness = uOpticalProps.z;
    uRefractiveIndex = uOpticalProps.x;
    uBlend = uOpticalProps.w;
    vec2 fragCoord = FLT_flutter_local_FlutterFragCoord();
    vec2 screenUV = vec2(fragCoord.x / uSize.x, fragCoord.y / uSize.y);
    vec2 param = fragCoord;
    int param_1 = int(uNumShapes);
    float param_2[96] = uShapeData;
    float param_3 = uBlend;
    float sd = FLT_flutter_local_sceneSDF(param, param_1, param_2, param_3);
    float foregroundAlpha = 1.0 - smoothstep(-2.0, 0.0, sd);
    if (foregroundAlpha < 0.00999999977648258209228515625)
    {
        fragColor = vec4(0.0);
        return;
    }
    float dx = dFdx(sd);
    float dy = dFdy(sd);
    float n_cos = max(uThickness + sd, 0.0) / uThickness;
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
    if ((sd >= 0.0) || (uThickness <= 0.0))
    {
        fragColor = vec4(0.0);
        return;
    }
    float x = uThickness + sd;
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
    float baseHeight = uThickness * 8.0;
    vec3 incident = vec3(0.0, 0.0, -1.0);
    float invRefractiveIndex = 1.0 / uRefractiveIndex;
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
    float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
    float maxDisplacement_1 = uThickness * 10.0;
    vec2 param_4 = displacement_1;
    float param_5 = maxDisplacement_1;
    float param_6 = height_1;
    float param_7 = uThickness;
    float param_8 = foregroundAlpha;
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
}

half4 main(float2 iFragCoord)
{
      flutter_FragCoord = float4(iFragCoord, 0, 0);
      FLT_main();
      return fragColor;
}

SkSL Error:
error: 111: initializers are not permitted on arrays (or structs containing arrays)
    float param_2[96] = shapeData;
                        ^^^^^^^^^
error: 112: unknown identifier 'param_2'
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
                                                                          ^^^^^^^
error: 119: initializers are not permitted on arrays (or structs containing arrays)
            float param_5[96] = shapeData;
                                ^^^^^^^^^
error: 120: unknown identifier 'param_5'
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
                                                                                      ^^^^^^^
error: 121: unknown identifier 'result'
            float param_6 = result;
                            ^^^^^^
error: 122: unknown identifier 'shapeSDF'
            float param_7 = shapeSDF;
                            ^^^^^^^^
error: 124: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
            ^^^^^^
error: 124: unknown identifier 'param_6'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
                                                   ^^^^^^^
error: 124: unknown identifier 'param_7'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
                                                            ^^^^^^^
error: 130: initializers are not permitted on arrays (or structs containing arrays)
            float param_11[96] = shapeData;
                                 ^^^^^^^^^
error: 131: unknown identifier 'param_11'
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
                                                                                         ^^^^^^^^
error: 132: unknown identifier 'result'
            float param_12 = result;
                             ^^^^^^
error: 133: unknown identifier 'shapeSDF_1'
            float param_13 = shapeSDF_1;
                             ^^^^^^^^^^
error: 135: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
            ^^^^^^
error: 135: unknown identifier 'param_12'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
                                                   ^^^^^^^^
error: 135: unknown identifier 'param_13'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
                                                             ^^^^^^^^
error: 141: initializers are not permitted on arrays (or structs containing arrays)
            float param_17[96] = shapeData;
                                 ^^^^^^^^^
error: 142: unknown identifier 'param_17'
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
                                                                                          ^^^^^^^^
error: 143: unknown identifier 'result'
            float param_18 = result;
                             ^^^^^^
error: 144: unknown identifier 'shapeSDF_2'
            float param_19 = shapeSDF_2;
                             ^^^^^^^^^^
error: 146: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
            ^^^^^^
error: 146: unknown identifier 'param_18'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
                                                   ^^^^^^^^
error: 146: unknown identifier 'param_19'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
                                                             ^^^^^^^^
error: 151: no match for min(int, int)
        for (int i = 1; i < min(numShapes, 16); i++)
                            ^^^^^^^^^^^^^^^^^^
error: 155: initializers are not permitted on arrays (or structs containing arrays)
            float param_23[96] = shapeData;
                                 ^^^^^^^^^
error: 156: unknown identifier 'param_23'
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
                                                                                          ^^^^^^^^
error: 157: unknown identifier 'result'
            float param_24 = result;
                             ^^^^^^
error: 158: unknown identifier 'shapeSDF_3'
            float param_25 = shapeSDF_3;
                             ^^^^^^^^^^
error: 160: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
            ^^^^^^
error: 160: unknown identifier 'param_24'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
                                                   ^^^^^^^^
error: 160: unknown identifier 'param_25'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
                                                             ^^^^^^^^
error: 163: unknown identifier 'result'
    return result;
           ^^^^^^
error: 192: initializers are not permitted on arrays (or structs containing arrays)
    float param_2[96] = uShapeData;
                        ^^^^^^^^^^
error: 194: unknown identifier 'param_2'
    float sd = FLT_flutter_local_sceneSDF(param, param_1, param_2, param_3);
                                                          ^^^^^^^
error: 195: unknown identifier 'sd'
    float foregroundAlpha = 1.0 - smoothstep(-2.0, 0.0, sd);
                                                        ^^
error: 196: unknown identifier 'foregroundAlpha'
    if (foregroundAlpha < 0.00999999977648258209228515625)
        ^^^^^^^^^^^^^^^
error: 201: unknown identifier 'sd'
    float dx = dFdx(sd);
                    ^^
error: 202: unknown identifier 'sd'
    float dy = dFdy(sd);
                    ^^
error: 203: unknown identifier 'sd'
    float n_cos = max(uThickness + sd, 0.0) / uThickness;
                                   ^^
error: 204: unknown identifier 'n_cos'
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
                                       ^^^^^
error: 204: unknown identifier 'n_cos'
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
                                               ^^^^^
error: 205: unknown identifier 'dx'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                 ^^
error: 205: unknown identifier 'n_cos'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                      ^^^^^
error: 205: unknown identifier 'dy'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                             ^^
error: 205: unknown identifier 'n_cos'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                                  ^^^^^
error: 205: unknown identifier 'n_sin'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                                         ^^^^^
error: 206: unknown identifier 'sd'
    if ((sd >= 0.0) || (uThickness <= 0.0))
         ^^
error: 211: unknown identifier 'sd'
    float x = uThickness + sd;
                           ^^
error: 212: unknown identifier 'x'
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
                                                                ^
error: 212: unknown identifier 'x'
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
                                                                    ^
error: 213: unknown identifier 'sqrtTerm'
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
                         ^^^^^^^^
error: 213: unknown identifier 'sd'
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
                                                     ^^
error: 217: unknown identifier 'normal'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                         ^^^^^^
error: 218: unknown identifier 'height_1'
    float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                               ^^^^^^^^
error: 218: unknown identifier 'baseRefract'
...   float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                                                                          ^^^^^^^^^^^
error: 219: unknown identifier 'baseRefract'
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
                          ^^^^^^^^^^^
error: 219: unknown identifier 'baseRefractLength'
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
                                           ^^^^^^^^^^^^^^^^^
error: 221: unknown identifier 'displacement_1'
    vec2 param_4 = displacement_1;
                   ^^^^^^^^^^^^^^
error: 223: unknown identifier 'height_1'
    float param_6 = height_1;
                    ^^^^^^^^
error: 225: unknown identifier 'foregroundAlpha'
    float param_8 = foregroundAlpha;
                    ^^^^^^^^^^^^^^^
error: 226: unknown identifier 'param_4'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                         ^^^^^^^
error: 226: unknown identifier 'param_6'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                                           ^^^^^^^
error: 226: unknown identifier 'param_8'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                                                          ^^^^^^^
63 errors
Failed to package /Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/example.
** BUILD FAILED **

Building macOS application...
Error: Build process failed

After:

❯ flutter run --local-engine-host host_debug_unopt_arm64 --local-engine host_debug_unopt_arm64 -d mac
Launching lib/main.dart on macOS in debug mode...
Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_geometry_blended.frag":
Compiled to invalid SkSL:
        // This SkSL shader is autogenerated by spirv-cross.

        float4 flutter_FragCoord;

        uniform vec2 uSize;
        uniform vec4 uOpticalProps;
... (truncated 229 lines)
SkSL Error:
        error: 111: initializers are not permitted on arrays (or structs containing arrays)
            float param_2[96] = shapeData;
                                ^^^^^^^^^
        error: 112: unknown identifier 'param_2'
            float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
                                                                                  ^^^^^^^
... (truncated 185 lines)
Full "liquid_glass_geometry_blended" error output written to "/tmp/flutter_7pEcZo7A/impellerc_verbose_error.txt"

Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_arbitrary.frag":
Compiled to invalid SkSL:
        // This SkSL shader is autogenerated by spirv-cross.

        float4 flutter_FragCoord;

        uniform vec2 uSize;
        uniform vec2 uForegroundSize;
... (truncated 426 lines)
SkSL Error:
        error: 58: loop index initializer must be a constant expression
                for (int x = _703; x <= sampleRadius; x++)
                     ^^^^^^^^^^^^
        error: 55: loop index initializer must be a constant expression
            for (int y = _692; y <= sampleRadius; y++)
                 ^^^^^^^^^^^^
... (truncated 350 lines)
Full "liquid_glass_arbitrary" error output written to "/tmp/flutter_owu4XYOa/impellerc_verbose_error.txt"

Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_filter.frag":
Compiled to invalid SkSL:
        // This SkSL shader is autogenerated by spirv-cross.

        float4 flutter_FragCoord;

        uniform vec2 uSize;
        uniform vec4 uGlassColor;
... (truncated 426 lines)
SkSL Error:
        error: 121: initializers are not permitted on arrays (or structs containing arrays)
            float param_2[96] = shapeData;
                                ^^^^^^^^^
        error: 122: unknown identifier 'param_2'
            float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
                                                                                  ^^^^^^^
... (truncated 488 lines)
Full "liquid_glass_filter" error output written to "/tmp/flutter_GRql9a0v/impellerc_verbose_error.txt"

Target debug_macos_bundle_flutter_assets failed: ShaderCompilerException: Shader compilation of "/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_geometry_blended.frag" to "/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/example/build/macos/Build/Products/Debug/App.framework/Versions/A/Resources/flutter_assets/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_geometry_blended.frag" failed with exit code 1.
Failed to package /Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/example.
** BUILD FAILED **

Building macOS application...
Error: Build process failed

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions bot added tool Affects the "flutter" command-line tool. See also t: labels. engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Feb 23, 2026
@b-luk b-luk force-pushed the impellerctruncate branch from 9ab59b0 to a3c94db Compare February 23, 2026 21:02
@github-actions github-actions bot added team-android Owned by Android platform team team-ios Owned by iOS platform team labels Feb 23, 2026
@b-luk b-luk marked this pull request as ready for review February 25, 2026 00:31
@b-luk b-luk requested review from a team as code owners February 25, 2026 00:31
@b-luk b-luk requested a review from gaaclarke February 25, 2026 00:34
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the developer experience by truncating long shader compilation error messages from impellerc and outputting the full error to a separate file. This helps to reduce console clutter while still providing access to the complete error details when needed. The changes are well-implemented across the C++ compiler, the Dart build tools, and their respective tests. I've included one suggestion to refactor a piece of duplicated code in the C++ implementation.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good. Here's an overview of the high level feedback:

  1. remove unnecessary std::shared_ptr
  2. use absl::Status
  3. unify error storing, we need either verbose or truncated output, not both
  4. switch to writing the verbose log into the temp directory
  5. make the flag that forces the write to stderr

int line_index = 0;
while (std::getline(text_stream, line)) {
output << "\n " << line;
if (++line_index == kVerboseErrorLineThreshold) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a way to disable truncating with flags so that on CI we never truncate. Maybe there is an existing verbose flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a --verbose flag to impellerc to make it output untruncated to stderr. This isn't used by CI yet though. I think I'll need to pipe it through shader_compiler.dart and the build system to make CI set it. I'll follow up with this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #182970

@github-actions github-actions bot removed team-android Owned by Android platform team team-ios Owned by iOS platform team labels Feb 26, 2026
@b-luk b-luk requested a review from gaaclarke February 26, 2026 21:47
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up. I think this is good. I just have a few notes.

const std::shared_ptr<Compiler>& CompilerTestBase::GetCompiler() const {
return compiler_;
const Compiler& CompilerTestBase::GetCompiler() const {
EXPECT_NE(compiler_, nullptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EXPECT_NE(compiler_, nullptr)
ASSERT_NE(compiler_, nullptr)

You want the test to abort if this isn't true, not crash the test runner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ASSERT_NE won't compile because there's no return value for the function.

I changed this to return a pointer instead of a const reference, and I updatedthe test where it's used to ASSERT the return value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

int line_index = 0;
while (std::getline(text_stream, line)) {
output << "\n " << line;
if (++line_index == kVerboseErrorLineThreshold) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file an issue.

@b-luk b-luk added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 27, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Feb 27, 2026
Merged via the queue into flutter:master with commit ebfe8ce Feb 27, 2026
184 of 185 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 27, 2026
@b-luk b-luk deleted the impellerctruncate branch February 27, 2026 22:33
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 28, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 28, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 1, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 1, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 2, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Mar 2, 2026
Roll Flutter from 1141b2bdce66 to 46fb7210422d (38 revisions)

flutter/flutter@1141b2b...46fb721

2026-03-02 [email protected] [rules] Fix a few issues in the full-length rules file (flutter/flutter#182725)
2026-03-02 [email protected] Roll Dart SDK from 8063f5f5ac60 to e86dbe9aa742 (1 revision) (flutter/flutter#183120)
2026-03-02 [email protected] [web] Roll Chrome to 145 (flutter/flutter#182860)
2026-03-02 [email protected] Roll Skia from 61c0e71760f5 to e180358b7a7a (1 revision) (flutter/flutter#183118)
2026-03-02 [email protected] Roll Packages from a27d7c5 to faa4e22 (4 revisions) (flutter/flutter#183117)
2026-03-02 [email protected] Add information to issue triage page (flutter/flutter#182145)
2026-03-02 [email protected] Roll Skia from cc8ce92481f2 to 61c0e71760f5 (2 revisions) (flutter/flutter#183103)
2026-03-02 [email protected] Roll Skia from 4cf3cd27b620 to cc8ce92481f2 (1 revision) (flutter/flutter#183100)
2026-03-02 [email protected] Roll Fuchsia Linux SDK from zN2ZV9QD0LD8acUFF... to 0dCDM2oORHwDf_pyb... (flutter/flutter#183101)
2026-03-01 [email protected] Update fl_texture_gl.h (flutter/flutter#182999)
2026-03-01 [email protected] Roll Skia from be1362b5ca4e to 4cf3cd27b620 (1 revision) (flutter/flutter#183096)
2026-03-01 [email protected] Roll Skia from b9210eb7005f to be1362b5ca4e (1 revision) (flutter/flutter#183092)
2026-03-01 [email protected] Timeout when waiting for the correct sized frame from Flutter. (flutter/flutter#182971)
2026-03-01 [email protected] Roll Skia from 28172a4e03af to b9210eb7005f (1 revision) (flutter/flutter#183088)
2026-03-01 [email protected] Roll Fuchsia Linux SDK from D7IYacJUCpvc_1iU_... to zN2ZV9QD0LD8acUFF... (flutter/flutter#183076)
2026-02-28 [email protected] Roll Dart SDK from cdf45eaf995e to 8063f5f5ac60 (1 revision) (flutter/flutter#183064)
2026-02-28 [email protected] Roll Dart SDK from 54451fcdbcf9 to cdf45eaf995e (1 revision) (flutter/flutter#183057)
2026-02-28 [email protected] Roll Skia from c8bcc27f5319 to 28172a4e03af (3 revisions) (flutter/flutter#183056)
2026-02-28 [email protected] Roll Dart SDK from 148d91b8a603 to 54451fcdbcf9 (2 revisions) (flutter/flutter#183051)
2026-02-28 [email protected] [A11y] in calendar date picker, remove SemanticsService.sendAnnouncement usage for android.  (flutter/flutter#182918)
2026-02-28 [email protected] Add desktop review teams (flutter/flutter#182972)
2026-02-28 [email protected] [framework] Fix Text.semanticsIdentifier being absorbed by ancestor nodes (flutter/flutter#181795)
2026-02-28 [email protected] Roll Skia from b150186d3e23 to c8bcc27f5319 (5 revisions) (flutter/flutter#183032)
2026-02-28 [email protected] [Impeller] For Android hardware buffers on Vulkan, use an alpha value of 1 if the buffer format always has opaque alpha (flutter/flutter#182974)
2026-02-27 [email protected] Adds float32 output to `Image.toByteData()` in float32 Image (flutter/flutter#182847)
2026-02-27 [email protected] Roll Dart SDK from 1cdb7dfd913e to 148d91b8a603 (1 revision) (flutter/flutter#183025)
2026-02-27 [email protected] Roll Fuchsia Linux SDK from G1GwOdVt5bM7GjMSY... to D7IYacJUCpvc_1iU_... (flutter/flutter#183021)
2026-02-27 [email protected] When impellerc fails with a long shader compilation error, truncate it and output to a file (flutter/flutter#182786)
2026-02-27 [email protected] Add missing mutation-safe delegate iteration and use idomatic syntax (flutter/flutter#183018)
2026-02-27 [email protected] Exclude arm64 if any dependencies do and print warning when using Xcode 26 (flutter/flutter#182913)
2026-02-27 [email protected] Ignore unawaited_futures lint in dev/automated_tests (flutter/flutter#182922)
2026-02-27 [email protected] licenses_cpp: pre-land changes for perfetto update (flutter/flutter#182965)
2026-02-27 [email protected] Re-add extended attribute removed by SwiftPM (flutter/flutter#183011)
2026-02-27 [email protected] Fixes future warning for `await`ing `Future` returns in `async` bodies inside `try` blocks (flutter/flutter#182301)
2026-02-27 [email protected] Roll Skia from ed220c490eea to b150186d3e23 (2 revisions) (flutter/flutter#183014)
2026-02-27 [email protected] Fix issue where web embedder is synthesizing key up events too eagerly (flutter/flutter#180692)
2026-02-27 [email protected] chore: Don't unconditionally check tools/gn formatting (flutter/flutter#182973)
2026-02-27 [email protected] Roll Packages from e1d0169 to a27d7c5 (8 revisions) (flutter/flutter#183009)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose
...
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
…t and output to a file (flutter#182786)

This was suggested in
https://github.com/flutter/flutter/issues/182400#issuecomment-3916413468.
Fixes https://github.com/flutter/flutter/issues/182497

impellerc's SkSL validation produces a very long error message
consisting of the full SkSL result as well as a potentially long list of
errors.

When these are more than a few lines, output a truncated version to the
stderr output. If the output was truncated, write the full message to a
file in the temporary directory.

Adds a new --verbose flag to impellerc. If this flag is provided, the
output is never truncated.

Update shader_compiler.dart to remove the "impellerc stdout" and
"impellerc stderr" output from shader_compiler.dart. The output of
impellerc is already shown when it is run with
`_processManager.start()`. So printing the output again as part of the
`ShaderCompilerException` message is redundant and adds a lot of
clutter.

<details> <summary>

#### Before (this is very long):
</summary>

```
❯ flutter run --local-engine-host host_debug_unopt_arm64 --local-engine host_debug_unopt_arm64 -d mac
Launching lib/main.dart on macOS in debug mode...
Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_geometry_blended.frag": Compiled to invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

uniform vec2 uSize;
uniform vec4 uOpticalProps;
uniform float uNumShapes;
uniform float uShapeData[96];

vec4 fragColor;

float uThickness;
float uRefractiveIndex;
float uBlend;

vec2 FLT_flutter_local_FlutterFragCoord()
{
    return flutter_FragCoord.xy;
}

float FLT_flutter_local_sdfSquircle(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    vec2 maxQ = max(q, vec2(0.0));
    return (min(max(q.x, q.y), 0.0) + sqrt((maxQ.x * maxQ.x) + (maxQ.y * maxQ.y))) - r;
}

float FLT_flutter_local_sdfEllipse(vec2 p, inout vec2 r)
{
    r = max(r, vec2(9.9999997473787516355514526367188e-05));
    vec2 invR = vec2(1.0) / r;
    vec2 invR2 = invR * invR;
    vec2 pInvR = p * invR;
    float k1 = length(pInvR);
    vec2 pInvR2 = p * invR2;
    float k2 = length(pInvR2);
    return (k1 * (k1 - 1.0)) / max(k2, 9.9999997473787516355514526367188e-05);
}

float FLT_flutter_local_sdfRRect(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    return (min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0)))) - r;
}

float FLT_flutter_local_getShapeSDF(float type, vec2 p, vec2 center, vec2 size, float r)
{
    if (type == 1.0)
    {
        vec2 param = p - center;
        vec2 param_1 = size / vec2(2.0);
        float param_2 = r;
        float _256 = FLT_flutter_local_sdfSquircle(param, param_1, param_2);
        return _256;
    }
    if (type == 2.0)
    {
        vec2 param_3 = p - center;
        vec2 param_4 = size / vec2(2.0);
        float _270 = FLT_flutter_local_sdfEllipse(param_3, param_4);
        return _270;
    }
    if (type == 3.0)
    {
        vec2 param_5 = p - center;
        vec2 param_6 = size / vec2(2.0);
        float param_7 = r;
        float _287 = FLT_flutter_local_sdfRRect(param_5, param_6, param_7);
        return _287;
    }
    return 1000000000.0;
}

float FLT_flutter_local_getShapeSDFFromArray(int index, vec2 p, float shapeData[96])
{
    int baseIndex = index * 6;
    float type = shapeData[baseIndex];
    vec2 center = vec2(shapeData[baseIndex + 1], shapeData[baseIndex + 2]);
    vec2 size = vec2(shapeData[baseIndex + 3], shapeData[baseIndex + 4]);
    float cornerRadius = shapeData[baseIndex + 5];
    float param = type;
    vec2 param_1 = p;
    vec2 param_2 = center;
    vec2 param_3 = size;
    float param_4 = cornerRadius;
    return FLT_flutter_local_getShapeSDF(param, param_1, param_2, param_3, param_4);
}

float FLT_flutter_local_smoothUnion(float d1, float d2, float k)
{
    if (k <= 0.0)
    {
        return min(d1, d2);
    }
    float e = max(k - abs(d1 - d2), 0.0);
    return min(d1, d2) - (((e * e) * 0.25) / k);
}

float FLT_flutter_local_sceneSDF(vec2 p, int numShapes, float shapeData[96], float blend)
{
    if (numShapes == 0)
    {
        return 1000000000.0;
    }
    int param = 0;
    vec2 param_1 = p;
    float param_2[96] = shapeData;
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
    if (numShapes <= 4)
    {
        if (numShapes >= 2)
        {
            int param_3 = 1;
            vec2 param_4 = p;
            float param_5[96] = shapeData;
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
            float param_6 = result;
            float param_7 = shapeSDF;
            float param_8 = blend;
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
        }
        if (numShapes >= 3)
        {
            int param_9 = 2;
            vec2 param_10 = p;
            float param_11[96] = shapeData;
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
            float param_12 = result;
            float param_13 = shapeSDF_1;
            float param_14 = blend;
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
        }
        if (numShapes >= 4)
        {
            int param_15 = 3;
            vec2 param_16 = p;
            float param_17[96] = shapeData;
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
            float param_18 = result;
            float param_19 = shapeSDF_2;
            float param_20 = blend;
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
        }
    }
    else
    {
        for (int i = 1; i < min(numShapes, 16); i++)
        {
            int param_21 = i;
            vec2 param_22 = p;
            float param_23[96] = shapeData;
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
            float param_24 = result;
            float param_25 = shapeSDF_3;
            float param_26 = blend;
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
        }
    }
    return result;
}

vec4 FLT_flutter_local_encodeDisplacementData(vec2 displacement, float maxDisplacement, float height, float thickness, float alpha)
{
    vec2 normalizedDisp = ((displacement / vec2(maxDisplacement)) * 0.5) + vec2(0.5);
    normalizedDisp = clamp(normalizedDisp, vec2(0.0), vec2(1.0));
    float _462;
    if (thickness > 0.0)
    {
        _462 = clamp(height / thickness, 0.0, 1.0);
    }
    else
    {
        _462 = 0.0;
    }
    float normalizedHeight = _462;
    return vec4(normalizedDisp.x, normalizedDisp.y, normalizedHeight, alpha);
}

void FLT_main()
{
    uThickness = uOpticalProps.z;
    uRefractiveIndex = uOpticalProps.x;
    uBlend = uOpticalProps.w;
    vec2 fragCoord = FLT_flutter_local_FlutterFragCoord();
    vec2 screenUV = vec2(fragCoord.x / uSize.x, fragCoord.y / uSize.y);
    vec2 param = fragCoord;
    int param_1 = int(uNumShapes);
    float param_2[96] = uShapeData;
    float param_3 = uBlend;
    float sd = FLT_flutter_local_sceneSDF(param, param_1, param_2, param_3);
    float foregroundAlpha = 1.0 - smoothstep(-2.0, 0.0, sd);
    if (foregroundAlpha < 0.00999999977648258209228515625)
    {
        fragColor = vec4(0.0);
        return;
    }
    float dx = dFdx(sd);
    float dy = dFdy(sd);
    float n_cos = max(uThickness + sd, 0.0) / uThickness;
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
    if ((sd >= 0.0) || (uThickness <= 0.0))
    {
        fragColor = vec4(0.0);
        return;
    }
    float x = uThickness + sd;
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
    float baseHeight = uThickness * 8.0;
    vec3 incident = vec3(0.0, 0.0, -1.0);
    float invRefractiveIndex = 1.0 / uRefractiveIndex;
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
    float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
    float maxDisplacement_1 = uThickness * 10.0;
    vec2 param_4 = displacement_1;
    float param_5 = maxDisplacement_1;
    float param_6 = height_1;
    float param_7 = uThickness;
    float param_8 = foregroundAlpha;
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
}

half4 main(float2 iFragCoord)
{
      flutter_FragCoord = float4(iFragCoord, 0, 0);
      FLT_main();
      return fragColor;
}

SkSL Error:
error: 111: initializers are not permitted on arrays (or structs containing arrays)
    float param_2[96] = shapeData;
                        ^^^^^^^^^
error: 112: unknown identifier 'param_2'
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
                                                                          ^^^^^^^
error: 119: initializers are not permitted on arrays (or structs containing arrays)
            float param_5[96] = shapeData;
                                ^^^^^^^^^
error: 120: unknown identifier 'param_5'
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
                                                                                      ^^^^^^^
error: 121: unknown identifier 'result'
            float param_6 = result;
                            ^^^^^^
error: 122: unknown identifier 'shapeSDF'
            float param_7 = shapeSDF;
                            ^^^^^^^^
error: 124: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
            ^^^^^^
error: 124: unknown identifier 'param_6'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
                                                   ^^^^^^^
error: 124: unknown identifier 'param_7'
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
                                                            ^^^^^^^
error: 130: initializers are not permitted on arrays (or structs containing arrays)
            float param_11[96] = shapeData;
                                 ^^^^^^^^^
error: 131: unknown identifier 'param_11'
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
                                                                                         ^^^^^^^^
error: 132: unknown identifier 'result'
            float param_12 = result;
                             ^^^^^^
error: 133: unknown identifier 'shapeSDF_1'
            float param_13 = shapeSDF_1;
                             ^^^^^^^^^^
error: 135: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
            ^^^^^^
error: 135: unknown identifier 'param_12'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
                                                   ^^^^^^^^
error: 135: unknown identifier 'param_13'
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
                                                             ^^^^^^^^
error: 141: initializers are not permitted on arrays (or structs containing arrays)
            float param_17[96] = shapeData;
                                 ^^^^^^^^^
error: 142: unknown identifier 'param_17'
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
                                                                                          ^^^^^^^^
error: 143: unknown identifier 'result'
            float param_18 = result;
                             ^^^^^^
error: 144: unknown identifier 'shapeSDF_2'
            float param_19 = shapeSDF_2;
                             ^^^^^^^^^^
error: 146: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
            ^^^^^^
error: 146: unknown identifier 'param_18'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
                                                   ^^^^^^^^
error: 146: unknown identifier 'param_19'
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
                                                             ^^^^^^^^
error: 151: no match for min(int, int)
        for (int i = 1; i < min(numShapes, 16); i++)
                            ^^^^^^^^^^^^^^^^^^
error: 155: initializers are not permitted on arrays (or structs containing arrays)
            float param_23[96] = shapeData;
                                 ^^^^^^^^^
error: 156: unknown identifier 'param_23'
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
                                                                                          ^^^^^^^^
error: 157: unknown identifier 'result'
            float param_24 = result;
                             ^^^^^^
error: 158: unknown identifier 'shapeSDF_3'
            float param_25 = shapeSDF_3;
                             ^^^^^^^^^^
error: 160: unknown identifier 'result'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
            ^^^^^^
error: 160: unknown identifier 'param_24'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
                                                   ^^^^^^^^
error: 160: unknown identifier 'param_25'
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
                                                             ^^^^^^^^
error: 163: unknown identifier 'result'
    return result;
           ^^^^^^
error: 192: initializers are not permitted on arrays (or structs containing arrays)
    float param_2[96] = uShapeData;
                        ^^^^^^^^^^
error: 194: unknown identifier 'param_2'
    float sd = FLT_flutter_local_sceneSDF(param, param_1, param_2, param_3);
                                                          ^^^^^^^
error: 195: unknown identifier 'sd'
    float foregroundAlpha = 1.0 - smoothstep(-2.0, 0.0, sd);
                                                        ^^
error: 196: unknown identifier 'foregroundAlpha'
    if (foregroundAlpha < 0.00999999977648258209228515625)
        ^^^^^^^^^^^^^^^
error: 201: unknown identifier 'sd'
    float dx = dFdx(sd);
                    ^^
error: 202: unknown identifier 'sd'
    float dy = dFdy(sd);
                    ^^
error: 203: unknown identifier 'sd'
    float n_cos = max(uThickness + sd, 0.0) / uThickness;
                                   ^^
error: 204: unknown identifier 'n_cos'
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
                                       ^^^^^
error: 204: unknown identifier 'n_cos'
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
                                               ^^^^^
error: 205: unknown identifier 'dx'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                 ^^
error: 205: unknown identifier 'n_cos'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                      ^^^^^
error: 205: unknown identifier 'dy'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                             ^^
error: 205: unknown identifier 'n_cos'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                                  ^^^^^
error: 205: unknown identifier 'n_sin'
    vec3 normal = normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
                                                         ^^^^^
error: 206: unknown identifier 'sd'
    if ((sd >= 0.0) || (uThickness <= 0.0))
         ^^
error: 211: unknown identifier 'sd'
    float x = uThickness + sd;
                           ^^
error: 212: unknown identifier 'x'
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
                                                                ^
error: 212: unknown identifier 'x'
    float sqrtTerm = sqrt(max(0.0, (uThickness * uThickness) - (x * x)));
                                                                    ^
error: 213: unknown identifier 'sqrtTerm'
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
                         ^^^^^^^^
error: 213: unknown identifier 'sd'
    float height_1 = mix(sqrtTerm, uThickness, float(sd < (-uThickness)));
                                                     ^^
error: 217: unknown identifier 'normal'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                         ^^^^^^
error: 218: unknown identifier 'height_1'
    float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                               ^^^^^^^^
error: 218: unknown identifier 'baseRefract'
...   float baseRefractLength = (height_1 + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                                                                          ^^^^^^^^^^^
error: 219: unknown identifier 'baseRefract'
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
                          ^^^^^^^^^^^
error: 219: unknown identifier 'baseRefractLength'
    vec2 displacement_1 = baseRefract.xy * baseRefractLength;
                                           ^^^^^^^^^^^^^^^^^
error: 221: unknown identifier 'displacement_1'
    vec2 param_4 = displacement_1;
                   ^^^^^^^^^^^^^^
error: 223: unknown identifier 'height_1'
    float param_6 = height_1;
                    ^^^^^^^^
error: 225: unknown identifier 'foregroundAlpha'
    float param_8 = foregroundAlpha;
                    ^^^^^^^^^^^^^^^
error: 226: unknown identifier 'param_4'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                         ^^^^^^^
error: 226: unknown identifier 'param_6'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                                           ^^^^^^^
error: 226: unknown identifier 'param_8'
    fragColor = FLT_flutter_local_encodeDisplacementData(param_4, param_5, param_6, param_7, param_8);
                                                                                          ^^^^^^^
63 errors



Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_arbitrary.frag": Compiled to invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

uniform vec2 uSize;
uniform vec2 uForegroundSize;
uniform vec4 uGlassColor;
uniform vec4 uOpticalProps;
uniform vec4 uLightConfig;
uniform vec2 uTransformData;
uniform vec2 uLightDirection;
uniform mat4 uTransform;
uniform shader uBackgroundTexture;
uniform half2 uBackgroundTexture_size;
uniform shader uForegroundTexture;
uniform half2 uForegroundTexture_size;
uniform shader uForegroundBlurredTexture;
uniform half2 uForegroundBlurredTexture_size;

vec4 fragColor;

float uChromaticAberration;
float uLightAngle;
float uLightIntensity;
float uAmbientStrength;
float uThickness;
float uRefractiveIndex;
vec2 uOffset;
float uSaturation;
float uGaussianBlur;

vec2 FLT_flutter_local_FlutterFragCoord()
{
    return flutter_FragCoord.xy;
}

float FLT_flutter_local_computeY(float coordY, vec2 size)
{
    return coordY / size.y;
}

float FLT_flutter_local_approximateSDF(float blurredAlpha, float thickness)
{
    float normalizedDistance = smoothstep(0.0, 1.0, blurredAlpha);
    return (-normalizedDistance) * thickness;
}

vec2 FLT_flutter_local_findShapeCenter(vec2 currentUV)
{
    vec2 texelSize = vec2(2.0) / uForegroundSize;
    vec2 centerSum = vec2(0.0);
    float totalAlpha = 0.0;
    int sampleRadius = 10;
    int _692 = -sampleRadius;
    for (int y = _692; y <= sampleRadius; y++)
    {
        int _703 = -sampleRadius;
        for (int x = _703; x <= sampleRadius; x++)
        {
            vec2 sampleUV = currentUV + (vec2(float(x), float(y)) * texelSize);
            bool _724 = sampleUV.x >= 0.0;
            bool _730;
            if (_724)
            {
                _730 = sampleUV.x <= 1.0;
            }
            else
            {
                _730 = _724;
            }
            bool _736;
            if (_730)
            {
                _736 = sampleUV.y >= 0.0;
            }
            else
            {
                _736 = _730;
            }
            bool _742;
            if (_736)
            {
                _742 = sampleUV.y <= 1.0;
            }
            else
            {
                _742 = _736;
            }
            if (_742)
            {
                float alpha = uForegroundTexture.eval(uForegroundTexture_size * ( sampleUV)).w;
                if (alpha > 0.100000001490116119384765625)
                {
                    centerSum += (sampleUV * alpha);
                    totalAlpha += alpha;
                }
            }
        }
    }
    vec2 _771;
    if (totalAlpha > 0.0)
    {
        _771 = centerSum / vec2(totalAlpha);
    }
    else
    {
        _771 = currentUV;
    }
    return _771;
}

vec3 FLT_flutter_local_getReconstructedNormal(vec2 p, float thickness)
{
    vec2 uv = p / uForegroundSize;
    if (uForegroundTexture.eval(uForegroundTexture_size * ( uv)).w < 0.00999999977648258209228515625)
    {
        return vec3(0.0, 0.0, 1.0);
    }
    vec2 param = uv;
    vec2 shapeCenter = FLT_flutter_local_findShapeCenter(param);
    vec2 centerToPoint = uv - shapeCenter;
    if (length(centerToPoint) < 0.001000000047497451305389404296875)
    {
        return vec3(0.0, 0.0, 1.0);
    }
    vec2 outwardDirection = normalize(centerToPoint);
    float blurredAlpha = uForegroundBlurredTexture.eval(uForegroundBlurredTexture_size * ( uv)).w;
    float sharpAlpha = uForegroundTexture.eval(uForegroundTexture_size * ( uv)).w;
    float edgeDistance = smoothstep(0.0, 1.0, blurredAlpha);
    float normalExponent = 0.20000000298023223876953125;
    float normalZ = pow(edgeDistance, normalExponent);
    float xyScale = sqrt(max(0.0, 1.0 - (normalZ * normalZ)));
    return normalize(vec3(outwardDirection * xyScale, normalZ));
}

vec3 FLT_flutter_local_getNormal(vec2 p, float thickness)
{
    vec2 param = p;
    float param_1 = thickness;
    return FLT_flutter_local_getReconstructedNormal(param, param_1);
}

float FLT_flutter_local_getHeight(float sd, float thickness)
{
    if ((sd >= 0.0) || (thickness <= 0.0))
    {
        return 0.0;
    }
    if (sd < (-thickness))
    {
        return thickness;
    }
    float x = thickness + sd;
    return sqrt(max(0.0, (thickness * thickness) - (x * x)));
}

vec4 FLT_flutter_local_calculateRefraction(vec2 screenUV, vec3 normal, float height, float thickness, float refractiveIndex, float chromaticAberration, vec2 uSize_1, shader backgroundTexture, float blurRadius, out vec2 refractionDisplacement)
{
    float baseHeight = thickness * 8.0;
    vec3 incident = vec3(0.0, 0.0, -1.0);
    float invRefractiveIndex = 1.0 / refractiveIndex;
    vec2 invUSize = vec2(1.0) / uSize_1;
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
    refractionDisplacement = baseDisplacement;
    if (chromaticAberration < 0.001000000047497451305389404296875)
    {
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
    }
    float dispersionStrength = chromaticAberration * 0.5;
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
    vec2 redUV = screenUV + (redOffset * invUSize);
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
    vec2 blueUV = screenUV + (blueOffset * invUSize);
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
    return vec4(red, greenSample.y, blue, greenSample.w);
}

vec3 FLT_flutter_local_getHighlightColor(vec3 backgroundColor, float targetBrightness)
{
    float luminance = dot(backgroundColor, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    float maxComponent = max(max(backgroundColor.x, backgroundColor.y), backgroundColor.z);
    float minComponent = min(min(backgroundColor.x, backgroundColor.y), backgroundColor.z);
    float _189;
    if (maxComponent > 0.0)
    {
        _189 = (maxComponent - minComponent) / maxComponent;
    }
    else
    {
        _189 = 0.0;
    }
    float saturation = _189;
    vec3 coloredHighlight = vec3(targetBrightness);
    if (luminance > 0.001000000047497451305389404296875)
    {
        vec3 normalizedBackground = backgroundColor / vec3(luminance);
        coloredHighlight = normalizedBackground * targetBrightness;
        float saturationBoost = 1.2999999523162841796875;
        vec3 gray = vec3(dot(coloredHighlight, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625)));
        coloredHighlight = mix(gray, coloredHighlight, vec3(saturationBoost));
        coloredHighlight = min(coloredHighlight, vec3(1.0));
    }
    float luminanceFactor = smoothstep(0.0, 0.60000002384185791015625, luminance);
    float saturationFactor = smoothstep(0.0, 0.4000000059604644775390625, saturation);
    float colorInfluence = luminanceFactor * saturationFactor;
    vec3 whiteHighlight = vec3(targetBrightness);
    return mix(whiteHighlight, coloredHighlight, vec3(colorInfluence));
}

vec3 FLT_flutter_local_calculateLighting(vec2 uv, vec3 normal, float sd, float thickness, float height, vec2 lightDirection, float lightIntensity, float ambientStrength, vec3 backgroundColor)
{
    float _286;
    if (thickness > 0.0)
    {
        _286 = height / thickness;
    }
    else
    {
        _286 = 0.0;
    }
    float normalizedHeight = _286;
    float shape = clamp((1.0 - normalizedHeight) * 1.11099994182586669921875, 0.0, 1.0);
    if (shape < 0.00999999977648258209228515625)
    {
        return vec3(0.0);
    }
    float thicknessFactor = clamp((thickness - 5.0) * 0.5, 0.0, 1.0);
    if (thicknessFactor < 0.00999999977648258209228515625)
    {
        return vec3(0.0);
    }
    float rimWidth = 1.5;
    float k = 0.88999998569488525390625;
    float x = sd / rimWidth;
    float rimFactor = 1.0 / (1.0 + ((k * x) * x));
    if ((rimFactor < 0.00999999977648258209228515625) || (lightIntensity < 0.00999999977648258209228515625))
    {
        return vec3(0.0);
    }
    vec2 normalXY = normal.xy;
    float mainLightInfluence = max(0.0, dot(normalXY, lightDirection));
    float oppositeLightInfluence = max(0.0, dot(normalXY, -lightDirection));
    float totalInfluence = mainLightInfluence + (oppositeLightInfluence * 0.800000011920928955078125);
    vec3 param = backgroundColor;
    float param_1 = 1.0;
    vec3 highlightColor = FLT_flutter_local_getHighlightColor(param, param_1);
    vec3 directionalRim = (((highlightColor * 0.699999988079071044921875) * (totalInfluence * totalInfluence)) * lightIntensity) * 2.0;
    vec3 ambientRim = (highlightColor * 0.4000000059604644775390625) * ambientStrength;
    vec3 totalRimLight = (directionalRim + ambientRim) * rimFactor;
    return (totalRimLight * thicknessFactor) * shape;
}

vec4 FLT_flutter_local_applyGlassColor(vec4 liquidColor, vec4 glassColor)
{
    vec4 finalColor = liquidColor;
    if (glassColor.w > 0.0)
    {
        float glassLuminance = dot(glassColor.xyz, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
        if (glassLuminance < 0.5)
        {
            vec3 darkened = liquidColor.xyz * (glassColor.xyz * 2.0);
            vec3 _544 = mix(liquidColor.xyz, darkened, vec3(glassColor.w));
            finalColor.x = _544.x;
            finalColor.y = _544.y;
            finalColor.z = _544.z;
        }
        else
        {
            vec3 invLiquid = vec3(1.0) - liquidColor.xyz;
            vec3 invGlass = vec3(1.0) - glassColor.xyz;
            vec3 screened = vec3(1.0) - (invLiquid * invGlass);
            vec3 _571 = mix(liquidColor.xyz, screened, vec3(glassColor.w));
            finalColor.x = _571.x;
            finalColor.y = _571.y;
            finalColor.z = _571.z;
        }
        finalColor.w = liquidColor.w;
    }
    return finalColor;
}

vec3 FLT_flutter_local_applySaturation(vec3 color, float saturation)
{
    float luminance = dot(color, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    vec3 saturatedColor = mix(vec3(luminance), color, vec3(saturation));
    return clamp(saturatedColor, vec3(0.0), vec3(1.0));
}

vec4 FLT_flutter_local_renderLiquidGlass(vec2 screenUV, vec2 p, vec2 uSize_1, float sd, float thickness, float refractiveIndex, float chromaticAberration, vec4 glassColor, vec2 lightDirection, float lightIntensity, float ambientStrength, shader backgroundTexture, vec3 normal, float foregroundAlpha, float gaussianBlur, float saturation)
{
    float param = sd;
    float param_1 = thickness;
    float height = FLT_flutter_local_getHeight(param, param_1);
    vec2 param_2 = screenUV;
    vec3 param_3 = normal;
    float param_4 = height;
    float param_5 = thickness;
    float param_6 = refractiveIndex;
    float param_7 = chromaticAberration;
    vec2 param_8 = uSize_1;
    float param_9 = gaussianBlur;
    vec2 param_10;
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
    vec2 refractionDisplacement = param_10;
    vec4 refractColor = _609;
    vec3 backgroundColor = refractColor.xyz;
    vec2 param_11 = screenUV;
    vec3 param_12 = normal;
    float param_13 = sd;
    float param_14 = thickness;
    float param_15 = height;
    vec2 param_16 = lightDirection;
    float param_17 = lightIntensity;
    float param_18 = ambientStrength;
    vec3 param_19 = backgroundColor;
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
    vec4 param_20 = refractColor;
    vec4 param_21 = glassColor;
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
    vec4 _641 = finalColor;
    vec3 _643 = _641.xyz + lighting;
    finalColor.x = _643.x;
    finalColor.y = _643.y;
    finalColor.z = _643.z;
    vec3 param_22 = finalColor.xyz;
    float param_23 = saturation;
    vec3 _655 = FLT_flutter_local_applySaturation(param_22, param_23);
    finalColor.x = _655.x;
    finalColor.y = _655.y;
    finalColor.z = _655.z;
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
}

void FLT_main()
{
    uChromaticAberration = uOpticalProps.y;
    uLightAngle = uLightConfig.x;
    uLightIntensity = uLightConfig.y;
    uAmbientStrength = uLightConfig.z;
    uThickness = uOpticalProps.z;
    uRefractiveIndex = uOpticalProps.x;
    uOffset = uTransformData;
    uSaturation = uLightConfig.w;
    uGaussianBlur = uOpticalProps.w;
    vec2 fragCoord = FLT_flutter_local_FlutterFragCoord();
    float param_24 = fragCoord.y;
    vec2 param_25 = uSize;
    float screenY = FLT_flutter_local_computeY(param_24, param_25);
    vec2 screenUV_1 = vec2(fragCoord.x / uSize.x, screenY);
    vec2 layerLocalCoord = fragCoord - uOffset;
    vec4 transformedCoord = uTransform * vec4(layerLocalCoord, 0.0, 1.0);
    float param_26 = transformedCoord.y;
    vec2 param_27 = uForegroundSize;
    float layerY = FLT_flutter_local_computeY(param_26, param_27);
    vec2 layerUV = vec2(transformedCoord.x / uForegroundSize.x, layerY);
    bool _906 = layerUV.x < 0.0;
    bool _913;
    if (!_906)
    {
        _913 = layerUV.x > 1.0;
    }
    else
    {
        _913 = _906;
    }
    bool _920;
    if (!_913)
    {
        _920 = layerUV.y < 0.0;
    }
    else
    {
        _920 = _913;
    }
    bool _927;
    if (!_920)
    {
        _927 = layerUV.y > 1.0;
    }
    else
    {
        _927 = _920;
    }
    if (_927)
    {
        fragColor = uBackgroundTexture.eval(uBackgroundTexture_size * ( screenUV_1));
        return;
    }
    vec4 foregroundColor = uForegroundTexture.eval(uForegroundTexture_size * ( layerUV));
    if (foregroundColor.w < 0.001000000047497451305389404296875)
    {
        fragColor = uBackgroundTexture.eval(uBackgroundTexture_size * ( screenUV_1));
        return;
    }
    vec4 blurred = uForegroundBlurredTexture.eval(uForegroundBlurredTexture_size * ( layerUV));
    float param_28 = blurred.w;
    float param_29 = uThickness;
    float sd_1 = FLT_flutter_local_approximateSDF(param_28, param_29);
    vec2 param_30 = transformedCoord.xy;
    float param_31 = uThickness;
    vec3 normal_1 = FLT_flutter_local_getNormal(param_30, param_31);
    vec2 param_32 = screenUV_1;
    vec2 param_33 = fragCoord;
    vec2 param_34 = uSize;
    float param_35 = sd_1;
    float param_36 = uThickness;
    float param_37 = uRefractiveIndex;
    float param_38 = uChromaticAberration;
    vec4 param_39 = uGlassColor;
    vec2 param_40 = uLightDirection;
    float param_41 = uLightIntensity;
    float param_42 = uAmbientStrength;
    vec3 param_43 = normal_1;
    float param_44 = foregroundColor.w;
    float param_45 = uGaussianBlur;
    float param_46 = uSaturation;
    fragColor = FLT_flutter_local_renderLiquidGlass(param_32, param_33, param_34, param_35, param_36, param_37, param_38, param_39, param_40, param_41, param_42, uBackgroundTexture, param_43, param_44, param_45, param_46);
}

half4 main(float2 iFragCoord)
{
      flutter_FragCoord = float4(iFragCoord, 0, 0);
      FLT_main();
      return fragColor;
}

SkSL Error:
error: 58: loop index initializer must be a constant expression
        for (int x = _703; x <= sampleRadius; x++)
             ^^^^^^^^^^^^
error: 55: loop index initializer must be a constant expression
    for (int y = _692; y <= sampleRadius; y++)
         ^^^^^^^^^^^^
error: 157: parameters of type 'shader' not allowed
...mal, float height, float thickness, float refractiveIndex, float chromaticAberration, vec2 uSize_1, shader backgroundTexture, float blurRadius, out vec2 refractionDisplacement)
                                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^
error: 159: unknown identifier 'thickness'
    float baseHeight = thickness * 8.0;
                       ^^^^^^^^^
error: 161: unknown identifier 'refractiveIndex'
    float invRefractiveIndex = 1.0 / refractiveIndex;
                                     ^^^^^^^^^^^^^^^
error: 162: unknown identifier 'uSize_1'
    vec2 invUSize = vec2(1.0) / uSize_1;
                                ^^^^^^^
error: 163: unknown identifier 'normal'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                         ^^^^^^
error: 163: unknown identifier 'invRefractiveIndex'
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
                                                 ^^^^^^^^^^^^^^^^^^
error: 164: unknown identifier 'height'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                               ^^^^^^
error: 164: unknown identifier 'baseHeight'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                        ^^^^^^^^^^
error: 164: unknown identifier 'baseRefract'
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
                                                                                          ^^^^^^^^^^^
error: 165: unknown identifier 'baseRefract'
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
                            ^^^^^^^^^^^
error: 165: unknown identifier 'baseRefractLength'
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
                                             ^^^^^^^^^^^^^^^^^
error: 166: unknown identifier 'refractionDisplacement'
    refractionDisplacement = baseDisplacement;
    ^^^^^^^^^^^^^^^^^^^^^^
error: 166: unknown identifier 'baseDisplacement'
    refractionDisplacement = baseDisplacement;
                             ^^^^^^^^^^^^^^^^
error: 167: unknown identifier 'chromaticAberration'
    if (chromaticAberration < 0.001000000047497451305389404296875)
        ^^^^^^^^^^^^^^^^^^^
error: 169: unknown identifier 'screenUV'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                           ^^^^^^^^
error: 169: unknown identifier 'baseDisplacement'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                                       ^^^^^^^^^^^^^^^^
error: 169: unknown identifier 'invUSize'
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
                                                          ^^^^^^^^
error: 170: unknown identifier 'backgroundTexture'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
               ^^^^^^^^^^^^^^^^^
error: 170: unknown identifier 'backgroundTexture_size'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
                                      ^^^^^^^^^^^^^^^^^^^^^^
error: 170: unknown identifier 'refractedUV'
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
                                                                 ^^^^^^^^^^^
error: 172: unknown identifier 'chromaticAberration'
    float dispersionStrength = chromaticAberration * 0.5;
                               ^^^^^^^^^^^^^^^^^^^
error: 173: unknown identifier 'baseDisplacement'
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
                     ^^^^^^^^^^^^^^^^
error: 173: unknown identifier 'dispersionStrength'
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
                                               ^^^^^^^^^^^^^^^^^^
error: 174: unknown identifier 'baseDisplacement'
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
                      ^^^^^^^^^^^^^^^^
error: 174: unknown identifier 'dispersionStrength'
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
                                                ^^^^^^^^^^^^^^^^^^
error: 175: unknown identifier 'screenUV'
    vec2 redUV = screenUV + (redOffset * invUSize);
                 ^^^^^^^^
error: 175: unknown identifier 'redOffset'
    vec2 redUV = screenUV + (redOffset * invUSize);
                             ^^^^^^^^^
error: 175: unknown identifier 'invUSize'
    vec2 redUV = screenUV + (redOffset * invUSize);
                                         ^^^^^^^^
error: 176: unknown identifier 'screenUV'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                   ^^^^^^^^
error: 176: unknown identifier 'baseDisplacement'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                               ^^^^^^^^^^^^^^^^
error: 176: unknown identifier 'invUSize'
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
                                                  ^^^^^^^^
error: 177: unknown identifier 'screenUV'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                  ^^^^^^^^
error: 177: unknown identifier 'blueOffset'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                              ^^^^^^^^^^
error: 177: unknown identifier 'invUSize'
    vec2 blueUV = screenUV + (blueOffset * invUSize);
                                           ^^^^^^^^
error: 178: unknown identifier 'backgroundTexture'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                ^^^^^^^^^^^^^^^^^
error: 178: unknown identifier 'backgroundTexture_size'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                                       ^^^^^^^^^^^^^^^^^^^^^^
error: 178: unknown identifier 'redUV'
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
                                                                  ^^^^^
error: 179: unknown identifier 'backgroundTexture'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                       ^^^^^^^^^^^^^^^^^
error: 179: unknown identifier 'backgroundTexture_size'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                                              ^^^^^^^^^^^^^^^^^^^^^^
error: 179: unknown identifier 'greenUV'
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
                                                                         ^^^^^^^
error: 180: unknown identifier 'backgroundTexture'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                 ^^^^^^^^^^^^^^^^^
error: 180: unknown identifier 'backgroundTexture_size'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                                        ^^^^^^^^^^^^^^^^^^^^^^
error: 180: unknown identifier 'blueUV'
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
                                                                   ^^^^^^
error: 181: unknown identifier 'red'
    return vec4(red, greenSample.y, blue, greenSample.w);
                ^^^
error: 181: unknown identifier 'greenSample'
    return vec4(red, greenSample.y, blue, greenSample.w);
                     ^^^^^^^^^^^
error: 181: unknown identifier 'blue'
    return vec4(red, greenSample.y, blue, greenSample.w);
                                    ^^^^
error: 181: unknown identifier 'greenSample'
    return vec4(red, greenSample.y, blue, greenSample.w);
                                          ^^^^^^^^^^^
error: 295: parameters of type 'shader' not allowed
...maticAberration, vec4 glassColor, vec2 lightDirection, float lightIntensity, float ambientStrength, shader backgroundTexture, vec3 normal, float foregroundAlpha, float gaussianBlur, float saturation)
                                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^
error: 297: unknown identifier 'sd'
    float param = sd;
                  ^^
error: 298: unknown identifier 'thickness'
    float param_1 = thickness;
                    ^^^^^^^^^
error: 299: unknown identifier 'param'
    float height = FLT_flutter_local_getHeight(param, param_1);
                                               ^^^^^
error: 299: unknown identifier 'param_1'
    float height = FLT_flutter_local_getHeight(param, param_1);
                                                      ^^^^^^^
error: 300: unknown identifier 'screenUV'
    vec2 param_2 = screenUV;
                   ^^^^^^^^
error: 301: unknown identifier 'normal'
    vec3 param_3 = normal;
                   ^^^^^^
error: 302: unknown identifier 'height'
    float param_4 = height;
                    ^^^^^^
error: 303: unknown identifier 'thickness'
    float param_5 = thickness;
                    ^^^^^^^^^
error: 304: unknown identifier 'refractiveIndex'
    float param_6 = refractiveIndex;
                    ^^^^^^^^^^^^^^^
error: 305: unknown identifier 'chromaticAberration'
    float param_7 = chromaticAberration;
                    ^^^^^^^^^^^^^^^^^^^
error: 306: unknown identifier 'uSize_1'
    vec2 param_8 = uSize_1;
                   ^^^^^^^
error: 307: unknown identifier 'gaussianBlur'
    float param_9 = gaussianBlur;
                    ^^^^^^^^^^^^
error: 309: unknown identifier 'FLT_flutter_local_calculateRefraction'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10...
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: 309: unknown identifier 'param_2'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                      ^^^^^^^
error: 309: unknown identifier 'param_3'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                               ^^^^^^^
error: 309: unknown identifier 'param_4'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                        ^^^^^^^
error: 309: unknown identifier 'param_5'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                 ^^^^^^^
error: 309: unknown identifier 'param_6'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 309: unknown identifier 'param_7'
    vec4 _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 309: unknown identifier 'param_8'
... _609 = FLT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 309: unknown identifier 'backgroundTexture'
...LT_flutter_local_calculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^^^^^^^^^^^
error: 309: unknown identifier 'param_9'
...lculateRefraction(param_2, param_3, param_4, param_5, param_6, param_7, param_8, backgroundTexture, param_9, param_10);
                                                                                          ^^^^^^^
error: 311: unknown identifier '_609'
    vec4 refractColor = _609;
                        ^^^^
error: 312: unknown identifier 'refractColor'
    vec3 backgroundColor = refractColor.xyz;
                           ^^^^^^^^^^^^
error: 313: unknown identifier 'screenUV'
    vec2 param_11 = screenUV;
                    ^^^^^^^^
error: 314: unknown identifier 'normal'
    vec3 param_12 = normal;
                    ^^^^^^
error: 315: unknown identifier 'sd'
    float param_13 = sd;
                     ^^
error: 316: unknown identifier 'thickness'
    float param_14 = thickness;
                     ^^^^^^^^^
error: 317: unknown identifier 'height'
    float param_15 = height;
                     ^^^^^^
error: 318: unknown identifier 'lightDirection'
    vec2 param_16 = lightDirection;
                    ^^^^^^^^^^^^^^
error: 319: unknown identifier 'lightIntensity'
    float param_17 = lightIntensity;
                     ^^^^^^^^^^^^^^
error: 320: unknown identifier 'ambientStrength'
    float param_18 = ambientStrength;
                     ^^^^^^^^^^^^^^^
error: 321: unknown identifier 'backgroundColor'
    vec3 param_19 = backgroundColor;
                    ^^^^^^^^^^^^^^^
error: 322: unknown identifier 'param_11'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                        ^^^^^^^^
error: 322: unknown identifier 'param_12'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                  ^^^^^^^^
error: 322: unknown identifier 'param_13'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                            ^^^^^^^^
error: 322: unknown identifier 'param_14'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                      ^^^^^^^^
error: 322: unknown identifier 'param_15'
    vec3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 322: unknown identifier 'param_16'
...c3 lighting = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 322: unknown identifier 'param_17'
...g = FLT_flutter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 322: unknown identifier 'param_18'
...utter_local_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 322: unknown identifier 'param_19'
...l_calculateLighting(param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19);
                                                                                          ^^^^^^^^
error: 323: unknown identifier 'refractColor'
    vec4 param_20 = refractColor;
                    ^^^^^^^^^^^^
error: 324: unknown identifier 'glassColor'
    vec4 param_21 = glassColor;
                    ^^^^^^^^^^
error: 325: unknown identifier 'param_20'
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
                                                        ^^^^^^^^
error: 325: unknown identifier 'param_21'
    vec4 finalColor = FLT_flutter_local_applyGlassColor(param_20, param_21);
                                                                  ^^^^^^^^
error: 326: unknown identifier 'finalColor'
    vec4 _641 = finalColor;
                ^^^^^^^^^^
error: 327: unknown identifier '_641'
    vec3 _643 = _641.xyz + lighting;
                ^^^^
error: 327: unknown identifier 'lighting'
    vec3 _643 = _641.xyz + lighting;
                           ^^^^^^^^
error: 328: unknown identifier 'finalColor'
    finalColor.x = _643.x;
    ^^^^^^^^^^
error: 328: unknown identifier '_643'
    finalColor.x = _643.x;
                   ^^^^
error: 329: unknown identifier 'finalColor'
    finalColor.y = _643.y;
    ^^^^^^^^^^
error: 329: unknown identifier '_643'
    finalColor.y = _643.y;
                   ^^^^
error: 330: unknown identifier 'finalColor'
    finalColor.z = _643.z;
    ^^^^^^^^^^
error: 330: unknown identifier '_643'
    finalColor.z = _643.z;
                   ^^^^
error: 331: unknown identifier 'finalColor'
    vec3 param_22 = finalColor.xyz;
                    ^^^^^^^^^^
error: 332: unknown identifier 'saturation'
    float param_23 = saturation;
                     ^^^^^^^^^^
error: 333: unknown identifier 'param_22'
    vec3 _655 = FLT_flutter_local_applySaturation(param_22, param_23);
                                                  ^^^^^^^^
error: 333: unknown identifier 'param_23'
    vec3 _655 = FLT_flutter_local_applySaturation(param_22, param_23);
                                                            ^^^^^^^^
error: 334: unknown identifier 'finalColor'
    finalColor.x = _655.x;
    ^^^^^^^^^^
error: 334: unknown identifier '_655'
    finalColor.x = _655.x;
                   ^^^^
error: 335: unknown identifier 'finalColor'
    finalColor.y = _655.y;
    ^^^^^^^^^^
error: 335: unknown identifier '_655'
    finalColor.y = _655.y;
                   ^^^^
error: 336: unknown identifier 'finalColor'
    finalColor.z = _655.z;
    ^^^^^^^^^^
error: 336: unknown identifier '_655'
    finalColor.z = _655.z;
                   ^^^^
error: 337: unknown identifier 'finalColor'
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
                          ^^^^^^^^^^
error: 337: unknown identifier 'foregroundAlpha'
    return mix(vec4(0.0), finalColor, vec4(foregroundAlpha));
                                           ^^^^^^^^^^^^^^^
error: 423: unknown identifier 'FLT_flutter_local_renderLiquidGlass'
    fragColor = FLT_flutter_local_renderLiquidGlass(param_32, param_33, param_34, param_35, param_36, param_37, param_38, param_39, param_40, param_41,...
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118 errors



Compilation failed for target: SkSL
"/Users/bensonluk/projects/flutter_liquid_glass/packages/liquid_glass_renderer/lib/assets/shaders/liquid_glass_filter.frag": Compiled to invalid SkSL:
// This SkSL shader is autogenerated by spirv-cross.

float4 flutter_FragCoord;

uniform vec2 uSize;
uniform vec4 uGlassColor;
uniform vec4 uOpticalProps;
uniform vec4 uLightConfig;
uniform vec2 uLightDirection;
uniform float uNumShapes;
uniform float uShapeData[96];
uniform shader uBlurredTexture;
uniform half2 uBlurredTexture_size;

vec4 fragColor;

float uChromaticAberration;
float uLightAngle;
float uLightIntensity;
float uAmbientStrength;
float uThickness;
float uRefractiveIndex;
float uBlend;
float uSaturation;

vec2 FLT_flutter_local_FlutterFragCoord()
{
    return flutter_FragCoord.xy;
}

float FLT_flutter_local_sdfSquircle(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    vec2 maxQ = max(q, vec2(0.0));
    return (min(max(q.x, q.y), 0.0) + sqrt((maxQ.x * maxQ.x) + (maxQ.y * maxQ.y))) - r;
}

float FLT_flutter_local_sdfEllipse(vec2 p, inout vec2 r)
{
    r = max(r, vec2(9.9999997473787516355514526367188e-05));
    vec2 invR = vec2(1.0) / r;
    vec2 invR2 = invR * invR;
    vec2 pInvR = p * invR;
    float k1 = length(pInvR);
    vec2 pInvR2 = p * invR2;
    float k2 = length(pInvR2);
    return (k1 * (k1 - 1.0)) / max(k2, 9.9999997473787516355514526367188e-05);
}

float FLT_flutter_local_sdfRRect(vec2 p, vec2 b, inout float r)
{
    float shortest = min(b.x, b.y);
    r = min(r, shortest);
    vec2 q = (abs(p) - b) + vec2(r);
    return (min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0)))) - r;
}

float FLT_flutter_local_getShapeSDF(float type, vec2 p, vec2 center, vec2 size, float r)
{
    if (type == 1.0)
    {
        vec2 param = p - center;
        vec2 param_1 = size / vec2(2.0);
        float param_2 = r;
        float _844 = FLT_flutter_local_sdfSquircle(param, param_1, param_2);
        return _844;
    }
    if (type == 2.0)
    {
        vec2 param_3 = p - center;
        vec2 param_4 = size / vec2(2.0);
        float _858 = FLT_flutter_local_sdfEllipse(param_3, param_4);
        return _858;
    }
    if (type == 3.0)
    {
        vec2 param_5 = p - center;
        vec2 param_6 = size / vec2(2.0);
        float param_7 = r;
        float _875 = FLT_flutter_local_sdfRRect(param_5, param_6, param_7);
        return _875;
    }
    return 1000000000.0;
}

float FLT_flutter_local_getShapeSDFFromArray(int index, vec2 p, float shapeData[96])
{
    int baseIndex = index * 6;
    float type = shapeData[baseIndex];
    vec2 center = vec2(shapeData[baseIndex + 1], shapeData[baseIndex + 2]);
    vec2 size = vec2(shapeData[baseIndex + 3], shapeData[baseIndex + 4]);
    float cornerRadius = shapeData[baseIndex + 5];
    float param = type;
    vec2 param_1 = p;
    vec2 param_2 = center;
    vec2 param_3 = size;
    float param_4 = cornerRadius;
    return FLT_flutter_local_getShapeSDF(param, param_1, param_2, param_3, param_4);
}

float FLT_flutter_local_smoothUnion(float d1, float d2, float k)
{
    if (k <= 0.0)
    {
        return min(d1, d2);
    }
    float e = max(k - abs(d1 - d2), 0.0);
    return min(d1, d2) - (((e * e) * 0.25) / k);
}

float FLT_flutter_local_sceneSDF(vec2 p, int numShapes, float shapeData[96], float blend)
{
    if (numShapes == 0)
    {
        return 1000000000.0;
    }
    int param = 0;
    vec2 param_1 = p;
    float param_2[96] = shapeData;
    float result = FLT_flutter_local_getShapeSDFFromArray(param, param_1, param_2);
    if (numShapes <= 4)
    {
        if (numShapes >= 2)
        {
            int param_3 = 1;
            vec2 param_4 = p;
            float param_5[96] = shapeData;
            float shapeSDF = FLT_flutter_local_getShapeSDFFromArray(param_3, param_4, param_5);
            float param_6 = result;
            float param_7 = shapeSDF;
            float param_8 = blend;
            result = FLT_flutter_local_smoothUnion(param_6, param_7, param_8);
        }
        if (numShapes >= 3)
        {
            int param_9 = 2;
            vec2 param_10 = p;
            float param_11[96] = shapeData;
            float shapeSDF_1 = FLT_flutter_local_getShapeSDFFromArray(param_9, param_10, param_11);
            float param_12 = result;
            float param_13 = shapeSDF_1;
            float param_14 = blend;
            result = FLT_flutter_local_smoothUnion(param_12, param_13, param_14);
        }
        if (numShapes >= 4)
        {
            int param_15 = 3;
            vec2 param_16 = p;
            float param_17[96] = shapeData;
            float shapeSDF_2 = FLT_flutter_local_getShapeSDFFromArray(param_15, param_16, param_17);
            float param_18 = result;
            float param_19 = shapeSDF_2;
            float param_20 = blend;
            result = FLT_flutter_local_smoothUnion(param_18, param_19, param_20);
        }
    }
    else
    {
        for (int i = 1; i < min(numShapes, 16); i++)
        {
            int param_21 = i;
            vec2 param_22 = p;
            float param_23[96] = shapeData;
            float shapeSDF_3 = FLT_flutter_local_getShapeSDFFromArray(param_21, param_22, param_23);
            float param_24 = result;
            float param_25 = shapeSDF_3;
            float param_26 = blend;
            result = FLT_flutter_local_smoothUnion(param_24, param_25, param_26);
        }
    }
    return result;
}

vec3 FLT_flutter_local_getNormal(float sd, float thickness)
{
    float dx = dFdx(sd);
    float dy = dFdy(sd);
    float n_cos = max(thickness + sd, 0.0) / thickness;
    float n_sin = sqrt(max(0.0, 1.0 - (n_cos * n_cos)));
    return normalize(vec3(dx * n_cos, dy * n_cos, n_sin));
}

float FLT_flutter_local_getHeight(float sd, float thickness)
{
    if ((sd >= 0.0) || (thickness <= 0.0))
    {
        return 0.0;
    }
    if (sd < (-thickness))
    {
        return thickness;
    }
    float x = thickness + sd;
    return sqrt(max(0.0, (thickness * thickness) - (x * x)));
}

vec4 FLT_flutter_local_calculateRefraction(vec2 screenUV, vec3 normal, float height, float thickness, float refractiveIndex, float chromaticAberration, vec2 uSize_1, shader backgroundTexture, float blurRadius, out vec2 refractionDisplacement)
{
    float baseHeight = thickness * 8.0;
    vec3 incident = vec3(0.0, 0.0, -1.0);
    float invRefractiveIndex = 1.0 / refractiveIndex;
    vec2 invUSize = vec2(1.0) / uSize_1;
    vec3 baseRefract = refract(incident, normal, invRefractiveIndex);
    float baseRefractLength = (height + baseHeight) / max(0.001000000047497451305389404296875, abs(baseRefract.z));
    vec2 baseDisplacement = baseRefract.xy * baseRefractLength;
    refractionDisplacement = baseDisplacement;
    if (chromaticAberration < 0.001000000047497451305389404296875)
    {
        vec2 refractedUV = screenUV + (baseDisplacement * invUSize);
        return backgroundTexture.eval(backgroundTexture_size * ( refractedUV));
    }
    float dispersionStrength = chromaticAberration * 0.5;
    vec2 redOffset = baseDisplacement * (1.0 + dispersionStrength);
    vec2 blueOffset = baseDisplacement * (1.0 - dispersionStrength);
    vec2 redUV = screenUV + (redOffset * invUSize);
    vec2 greenUV = screenUV + (baseDisplacement * invUSize);
    vec2 blueUV = screenUV + (blueOffset * invUSize);
    float red = backgroundTexture.eval(backgroundTexture_size * ( redUV)).x;
    vec4 greenSample = backgroundTexture.eval(backgroundTexture_size * ( greenUV));
    float blue = backgroundTexture.eval(backgroundTexture_size * ( blueUV)).z;
    return vec4(red, greenSample.y, blue, greenSample.w);
}

vec3 FLT_flutter_local_getHighlightColor(vec3 backgroundColor, float targetBrightness)
{
    float luminance = dot(backgroundColor, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    float maxComponent = max(max(backgroundColor.x, backgroundColor.y), backgroundColor.z);
    float minComponent = min(min(backgroundColor.x, backgroundColor.y), backgroundColor.z);
    float _210;
    if (maxComponent > 0.0)
    {
        _210 = (maxComponent - minComponent) / maxComponent;
    }
    else
    {
        _210 = 0.0;
    }
    float saturation = _210;
    vec3 coloredHighlight = vec3(targetBrightness);
    if (luminance > 0.001000000047497451305389404296875)
    {
        vec3 normalizedBackground = backgroundColor / vec3(luminance);
        coloredHighlight = normalizedBackground * targetBrightness;
        float saturationBoost = 1.2999999523162841796875;
        vec3 gray = vec3(dot(coloredHighlight, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625)));
        coloredHighlight = mix(gray, coloredHighlight, vec3(saturationBoost));
        coloredHighlight = min(coloredHighlight, vec3(1.0));
    }
    float luminanceFactor = smoothstep(0.0, 0.60000002384185791015625, luminance);
    float saturationFactor = smoothstep(0.0, 0.4000000059604644775390625, saturation);
    float colorInfluence = luminanceFactor * saturationFactor;
    vec3 whiteHighlight = vec3(targetBrightness);
    return mix(whiteHighlight, coloredHighlight, vec3(colorInfluence));
}

vec3 FLT_flutter_local_calculateLighting(vec2 uv, vec3 normal, float sd, float thickness, float height, vec2 lightDirection, float lightIntensity, float ambientStrength, vec3 backgroundColor)
{
    float _307;
    if (thickness > 0.0)
    {
        _307 = height / thickness;
    }
    else
    {
        _307 = 0.0;
    }
    float normalizedHeight = _307;
    float shape = clamp((1.0 - normalizedHeight) * 1.11099994182586669921875, 0.0, 1.0);
    if (shape < 0.00999999977648258209228515625)
    {
        return vec3(0.0);
    }
    float thicknessFactor = clamp((thickness - 5.0) * 0.5, 0.0, 1.0);
    if (thicknessFactor < 0.00999999977648258209228515625)
    {
        return vec3(0.0);
    }
    float rimWidth = 1.5;
    float k = 0.88999998569488525390625;
    float x = sd / rimWidth;
    float rimFactor = 1.0 / (1.0 + ((k * x) * x));
    if ((rimFactor < 0.00999999977648258209228515625) || (lightIntensity < 0.00999999977648258209228515625))
    {
        return vec3(0.0);
    }
    vec2 normalXY = normal.xy;
    float mainLightInfluence = max(0.0, dot(normalXY, lightDirection));
    float oppositeLightInfluence = max(0.0, dot(normalXY, -lightDirection));
    float totalInfluence = mainLightInfluence + (oppositeLightInfluence * 0.800000011920928955078125);
    vec3 param = backgroundColor;
    float param_1 = 1.0;
    vec3 highlightColor = FLT_flutter_local_getHighlightColor(param, param_1);
    vec3 directionalRim = (((highlightColor * 0.699999988079071044921875) * (totalInfluence * totalInfluence)) * lightIntensity) * 2.0;
    vec3 ambientRim = (highlightColor * 0.4000000059604644775390625) * ambientStrength;
    vec3 totalRimLight = (directionalRim + ambientRim) * rimFactor;
    return (totalRimLight * thicknessFactor) * shape;
}

vec4 FLT_flutter_local_applyGlassColor(vec4 liquidColor, vec4 glassColor)
{
    vec4 finalColor = liquidColor;
    if (glassColor.w > 0.0)
    {
        float glassLuminance = dot(glassColor.xyz, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels. tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fragment shader compilation errors don't mention the file

2 participants