Skip to content

Fix GLES sampler precision issue for advanced pipeline #5466

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

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

Icenowy
Copy link
Contributor

@Icenowy Icenowy commented Jul 2, 2025

Currently we do not add precision description to sampler2D's, and the default precision defined by ESSL spec is lowp.

Experimentation on an Imagination AXM-8-256 GPU shows that the advanced pipeline needs highp sampler2D, otherwise some distant objects will glitch (noticable at the start point of black_forest map).

Manually add precision modifiers for sampler2D to fix the glitch.

Tested on Eswin EIC7700 with X11+EGL+GLES with Imagination DDK 23.2 driver.

P.S. setting mediump instead of highp on sampler2D's seems to be not enough for resolving the glitch; maybe hardwares w/o highp support need to be forbidden from advanced pipeline or some shaders need to be rewritten to be mediump-safe.

Agreement

By creating a pull request in stk-code, you hereby agree to dual-license your contribution as
GNU General Public License version 3 or any later version and
Mozilla Public License version 2 or any later version.

This includes your previous contribution(s) under the same name of contributor.

Keep the above statement in the pull request comment for agreement.

Currently we do not add precision description to sampler2D's, and the
default precision defined by ESSL spec is lowp.

Experimentation on an Imagination AXM-8-256 GPU shows that the advanced
pipeline needs highp sampler2D, otherwise some distant objects will
glitch (noticable at the start point of black_forest map).

Manually add precision modifiers for sampler2D to fix the glitch.

Tested on Eswin EIC7700 with X11+EGL+GLES with Imagination DDK 23.2
driver.

P.S. setting mediump instead of highp on sampler2D's seems to be not
enough for resolving the glitch; maybe hardwares w/o highp support need
to be forbidden from advanced pipeline or some shaders need to be
rewritten to be mediump-safe.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
@Alayan-stk-2 Alayan-stk-2 merged commit 01e9040 into supertuxkart:master Jul 2, 2025
21 checks passed
@Icenowy
Copy link
Contributor Author

Icenowy commented Jul 2, 2025

Re the P.S.: Looks like highp is core (instead of optional) to ESSL3.0, and as the whole advanced shader-based pipeline requires ESSL3.0, maybe the fallback mediump codepath isn't needed?

@Alayan-stk-2
Copy link
Collaborator

Re the P.S.: Looks like highp is core (instead of optional) to ESSL3.0, and as the whole advanced shader-based pipeline requires ESSL3.0, maybe the fallback mediump codepath isn't needed?

@deveee Do you know anything about that?

@deveee
Copy link
Member

deveee commented Jul 3, 2025

For GLES2 it uses only very simple irrlicht renderer (can be tested with force legacy device in config.xml). For shader-based pipeline it needs GLES3 for both enabled and disabled advanced lighting. And indeed it seems that highp is core feature and I probably added glGetShaderPrecisionFormat() just to be safe.

Btw there is also

    if (CVS->isGLSL())
        code << "#version 300 es\n";

and isGLSL() should be always true.

Maybe better change after release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants