Skip to content

gfx: raw raster, CSF, texture inlet, ISF source and OpenGL multiview fixes - #2424

Open
jcelerier wants to merge 8 commits into
masterfrom
split/gfx-engine-fixes
Open

jcelerier wants to merge 8 commits into
masterfrom
split/gfx-engine-fixes

Conversation

@jcelerier

Copy link
Copy Markdown
Member

Independent fixes in the graphics engine, each with its test, and one fix to the test fixture. None depends on the others.

  • Raw rasters asking for more than the device allows (output size, layer counts, storage images) failed to allocate and rendered nothing. They are now clamped to QRhi's TextureSizeMax / TextureArraySizeMax, with a warning at creation.
  • PER_CUBE_FACE, PER_LAYER and PER_MIP passes render into targets that have depth, but their pipeline was built as if there were none. DEPTH_COMPARE never ran, and faces were resolved by draw order.
  • CSF: a {"TYPE": "cubemap"} resource was never declared in the generated GLSL. Also, with a PERSISTENT image and a write-only image in the same shader, the write-only image's outlet showed the persistent one.
  • inlet.textureMipmapMode = 1 (or "Linear") threw from scripts: nothing converted numbers or names to a texture inlet's optional sampler settings.
  • A multiview raw raster vertex shader that stores gl_ViewIndex in an int failed on OpenGL. test_gfx_multiview and test_gfx_cube_face_orientation failed on master for this reason.
  • Score.createProcess(itv, "ISF Shader", source) created a process that rendered nothing, because the ISF process took its init string as a file path only.
  • GUI tests running in parallel shared one XDG_CONFIG_HOME and read and wrote each other's settings.

