runtime: forward mixed clip and cull distances in the fallback geometry shader #2304

Open
github-bot wants to merge 7 commits from github-bot/gh-2304 into main AGit
Owner

@⁠ecox982745 on GitHub · 2026-11-26 13:17 UTC · original
ecox982745:reviewed-bary-mixed-distances → main · +2798 −103 · 23 files · 7 commits · draft

Claimed in the coordination issue as RT-BARY-FALLBACK-MIXED-DISTANCES.

Depends on: #1930 (which builds on #1426).

What changed

The fallback geometry shader now forwards both ClipDistance and CullDistance when a vertex shader writes both arrays. Each array keeps its own length. This allows the rasterizer to clip part of a primitive and to cull a whole primitive.

ZroIsHere wrote the implementation and CPU test in mrgenty/leonida#1. This draft brings that work upstream at the request of the #1930 author. The published head is the original commit 096a26220. Review the two-file change.

Verification

I reapplied the original commit locally on top of the updated #1930 head 682de2894. The resulting commit fcbc57c0d has a byte-identical two-file diff and merges cleanly with main at 73516a290.

  • The stock CPU generator test passed on the rebased commit. All ten generated SPIR-V modules passed spirv-val --target-env vulkan1.2.
  • I repeated 44 synthetic Vulkan draws on an NVIDIA GeForce RTX 4090 (Windows 11, driver 616.64). All 22 pairs matched the direct vertex-to-fragment path byte for byte across 90,112 RGBA32F pixels. The cases used clip/cull lengths of (1,1), (2,1), (1,2), and (4,4) and covered both partial clipping and whole-primitive culling. The validation layer reported zero errors. Earlier hardware run on the published commit.
  • The project’s game-data check on the two changed files and git diff --check both passed. All fixtures were synthetic.

Integration status

The public draft still points to 096a26220. GitHub rejected the rebased branch update because the dependency now includes upstream CI workflow changes and the connected OAuth app lacks the workflow scope. The fallback change itself touches only the runtime shader builder and its test. For the latest verified integration, cherry-pick 096a26220f onto #1930 at 0b7532951f, then merge main at d1dff7949b. The resulting tree is ff32b57406. Combined shader tests and RTX 4090 readbacks. This draft is waiting on #1930 and publication of the rebased head.

AI-assisted: Yes. The original author disclosed AI assistance. OpenAI Codex (GPT-6) performed independent hardware verification, prepared the rebase and submitted the upstream draft.

**@⁠ecox982745** on GitHub · 2026-11-26 13:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2304) `ecox982745:reviewed-bary-mixed-distances` → `main` · +2798 −103 · 23 files · 7 commits · draft Claimed in the coordination issue as [RT-BARY-FALLBACK-MIXED-DISTANCES](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608). Depends on: #1930 (which builds on #1426). ### What changed The fallback geometry shader now forwards both `ClipDistance` and `CullDistance` when a vertex shader writes both arrays. Each array keeps its own length. This allows the rasterizer to clip part of a primitive and to cull a whole primitive. ZroIsHere wrote the implementation and CPU test in [mrgenty/leonida#1](https://github.com/mrgenty/leonida/pull/1). This draft brings that work upstream at the [request of the #1930 author](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1930). The published head is the original commit `096a26220`. [Review the two-file change](https://github.com/mrgenty/leonida/pull/1/files). ### Verification I reapplied the original commit locally on top of the updated #1930 head `682de2894`. The resulting commit `fcbc57c0d` has a byte-identical two-file diff and merges cleanly with main at `73516a290`. - The stock CPU generator test passed on the rebased commit. All ten generated SPIR-V modules passed `spirv-val --target-env vulkan1.2`. - I repeated 44 synthetic Vulkan draws on an NVIDIA GeForce RTX 4090 (Windows 11, driver 616.64). All 22 pairs matched the direct vertex-to-fragment path byte for byte across 90,112 RGBA32F pixels. The cases used clip/cull lengths of (1,1), (2,1), (1,2), and (4,4) and covered both partial clipping and whole-primitive culling. The validation layer reported zero errors. [Earlier hardware run on the published commit](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1930). - The project’s game-data check on the two changed files and `git diff --check` both passed. All fixtures were synthetic. ### Integration status The public draft still points to `096a26220`. GitHub rejected the rebased branch update because the dependency now includes upstream CI workflow changes and the connected OAuth app lacks the `workflow` scope. The fallback change itself touches only the runtime shader builder and its test. For the latest verified integration, cherry-pick `096a26220f` onto #1930 at `0b7532951f`, then merge main at `d1dff7949b`. The resulting tree is `ff32b57406`. [Combined shader tests and RTX 4090 readbacks](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2304). This draft is waiting on #1930 and publication of the rebased head. AI-assisted: Yes. The original author disclosed AI assistance. OpenAI Codex (GPT-6) performed independent hardware verification, prepared the rebase and submitted the upstream draft.
Those pixel shaders were refused under both fallbacks, so the shaders stage stopped on a geometry-capable GPU without fragmentShaderBarycentric. The barycentric fallback now supplies the three vertex values, and make_game selects it there.

Co-authored-by: Cursor <[email protected]>
When a translated pixel shader carries `"bary_fallback_input": {"location": N}`
in `spirv/index.json` (`rdna2spirv.py --bary-fallback` for GPUs without
`VK_KHR_fragment_shader_barycentric`), `PipelineState::create_graphics` now
synthesizes the triangle pass-through Geometry SPIR-V 1.5 module in memory
(`leonida::build_bary_fallback_gs` in `runtime/src/spirv_bary_fallback.h`)
after `--f16-interp-fallback` VS/PS location linking:

- Parses `bary_fallback_input.location` in `ShaderLibrary::load_index` into
  `ShaderEntry::bary_fallback_location`.
- Copies `BuiltIn Position` and every `vec4<f32>` `Location` input read by the
  PS (other than `bary_location`) that the VS exports, while zero-filling any
  unexported PS `Location` input without declaring a dangling GS `Input` and
  leaving unread VS outputs unconsumed (`VUID-RuntimeSpirv-OpEntryPoint-08743`).
- Forwards a VS `BuiltIn ClipDistance` or `BuiltIn CullDistance` `float[1..8]`
  array (checking `shaderClipDistance` / `shaderCullDistance`), and emits
  `(1, 0, 0)`, `(0, 1, 0)`, `(0, 0, 1)` at `bary_location` across the 3 strip
  vertices so perspective interpolation matches `BaryCoordKHR`.
- Supports both eager and lazy graphics pipeline builds (`StageSource::bary_fallback`
  in `stage_words`), clamps `--f16-interp-fallback` `top_location` against
  `maxGeometryInputComponents` / `maxGeometryOutputComponents`, and refuses
  mesh PSOs, explicit GS or rectangle-list stages, missing `geometryShader`, or
  non-triangle topologies with clear HRESULTs (`E_NOTIMPL` / `E_INVALIDARG`).
- Adds `spirv_bary_fallback` (portable CPU test) and `d3d12_bary_fallback`
  (end-to-end Vulkan GPU D3D12 PSO test).

Claim: RT-BARY-FALLBACK-PSO
AI-assisted: yes (Antigravity)
# Conflicts:
#	docs/design.md
A pixel shader with a computed I/J pair, translated with --bary-fallback, reads the pair's attribute as a Flat
vec4[3] at the first of three locations its index entry gives under bary_fallback_input.per_vertex. The runtime's
geometry-stage builder read only bary_fallback_input.location and refused that input ("PS pass-through Input at
Location 0 is not vec4<f32>"), so such a PSO was never created.

- shader_library.h: parse per_vertex (attribute -> first location) into ShaderEntry::bary_fallback_per_vertex; one
  malformed entry drops the whole map.
- spirv_bary_fallback.h: build_bary_fallback_gs takes the map and writes the triangle's three values of each mapped
  VS output to the PS's Flat vec4[3] (element k = vertex k, the same at every emitted vertex), as
  tools/bary_fallback_gs.py does. An attribute the VS does not export is zero-filled. A vec4[3] the map does not
  name, a block that runs into another input or the barycentric location, and two attributes at one first location
  are refused. The old signature stays as a wrapper with an empty map.
- d3d12_vulkan_device.cpp: both call sites (eager and lazy) pass the entry's map.
- Tests: spirv_bary_fallback (five per-vertex cases), shader_library (twelve per_vertex parsing cases),
  d3d12_bary_fallback (two draws of a synthetic computed-I/J PS and one refusal).
- docs/design.md: the runtime builder in the "Barycentric fallback" row, with what was and was not checked.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:20:38 +00:00
Author
Owner

@⁠wavehs on GitHub · 2026-11-26 19:12 UTC · original · reviewed

macOS arm64 check of #2304 (RT-BARY-FALLBACK-PER-VERTEX). A translator rule, a Python geometry-shader builder and the runtime builder; the branch is far behind and does not apply to main, so what I could verify is the translator half and the generated modules.

Tested head 096a26220 (7 commits, 3 of them merges of main from when the branch was current), 533 commits behind main bdbc7e923.

It does not apply to main any more. git merge-tree --write-tree ubi/main 096a26220 exits 1 with conflicts in docs/design.md, runtime/shims/d3d12_vulkan_device.cpp, runtime/test/vk_test_device.h and tools/vk_subgroup_info.py. The branch's own diff against its merge-base (b0f3d3998, 533 commits back) fails git apply --check on main in those four plus docs/testing.md and tests/test_vk_subgroup_info.py. So a rebase is needed before CI can run it; I tested two things that can be separated:

  1. The translator half transplanted onto main (tools/rdna2spirv.py, tools/bary_fallback_gs.py, tests/semantic/support.py, tests/semantic/test_interp_computed_ij.py, tests/test_shader_build_fallbacks.py, tests/test_run_gpu_tests.py, scripts/run_gpu_tests.py applied by patch -p1, clean).
    • tests/semantic/test_interp_computed_ij.py: 28 tests, OK - including the ComputedIJBaryFallback cases that compare every computed form against the PerVertexKHR path and the geometry shader's own spirv-val.
    • Whole semantic suite: 500 files / 6,373 tests / 0 files failed (main is 500 / 6,367, so the change adds 6 cases and breaks none).
    • tests/test_shader_build_fallbacks.py: 3 failures, tests/test_run_gpu_tests.py: 2 failures - not defects of the rule: they assert the build-side wording and selection that live in the runtime/make_game half, which I did not transplant (e.g. the test expects per-vertex inputs where main prints computed I/J pairs need PerVertexKHR inputs). They are a reminder that the whole PR has to be rebased before those suites mean anything.
  2. The branch tree as-is on this machine, to exercise the generator end to end. Built the macOS harness from 096a26220 (vk_compute_test, vk_store_test, vk_harness) and ran the project's own runner with LEONIDA_BARY_FALLBACK=1 and KosmicKrisp:
    • 274 shaders: 274 translated, 274 pass spirv-val.
    • Five fallback geometry shaders built: ps_bary, ps_ij_computed, ps_persp_bary, ps_scc_mask32, ps_uniform_branch (<name>.bary_gs.spv). Each passes spirv-val --target-env vulkan1.2 independently (the builder already validates them; I re-ran the check on the artefacts of this run).
    • Suite: 158/264 passed, 72 skipped; the five GS fixtures report SKIP (unsupported: no geometryShader). That is the honest outcome on this device.

What this GPU cannot verify, and why it matters. vk_subgroup_info.py reports geometry_shader: false, per_vertex_inputs: false, barycentric_fallback: false for KosmicKrisp on an Apple M3 Pro: Apple GPUs have no geometry stage, so the pass-through GS this PR adds cannot be created here at all. The design row already lists "a GPU that needs the fallback" as unverified; this machine needs the fallback but cannot run it, so it does not close that gap. What I can say positively: under --bary-fallback every fixture translates, the PS values of the computed-I/J forms match the PerVertexKHR path in the mini interpreter, and all five generated GS modules are valid Vulkan 1.2 SPIR-V.

Review of the rule as far as it can be read

  • Location allocation cannot collide: assemble() rents three consecutive free locations per per-vertex attribute, excluding the attribute's own location, and rejects a block that overlaps any other input (tools/rdna2spirv.py:15798-15808); the loop's search bound len(taken) + 3 is always enough because at most len(taken) of its candidates can be taken. The index keeps the attribute number in inputs for those attributes (:19199) and records the block under bary_fallback_input.per_vertex (:19206), which is what both the Python GS builder and the runtime builder consume.
  • The GS writes vertex k's value into element k at every emitted vertex, so the flat array is order-independent, as the docstring says; the PS then weights P0 + I·(P1−P0) + J·(P2−P0) with its own I/J.
  • --f16-interp-fallback plus --bary-fallback (the Pascal combination) is covered by the new semantic cases; the 16-bit reads decode the raw words of the array rather than the producer's halves, which is the only consistent choice since there are no halves on that path.

Findings

  1. Rebase needed (same commit as the last one I saw for it): the file list above; runtime/src/arena_blocks.h and runtime/shims/d3d12_vulkan_device.cpp have moved under it, and tools/vk_subgroup_info.py now conflicts, so the automatic fallback selection changes need re-checking against main's version after the rebase.
  2. No macOS-executable verification of the new path. Stated above so nobody reads this as a green run: the fixture that would draw it skips on this device. A Linux run on a driver with geometry shaders but no VK_KHR_fragment_shader_barycentric (or Pascal) remains the way to execute it; the author already reports such a check on a GTX 1060.
  3. Small operational note: with the fallback forced on a device without a geometry stage, run_gpu_tests.py --require-pass exits 1 with no GPU tests passed because the only fixture skipped. That is the runner's contract, but a first-time user on Apple Silicon may read it as a failure; a line in the message when the skip is no geometryShader would explain it.

python -I scripts/check_no_game_data.py on the seven transplanted files: clean. I did not run the shader corpus or GPU fixtures against main (the translator change cannot be applied there beyond the files above), so no baseline deltas are claimed beyond the semantic counts.

No game files. AI-assisted.

**@⁠wavehs** on GitHub · 2026-11-26 19:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2304#pullrequestreview-6079364990) · **reviewed** **macOS arm64 check of #2304** (RT-BARY-FALLBACK-PER-VERTEX). A translator rule, a Python geometry-shader builder and the runtime builder; the branch is far behind and does not apply to `main`, so what I could verify is the translator half and the generated modules. Tested head `096a26220` (7 commits, 3 of them merges of `main` from when the branch was current), 533 commits behind `main` `bdbc7e923`. **It does not apply to `main` any more.** `git merge-tree --write-tree ubi/main 096a26220` exits 1 with conflicts in `docs/design.md`, `runtime/shims/d3d12_vulkan_device.cpp`, `runtime/test/vk_test_device.h` and `tools/vk_subgroup_info.py`. The branch's own diff against its merge-base (`b0f3d3998`, 533 commits back) fails `git apply --check` on `main` in those four plus `docs/testing.md` and `tests/test_vk_subgroup_info.py`. So a rebase is needed before CI can run it; I tested two things that can be separated: 1. **The translator half transplanted onto `main`** (`tools/rdna2spirv.py`, `tools/bary_fallback_gs.py`, `tests/semantic/support.py`, `tests/semantic/test_interp_computed_ij.py`, `tests/test_shader_build_fallbacks.py`, `tests/test_run_gpu_tests.py`, `scripts/run_gpu_tests.py` applied by `patch -p1`, clean). - `tests/semantic/test_interp_computed_ij.py`: 28 tests, OK - including the `ComputedIJBaryFallback` cases that compare every computed form against the `PerVertexKHR` path and the geometry shader's own `spirv-val`. - Whole semantic suite: 500 files / 6,373 tests / 0 files failed (main is 500 / 6,367, so the change adds 6 cases and breaks none). - `tests/test_shader_build_fallbacks.py`: 3 failures, `tests/test_run_gpu_tests.py`: 2 failures - **not defects of the rule**: they assert the build-side wording and selection that live in the runtime/make_game half, which I did not transplant (e.g. the test expects `per-vertex inputs` where `main` prints `computed I/J pairs need PerVertexKHR inputs`). They are a reminder that the whole PR has to be rebased before those suites mean anything. 2. **The branch tree as-is on this machine**, to exercise the generator end to end. Built the macOS harness from `096a26220` (`vk_compute_test`, `vk_store_test`, `vk_harness`) and ran the project's own runner with `LEONIDA_BARY_FALLBACK=1` and KosmicKrisp: - `274 shaders: 274 translated, 274 pass spirv-val`. - Five fallback geometry shaders built: `ps_bary`, `ps_ij_computed`, `ps_persp_bary`, `ps_scc_mask32`, `ps_uniform_branch` (`<name>.bary_gs.spv`). Each passes `spirv-val --target-env vulkan1.2` independently (the builder already validates them; I re-ran the check on the artefacts of this run). - Suite: `158/264 passed, 72 skipped`; the five GS fixtures report `SKIP (unsupported: no geometryShader)`. That is the honest outcome on this device. **What this GPU cannot verify, and why it matters.** `vk_subgroup_info.py` reports `geometry_shader: false`, `per_vertex_inputs: false`, `barycentric_fallback: false` for KosmicKrisp on an Apple M3 Pro: Apple GPUs have no geometry stage, so the pass-through GS this PR adds cannot be created here at all. The design row already lists "a GPU that needs the fallback" as unverified; this machine needs the fallback but cannot run it, so it does not close that gap. What I can say positively: under `--bary-fallback` every fixture translates, the PS values of the computed-I/J forms match the `PerVertexKHR` path in the mini interpreter, and all five generated GS modules are valid Vulkan 1.2 SPIR-V. **Review of the rule as far as it can be read** - Location allocation cannot collide: `assemble()` rents three consecutive free locations per per-vertex attribute, excluding the attribute's own location, and rejects a block that overlaps any other input (`tools/rdna2spirv.py:15798-15808`); the loop's search bound `len(taken) + 3` is always enough because at most `len(taken)` of its candidates can be taken. The index keeps the attribute *number* in `inputs` for those attributes (`:19199`) and records the block under `bary_fallback_input.per_vertex` (`:19206`), which is what both the Python GS builder and the runtime builder consume. - The GS writes vertex k's value into element k at every emitted vertex, so the flat array is order-independent, as the docstring says; the PS then weights `P0 + I·(P1−P0) + J·(P2−P0)` with its own I/J. - `--f16-interp-fallback` plus `--bary-fallback` (the Pascal combination) is covered by the new semantic cases; the 16-bit reads decode the raw words of the array rather than the producer's halves, which is the only consistent choice since there are no halves on that path. **Findings** 1. **Rebase needed** (same commit as the last one I saw for it): the file list above; `runtime/src/arena_blocks.h` and `runtime/shims/d3d12_vulkan_device.cpp` have moved under it, and `tools/vk_subgroup_info.py` now conflicts, so the automatic fallback selection changes need re-checking against `main`'s version after the rebase. 2. **No macOS-executable verification of the new path.** Stated above so nobody reads this as a green run: the fixture that would draw it skips on this device. A Linux run on a driver with geometry shaders but no `VK_KHR_fragment_shader_barycentric` (or Pascal) remains the way to execute it; the author already reports such a check on a GTX 1060. 3. Small operational note: with the fallback forced on a device without a geometry stage, `run_gpu_tests.py --require-pass` exits 1 with `no GPU tests passed` because the only fixture skipped. That is the runner's contract, but a first-time user on Apple Silicon may read it as a failure; a line in the message when the skip is `no geometryShader` would explain it. `python -I scripts/check_no_game_data.py` on the seven transplanted files: clean. I did not run the shader corpus or GPU fixtures against `main` (the translator change cannot be applied there beyond the files above), so no baseline deltas are claimed beyond the semantic counts. No game files. AI-assisted.
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-26 19:18 UTC · original

I followed up on the macOS review. The full dependency stack merges cleanly with main 2d43417d49 after reapplying the two-file mixed clip/cull commit. All five fixtures that skipped on Apple M3 ran on an RTX 4090.

To reproduce the tested tree, start at #1930 head 682de28946, cherry-pick 096a26220f, then merge 2d43417d49. The resulting Git tree is 6ff8680e10ce90599940f3ece50488949c6fa829. The public draft still points to the older stack. The individual change in this PR touches only spirv_bary_fallback.h and its C++ test. The translator and device-selection changes are in its dependencies.

Check on the combined tree Result
CPU translator suite 6,379 tests across 500 files, zero files failed
Build selection, GPU runner and Vulkan capability unit tests 7/7, 71/71 and 56/56 passed, respectively. This includes the two suites that had failures on the partial transplant.
Stock C++ geometry-shader generator All ten emitted modules passed spirv-val --target-env vulkan1.2 and matched the prior rebased build byte for byte, including mixed clip/cull.
Windows 11, RTX 4090, driver 616.64 ps_bary, ps_ij_computed, ps_persp_bary, ps_scc_mask32 and ps_uniform_branch each passed the pixel readback with automatic selection and with LEONIDA_BARY_FALLBACK=1. The forced runs emitted five geometry shaders, all independently validated.
D3D12 runtime path on the same GPU d3d12_bary_fallback passed with Vulkan validation enabled, including partial clipping, f16 relocation and both computed-I/J layouts.

The RTX reports geometry_shader=true, per_vertex_inputs=true and barycentric_fallback=false. Automatic selection used its native path. Forcing the fallback exercised the geometry stage on hardware. The public branch update is still pending.

**@⁠ecox982745** on GitHub · 2026-11-26 19:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2304#issuecomment-7201446373) I followed up on the [macOS review](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2304). The full dependency stack merges cleanly with main `2d43417d49` after reapplying the two-file mixed clip/cull commit. All five fixtures that skipped on Apple M3 ran on an RTX 4090. To reproduce the tested tree, start at #1930 head `682de28946`, cherry-pick `096a26220f`, then merge `2d43417d49`. The resulting **Git tree** is `6ff8680e10ce90599940f3ece50488949c6fa829`. The public draft still points to the older stack. The individual change in this PR touches only `spirv_bary_fallback.h` and its C++ test. The translator and device-selection changes are in its dependencies. | Check on the combined tree | Result | | --- | --- | | CPU translator suite | 6,379 tests across 500 files, zero files failed | | Build selection, GPU runner and Vulkan capability unit tests | 7/7, 71/71 and 56/56 passed, respectively. This includes the two suites that had failures on the partial transplant. | | Stock C++ geometry-shader generator | All ten emitted modules passed `spirv-val --target-env vulkan1.2` and matched the prior rebased build byte for byte, including mixed clip/cull. | | Windows 11, RTX 4090, driver 616.64 | `ps_bary`, `ps_ij_computed`, `ps_persp_bary`, `ps_scc_mask32` and `ps_uniform_branch` each passed the pixel readback with automatic selection and with `LEONIDA_BARY_FALLBACK=1`. The forced runs emitted five geometry shaders, all independently validated. | | D3D12 runtime path on the same GPU | `d3d12_bary_fallback` passed with Vulkan validation enabled, including partial clipping, f16 relocation and both computed-I/J layouts. | The RTX reports `geometry_shader=true`, `per_vertex_inputs=true` and `barycentric_fallback=false`. Automatic selection used its native path. Forcing the fallback exercised the geometry stage on hardware. The public branch update is still pending.
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-26 23:17 UTC · original

I tested this patch against the updated dependency in #1930, including a draw that needs both changes in the same geometry shader. Cherry-picking 096a26220f onto 0b7532951f applied cleanly (tree 8b52538a2e). Merging main d1dff7949b into that result also applied cleanly. All results below are from the resulting tree ff32b57406f99271788e9e039d496b8b854bae37.

RTX 4090, Windows 11, NVIDIA 616.64. The synthetic vertex shader writes two clip distances and one cull distance. The fragment shader reads the per-vertex attribute at 29 alongside decoded FP16 halves of 0.25 and 0.75. I compared all four channels at every pixel of each 64 × 64 readback with the expected values.

Vertex attribute 29 Full triangle Half clipped Fully culled
Missing 4,096 pixels returned 0 for the attribute 2,048 returned 0 0 pixels drawn
Authored as 0.625 4,096 returned 0.625 2,048 returned 0.625 0 pixels drawn

The two FP16 channels kept their expected values in every drawn pixel, and every unshaded pixel retained the clear color. As a control I omitted the raw-export set from the generator for one full draw. The linked high half at location 29 then appeared as 0.75 instead of 0 in all 4,096 pixels. All seven draws ran with Khronos validation and produced no validation errors.

The stock shader_library, spirv_f16_halves, and spirv_bary_fallback CPU tests passed. All 13 geometry modules dumped by the generator passed spirv-val for Vulkan 1.2 and 1.3. Both D3D12 GPU tests (d3d12_f16_halves, d3d12_bary_fallback) also passed on the 4090 with validation enabled. The public draft head is still 096a26220f. AI-assisted verification.

**@⁠ecox982745** on GitHub · 2026-11-26 23:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2304#issuecomment-7205422407) I tested this patch against the [updated dependency in #1930](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1930), including a draw that needs both changes in the same geometry shader. Cherry-picking `096a26220f` onto `0b7532951f` applied cleanly (tree `8b52538a2e`). Merging main `d1dff7949b` into that result also applied cleanly. All results below are from the resulting tree `ff32b57406f99271788e9e039d496b8b854bae37`. **RTX 4090, Windows 11, NVIDIA 616.64.** The synthetic vertex shader writes two clip distances and one cull distance. The fragment shader reads the per-vertex attribute at 29 alongside decoded FP16 halves of 0.25 and 0.75. I compared all four channels at every pixel of each 64 × 64 readback with the expected values. | Vertex attribute 29 | Full triangle | Half clipped | Fully culled | | --- | --- | --- | --- | | Missing | 4,096 pixels returned 0 for the attribute | 2,048 returned 0 | 0 pixels drawn | | Authored as 0.625 | 4,096 returned 0.625 | 2,048 returned 0.625 | 0 pixels drawn | The two FP16 channels kept their expected values in every drawn pixel, and every unshaded pixel retained the clear color. As a control I omitted the raw-export set from the generator for one full draw. The linked high half at location 29 then appeared as **0.75 instead of 0 in all 4,096 pixels**. All seven draws ran with Khronos validation and produced no validation errors. The stock `shader_library`, `spirv_f16_halves`, and `spirv_bary_fallback` CPU tests passed. All 13 geometry modules dumped by the generator passed `spirv-val` for Vulkan 1.2 and 1.3. Both D3D12 GPU tests (`d3d12_f16_halves`, `d3d12_bary_fallback`) also passed on the 4090 with validation enabled. The public draft head is still `096a26220f`. AI-assisted verification.
This pull request has changes conflicting with the target branch.
  • docs/design.md
  • runtime/shims/d3d12_vulkan_device.cpp
  • runtime/test/vk_test_device.h
  • tools/vk_subgroup_info.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2304/head:github-bot/gh-2304'
git switch 'github-bot/gh-2304'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2304'
git switch 'github-bot/gh-2304'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2304'
git switch 'github-bot/gh-2304'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2304'
git switch 'main'
git merge --squash 'github-bot/gh-2304'
git switch 'main'
git merge --ff-only 'github-bot/gh-2304'
git switch 'main'
git merge 'github-bot/gh-2304'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.