Issue with gradient after skia upgrade to M91

29 views
Skip to first unread message

ahujab...@gmail.com

unread,
Oct 26, 2021, 12:16:00 PM10/26/21
to skia-discuss
Hi Guys,

we just updated to Skia M91( I know it's a little older version, we started long back and then had to pause due to some other work). We are noticing some issues with gradients in M91.  Some gradients are not rendering at all. On digging deep I found out one shader is failing with the below error.

"error: 9: function 'UnrolledBinaryGradientColorizer_Stage1_c0_c0_c1' can exit without returning a value\n1 error\n"

Have you guys seen anthing similar?? if not can you please point me the code where I should start digging?

Below is the complete generated shader code.

uniform float3x3 umatrix_Stage1_c0_c0_c0;uniform float4 uscale0_1_Stage1_c0_c0_c1;uniform float4 uscale2_3_Stage1_c0_c0_c1;uniform float4 uscale4_5_Stage1_c0_c0_c1;uniform float4 ubias0_1_Stage1_c0_c0_c1;uniform float4 ubias2_3_Stage1_c0_c0_c1;uniform float4 ubias4_5_Stage1_c0_c0_c1;uniform half4 uthresholds1_7_Stage1_c0_c0_c1;uniform half4 uthresholds9_13_Stage1_c0_c0_c1;in half4 vcolor_Stage0;in float vcoverage_Stage0;in float2 vTransformedCoords_0_Stage0;half4 LinearGradientLayout_Stage1_c0_c0_c0_c0(half4 _input) {
return half4(half(vTransformedCoords_0_Stage0.x) + 9.9999997473787516e-06, 1.0, 0.0, 0.0);
}

half4 MatrixEffect_Stage1_c0_c0_c0(half4 _input) {
return LinearGradientLayout_Stage1_c0_c0_c0_c0(_input);
}

half4 UnrolledBinaryGradientColorizer_Stage1_c0_c0_c1(half4 _input, float2 _coords) {
}

half4 TiledGradientEffect_Stage1_c0_c0(half4 _input) {
half4 t = MatrixEffect_Stage1_c0_c0_c0(_input);
if (!true && t.y < 0.0) {
    return half4(0.0);
} else {
    @if (true) {
        half t_1 = t.x - 1.0;
        half tiled_t = (t_1 - 2.0 * floor(t_1 * 0.5)) - 1.0;
        if (sk_Caps.mustDoOpBetweenFloorAndAbs) {
            tiled_t = clamp(tiled_t, -1.0, 1.0);
        }
        t.x = abs(tiled_t);
    } else {
        t.x = fract(t.x);
    }
    @if (!false) {
        return UnrolledBinaryGradientColorizer_Stage1_c0_c0_c1(_input, float2(half2(t.x, 0.0)));
    } else {
        half4 outColor = UnrolledBinaryGradientColorizer_Stage1_c0_c0_c1(_input, float2(half2(t.x, 0.0)));
        return outColor * half4(outColor.www, 1.0);
    }
}
}

half4 OverrideInputFragmentProcessor_Stage1_c0(half4 _input) {
return TiledGradientEffect_Stage1_c0_c0(false ? half4(0) : half4(1.000000, 1.000000, 1.000000, 1.000000));
}

void main() {// Stage 0, QuadPerEdgeAAGeometryProcessor
half4 outputColor_Stage0;outputColor_Stage0 = vcolor_Stage0;float coverage = vcoverage_Stage0;half4 outputCoverage_Stage0 = half4(half(coverage));half4 output_Stage1;output_Stage1 = OverrideInputFragmentProcessor_Stage1_c0(outputColor_Stage0);{ // Xfer Processor: Porter Duff
sk_FragColor = output_Stage1 * outputCoverage_Stage0;}}

Thanks
Bharat

Brian Osman

unread,
Oct 26, 2021, 1:36:31 PM10/26/21
to skia-d...@googlegroups.com
We haven't seen anything exactly like that, no. The code for building gradient shaders has changed a bit recently (but after M91, first landed in M93). We did see some changes at one point where the gradient logic would choose a particular technique based on the original number of color stops, then realize it could collapse some of the (identical) color stops down, and end up using an inappropriate (or even incorrect) technique as a result. This could be something similar, but it still wouldn't fully explain it, because...

At M91, the code for generating the body of that shader function lives in src/gpu/gradients/generated/GrUnrolledBinaryGradientColorizer.cpp. onEmitCode is supposed to generate the body of that function - the actual code it generates varies depending on the number of intervals (related to the number of color stops), but in all cases, it should be emitting *something*.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/dfbba632-86e1-46dc-bb7e-600d944fa4d9n%40googlegroups.com.

ahujab...@gmail.com

unread,
Oct 26, 2021, 2:36:41 PM10/26/21
to skia-discuss
This is only happening in ship builds. I suspect may be an issue with the build environment on my end.

Thanks so much for starting pointers. I'll dig more into emitCode and reach out if I need more help.

Thanks
Bharat
Reply all
Reply to author
Forward
0 new messages