-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix glsl shader for Android Mali-GXXx GPUs and Vulkan API 1.3.xxx #92817
Conversation
1658a3d
to
bf06a1d
Compare
767facd
to
7fea028
Compare
I have taken a close look at this and have reached out to ARM engineers for assistance. This is clearly an ARM driver bug that only impacts newer Mali devices. To fix #86621, we only have to make the change in It seems the problem actually comes from the ARM is taking a look as it seems this is reproducible in newer driver versions (I confirmed in driver version 46.0.0). They may be able to help us identify a more elegant workaround. I think we should wait to hear back from them as the current workaround will have a performance impact as it emits many more instructions including branches. Ideally, we should be able to workaround the bug with something much less intrusive. |
An update on this. ARM has confirmed that the internal shader compiler is replacing the I have asked if they know of a better workaround |
A few days ago I tried it without the //BUG
// GLSL Docs: clamp returns the value of x constrained to the range minVal to maxVal.
// The returned value is computed as min(max(x, minVal), maxVal).
uv_interp = min(max(gl_Position.xy, vec2(0.0, 0.0)), vec2(1.0, 1.0)) * 2.0; |
I tried the same. ARM confirmed it results in the same code as |
Should we wait longer?
I could also solve without Bunnymark on Adreno 650 (3y old device), GLES3 commits canvas.glsl Details
I ran 2 tests for each:
I think that the performance improvements or deteriorations will not be measurable because |
I tested this PR (rebased on latest |
Let's do this for now. I suspect this will slightly harm performance of those shaders on modern devices. However, as you pointed out, each of those shaders run at most a few times per frame, so the overall performance impact would be minimal. I would like to find a more elegant workaround in the future. But we should solve this for 4.3. So please go ahead and apply your fix directly to Glow, DoF Blur, and Rendering Scale 3D and I think Tonemap.glsl needs it as well Also, for context, we are still waiting to hear back from ARM. But we can't hold off the release while we wait, so it is best to go forward with a known workaround in the meantime |
7fea028
to
d9d1159
Compare
servers/rendering/renderer_rd/shaders/effects/bokeh_dof_raster.glsl
Outdated
Show resolved
Hide resolved
d9d1159
to
78ede4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you.
Let's go with this workaround for 4.3 and then hopefully do something else once we have a different workaround
Thanks! |
For posterity, ARM has confirmed that this is a driver bug (now fixed in r51) and using branches as we did is the best workaround. The alternative is to use a uniform buffer to store the position array |
Fixes #86621
Issue #73384 maybe only partially, not 3D on
PowerVR Rogue
GPUs commentTest on Firebase
Test Project: GlowTest.zip
rendering/scaling_3d/scale
= 0.5web-build_20240606_x988_panther-33-en_US-portrait_video.mp4