You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Impeller] Make IPComputeConical not crash older GLES drivers. #163580
The IPComputeConicalT is extremely complicated, and is crashing the shader compiler of older Adreno GPU. We need to simplify this function, and get it working. Some ideas:
Lift out special cases for radial + strip. We should be able to detect this in the contents and use the radial gradient shader, or a different kind of shader if need be.
Replace branching with mix. Yes, in theory we don't need to do this any more. In practice, some older shader compilers choke on too many nested if statements.
Compute more values in the contents. For example, I believe is_focal_on_circle is computed entirely from uniform values, et cetera. Maybe is_well_behaved ?
The other shader that is failing on the Nexus 5 is ConicalGradientUniformFill. I've been unable to find a way to get that to work.
ConicalGradientUniformFill links if I comment out all of IPComputeConicalT. But if I leave in any of the branching based on radial and strip then the Adreno shader compiler crashes during glLinkProgram.
I suspect for ConicalGradientUniformFill its due to the uniform array being too large. We should see if we can get the limits stuff working and then turn the size down a bit.
I suspect for ConicalGradientUniformFill its due to the uniform array being too large. We should see if we can get the limits stuff working and then turn the size down a bit.
That tracks. I think the adreno 330 has a UBO size of 4k bytes. The vec4 colors[256] field is that big alone.
Jason has stated in chat that he tried to comment out the fields in FragInfo and it didn't seem to get rid of the linking crash on the nexus 5. So, this is unlikely related to the ubo size. I also found Qualcomm documentation that seems to suggest 7372 bytes is a good limit.
Jason stated that it's something about IPComputeConicalT in particular that is freaking out the compiler.
If that is the case then at a minimum we need to slip into two shaders (radial/strip) and (regular/strip) for GLES. The updated graphite shader has the same amount of branching.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
jonahwilliams commentedon Feb 19, 2025
I think the check for is_swapped can also be lifted out, we can apply the swap ourselves...
jonahwilliams commentedon Feb 24, 2025
Ignore all of this, and lets just update the shader: https://github.com/google/skia/blob/main/src/sksl/sksl_graphite_frag.sksl#L851-L895
[-][Impeller] Simplify IPComputeConicalT.[/-][+][Impeller] Make IPComputeConical not crash older GLES drivers.[/+]gaaclarke commentedon Feb 24, 2025
Notes from @jason-simmons
jonahwilliams commentedon Feb 24, 2025
I suspect for ConicalGradientUniformFill its due to the uniform array being too large. We should see if we can get the limits stuff working and then turn the size down a bit.
gaaclarke commentedon Feb 24, 2025
That tracks. I think the adreno 330 has a UBO size of 4k bytes. The
vec4 colors[256]field is that big alone.gaaclarke commentedon Feb 24, 2025
If the ubo size is a problem there are more shaders that break the 4k limit:
Maybe 6192 is the limit?
jonahwilliams commentedon Feb 24, 2025
IIRC each of the float uniform values (radius, tile_mode) is actually taking up a full vec4. You can sort of fix this by manually packing them:
Becomes
That and we could always drop a few array values. 256 is already pretty massive and we still have teh texture fallback.
gaaclarke commentedon Feb 24, 2025
We could conditionally make it smaller for opengles too. Shaderc allows you to define your own preprocessor macros which could be handy.
jonahwilliams commentedon Feb 24, 2025
This is an opengl only shader. So no need to get fancy.
gaaclarke commentedon Feb 24, 2025
Jason has stated in chat that he tried to comment out the fields in FragInfo and it didn't seem to get rid of the linking crash on the nexus 5. So, this is unlikely related to the ubo size. I also found Qualcomm documentation that seems to suggest 7372 bytes is a good limit.
Jason stated that it's something about
IPComputeConicalTin particular that is freaking out the compiler.jonahwilliams commentedon Feb 24, 2025
@gaaclarke yeah I think the fix is probably to replace the very complicated conical we use now with something closer to https://github.com/google/skia/blob/main/src/sksl/sksl_graphite_frag.sksl#L851-L895
gaaclarke commentedon Feb 24, 2025
Jason has provided further information that the compiler crashed when the function was reduced to just its branching:
jonahwilliams commentedon Feb 24, 2025
If that is the case then at a minimum we need to slip into two shaders (radial/strip) and (regular/strip) for GLES. The updated graphite shader has the same amount of branching.
Added compilation failure if a max ubo size is exceeded (#164038)
Split up the conical gradient fragment shader (#164058)
github-actions commentedon Mar 14, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.