Commits

  • f1e9105bf3 tests: a per-process settings directory. Each test process works in a directory of its own below test-home/config, removed when it exits. A test that chose its own XDG_CONFIG_HOME keeps it, and child score processes inherit the new one. A directory left behind by a crashed test stays in test-home.
  • 21c304eff6 raw raster: clamp sizes and layer counts to the device limits. Each axis is clamped on its own. Storage images declared in INPUTS (raw raster, ISF, CSF) clamp their array layers and 3D depth the same way. The per-layer and per-mip loops iterate the clamped count.
  • c174969bf6 raw raster: iterated passes have depth
  • 89720bf136 csf: cubemap resources, and LOD sampling in compute shaders. The resource becomes a texture input with its cube flag, declared as samplerCube (a depth cubemap is refused). Compute shaders have no implicit derivatives, so the compute prelude gains IMG_NORM_PIXEL_LOD (with its PREMULTIPLIED and ISF_STRAIGHT forms) and IMG_CUBE_LOD. The fragment prelude gains IMG_CUBE_LOD too.
  • ecc671a2d8 csf: a write-only image after a PERSISTENT one shows its own content. A pass bound to an output image of its own keeps it on the ping-pong swap and on resize.
  • 58f32c2441 gfx: texture inlet settings convert from script values. The converters are registered by a static initialiser of the gfx library, so they exist even when the plug-in object is not created (as in tests of a dynamic build). A negative, non-finite or out-of-range number, an empty string, or "Auto" clears the setting. The format converter that the JS plug-in registered itself is removed.
  • 772edae204 libisf: gl_ViewIndex used as an int compiles on OpenGL. The vertex prelude redefines gl_ViewIndex as int(uint(gl_ViewIndex)), because SPIRV-Cross writes it as the uint gl_ViewID_OVR.
  • 46d988c7be gfx: an ISF process created from inline source runs it. A string that starts with the ISF header comment is compiled as the shader, and anything else is still a path. Source is told from a path by a newline, or by /* followed by { past whitespace, so a header written as /* then { on the next line, or after a comment line, is found too.

Tests

  • New test_gfx_raw_raster_size_clamp: an oversized aux storage image is clamped to the device limit.
  • New test_gfx_cube_face_implicit_depth: a PER_CUBE_FACE pass without a depth output depth-tests every face and honours DEPTH_COMPARE (corpus rr-cube-depth-implicit*).
  • New test_gfx_csf_resource_fixes: the write-only-after-PERSISTENT case and a TYPE cubemap resource (corpus csf-*).
  • New test_gfx_texture_port_converters and test_gfx_texture_port_converters_at_load. The second runs in a process of its own, so no other test registers the converters first.
  • New test_gfx_process_isf_inline_source: an ISF process created from source compiles it, and one created from a path loads the file.
  • test_unit_isf_header_validation now expects a cube texture_input instead of cubemap_input.
  • test_gfx_multiview and test_gfx_cube_face_orientation pass on OpenGL with the libisf fix.
  • The whole series was built and tested with ctest on Linux (Xvfb, lavapipe Vulkan and Mesa OpenGL). Nothing failed beyond master's own known failures (test_gfx_shader_corpus_targets, test_gfx_window_layout, test_threedim_ply_fingerprint, test_unit_miniaudio_alsa and the few others master's run lists).

Notes for review

  • Behaviour change in c174969bf6: shaders that leave DEPTH_TEST unset now depth-test their iterated passes with GREATER against a cleared 0, as their single passes already did. A fragment at window depth exactly 0 is dropped. Every corpus shader either sets DEPTH_TEST or draws in front of 0.
  • A shader that defined IMG_NORM_PIXEL_LOD or IMG_CUBE_LOD itself with another body now gets a redefinition error.
  • The test-fixture commit (f1e9105bf3) is not a gfx change and could go on its own. It changes the environment of every GUI test.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj

jcelerier and others added 8 commits November 25, 2026 10:28
ctest gives every test the same XDG_CONFIG_HOME (test-home/config), so GUI
tests running in parallel read and wrote each other's settings. A test
process now settles in a directory of its own below it, removed when it
exits; a test that picked its own XDG_CONFIG_HOME keeps it, and child
score processes inherit the new one. A directory left behind by a crashed
test stays in test-home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj
A raw raster asking for more than the device allows failed to allocate and
rendered nothing. Its output size, its layer counts and its storage images
are now clamped to QRhi's TextureSizeMax and TextureArraySizeMax, with a
warning at creation saying that the shader sees the smaller image; the
per-layer and per-mip loops iterate the clamped count. Storage images
declared in INPUTS (raw raster, ISF, CSF) clamp their array layers and
3D depth the same way. Each axis is clamped on its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj
A PER_CUBE_FACE, PER_LAYER or PER_MIP pass renders into per-face (or
per-layer, per-mip) render targets that all carry a depth attachment, but
its pipeline was built as if there were none, so the depth test of the
shader's DEPTH_COMPARE never ran and faces were resolved by draw order.
The pipeline now sees that depth, as a single pass already did.

A behaviour change for shaders that leave DEPTH_TEST unset: their
iterated passes now depth-test with GREATER against a cleared 0, like
their single passes, so geometry is resolved by depth and a fragment at
window depth exactly 0 is dropped. Every corpus shader either sets
DEPTH_TEST or draws in front of 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj
A {"TYPE": "cubemap"} RESOURCE of a compute shader was never declared in
the generated GLSL, so a CSF could not read a cube. It now becomes a
texture input with its cube flag set, as the compute renderer binds
those, declared as a samplerCube (a depth cubemap is refused with a
message); the header test expects that type instead of cubemap_input. Compute shaders
have no implicit derivatives, so the compute prelude gets IMG_NORM_PIXEL_LOD
(and its PREMULTIPLIED and ISF_STRAIGHT forms) and IMG_CUBE_LOD, and the
fragment prelude gets IMG_CUBE_LOD too. A shader that defined these names
itself with another body now gets a redefinition error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj
With a PERSISTENT image and a write-only one in the same compute shader,
the graphics pass that shows the write-only image's outlet was re-pointed
at the persistent image after the ping-pong swap, the persistent image
being the fallback output texture: the 'result' outlet showed 'state'. A
pass bound to an output image of its own now keeps it, on the swap and on
a resize.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj
`inlet.textureMipmapMode = 1` (or "Linear") threw "Cannot assign int to
std::optional<texture_filter>": nothing converted a number or a name to a
texture inlet's optional sampler settings. The gfx library now registers,
when it is loaded (a static initialiser, so whether or not the plug-in
object is made, as in the tests of a dynamic build), the int / double /
string conversions to the optional filter, address mode and format; a negative, non-finite or out-of-range
number, an empty string or "Auto" clears the setting. The format
conversion the JS plug-in registered on its own goes, since texture
inlets only exist with the gfx plug-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj
A multiview raw raster vertex shader that stores gl_ViewIndex in an int
failed on OpenGL with "uint cannot be assigned to int": SPIRV-Cross
writes the built-in as gl_ViewID_OVR, which is a uint. The generated
vertex prelude now redefines gl_ViewIndex as int(uint(gl_ViewIndex)),
which changes nothing for GLSL itself and gives the GL output an int.
test_gfx_multiview and test_gfx_cube_face_orientation failed on master
for this reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj
The ISF process took its init string as a file path only, so
Score.createProcess(itv, "ISF Shader", source) created a process that
silently rendered nothing. A string starting with the ISF header comment
is now compiled as the shader itself; anything else is still a path.

Source is told from a path by a newline, or by a /* followed by { past
whitespace, so a header written /*\n{ or after a comment line is found
too. Tested with those layouts and with a path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgufk1W2MBbpcjraruZq

This branch is waiting to be deployed

1 waiting deployment
full-ci — 46d988c7 Waiting Nov 25, 2026 by jcelerier via Approve full PR suite #13
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.

1 participant