Files
Joe MattielloandClaude Opus 5.5 5d2ea0b8c5 fix(app): crt-geom and other arrays-of-arrays shader presets on macOS; GLSL at the context's version (#963)
* fix(app): explain and grey out arrays-of-arrays shader presets on macOS

crt-geom failed on macOS with "extension 'GL_ARB_arrays_of_arrays' is not
supported". Its mask code declares 2-D arrays (vec3 slotmask[3][4]).
SPIRV-Cross generates GLSL below 4.30 for such a shader by requiring that
extension unless flatten_multidimensional_arrays is set, and librashader
0.12 never sets that option. macOS stops at OpenGL 4.1 without the
extension, so no GLSL version the app can ask for builds these presets
there.

Rendering all 498 bundled presets on macOS (M4 Max, GL 4.1 Metal) found
15 that fail this way: crt-geom/-deluxe/-tate, crt-hyllian x4, crt-nobody,
crt-super-xbr, vt220, crt-fast-bilateral-super-xbr, img_mod,
test-pattern-append/-prepend and res-independent-scanlines.
presetsNeedingArraysOfArrays() lists them, pinned to the bundled
slang-shaders commit.

- ShaderChain::probeGlCaps() reads the GL version and extensions once
  (from VideoOut::init, and from render()).
- When the context has neither GL 4.3 nor the extension, the preset list
  greys these out with the reason. Choosing one anyway (config.ini, file
  dialog) now shows "it needs OpenGL 4.3 (arrays of arrays); this system
  has OpenGL 4.1" instead of the GL compiler's text. The full error stays
  in lastError().
- shaders_bundled checks that every list entry is a valid bundled preset.
  shaders_gl renders each one and requires a clean, explained failure
  where the capability is missing and a picture where it is present, so
  the list cannot go stale silently. This replaces the crt-geom strstr
  exemption.
- Documented in app/packaging/README.md (macOS notes) and app/README.md.
  app/shaders/README.txt no longer says slang-shaders is not bundled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(app): generate shader GLSL at the context's version, not 3.30

The GL chain always asked librashader for GLSL 3.30. A context with more
was still handed 3.30 code, so presets using GLSL 4.00 features
(textureGather with a component, packUnorm4x8, bitCount/findLSB) failed
to build. ShaderChain::probeGlCaps() now records the context's version,
clamped to 330..460, and the chain uses it.

On macOS (M4 Max, GL 4.1 Metal), rendering all 498 bundled presets at 4.10
instead of 3.30 took 462 working presets to 473. lottesRVM, nnedi3 x5,
mmpx-ADV and vectorscale x4 now build and produce a picture, and no preset
that worked stopped working. Linux and Windows contexts will usually get
4.60. No sweep has been run there, and CI does not run shaders_gl on a
real GL context.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-15 01:06:38 -04:00
..

First-party presets that ship with the app (copied next to the executable as
shaders/).  They are original to this project and GPL-licensed with the rest of
the repository.

  vj-sharp-bilinear.slangp   crisp scaling at non-integer window sizes
  vj-scanlines.slangp        scanlines + optional RGB mask, with parameters

slang-shaders/ (when present) is an unmodified subset of RetroArch's
https://github.com/libretro/slang-shaders, fetched at build time; every shader
keeps its own licence (see slang-shaders/NOTICE-virtualjaguar.txt).  For the rest
of the collection, point Settings > Video > Preset folder at a clone of it.

macOS: OpenGL stops at 4.1 there, so presets that need OpenGL 4.2/4.3 features
(CRT-Geom, CRT-Hyllian and a few more: arrays of arrays) cannot compile.  The
preset list greys them out; the plain picture is shown if one is chosen anyway.