Skip to content

[pull] master from libretro:master#984

Merged
pull[bot] merged 4 commits intoAlexandre1er:masterfrom
libretro:master
May 1, 2026
Merged

[pull] master from libretro:master#984
pull[bot] merged 4 commits intoAlexandre1er:masterfrom
libretro:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 1, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

The gl3 (glcore video driver) shader fallback selector and dispatcher
both had RARCH_SHADER_CG arms, but those branches were unreachable
in any build configuration:

1. The Cg fallback in gl3_get_fallback_shader_type gates on
   GFX_CTX_FLAGS_SHADERS_CG.  No context driver ever sets that
   flag when the active video driver is "glcore" -- audited
   x_ctx.c:1106-1116, wgl_ctx.c:778-788, drm_ctx.c, drm_go2_ctx.c,
   orbis_ctx.c, switch_ctx.c, wayland_ctx.c, xegl_ctx.c (eight
   context drivers, all of which the glcore branch advertises only
   SHADERS_SLANG).  The Cg flag is only set by ps3_ctx (which uses
   the rsx driver, not glcore) and by the legacy / non-Core branch
   of x_ctx and wgl_ctx (gated on !core_hw_context_enable, so only
   for the gl driver, not glcore).

2. Even if the gating were bypassed, gl_cg_backend in
   shader_gl_cg.c uses cgGLEnableProfile / cgGLBindProgram /
   cgGLEnableClientState et al.  These rely on the legacy ARB
   asm program pipeline (GL_VERTEX_PROGRAM_ARB style) which is
   removed from Core Profile contexts.  NVIDIA's Cg runtime hasn't
   been updated since 2012 and has no Core Profile support.

Remove:
 - the RARCH_SHADER_CG case in gl3_get_fallback_shader_type
 - the RARCH_SHADER_CG case in gl3_shader_driver_set_backend
 - HAVE_CG from the function-level guard
 - the now-unused 3rd loop iteration (the cycle is GLSL <-> SLANG)

The fallback chain becomes a 2-element cycle: GLSL falls back to
SLANG and vice versa, matching what the gating actually allows.

Add a comment at the top of gl3_get_fallback_shader_type explaining
the gl3-vs-Cg situation so future readers don't reintroduce the dead
arm.  No behaviour change on any build: HAVE_CG was defined for some
Windows builds, but the gates above already prevented those branches
from executing.
The comment added in 276e4bc said gl3 'only ever advertises slang via
spirv-cross', which overstated things.  Context drivers do only
advertise SLANG for glcore, but the gl3 fallback selector itself
accepts both GLSL and SLANG as first-class types -- and 42aa9fd just
made GLSL a valid GL3_DEFAULT_SHADER_TYPE on builds without slang.

Reword the comment to be specific about what is and isn't dead:
  - Cg is dead (no context flag, ARB asm pipeline incompatible with
    Core Profile)
  - GLSL is alive (Core-compatible API surface, kept as fallback for
    no-slang builds)
  - Slang is the practical default

No code change.
@pull pull Bot locked and limited conversation to collaborators May 1, 2026
@pull pull Bot added the ⤵️ pull label May 1, 2026
@pull pull Bot merged commit a340c70 into Alexandre1er:master May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant