runtime/d3d12: the --bary-fallback geometry stage feeds computed I/J pairs (RT-BARY-FALLBACK-PER-VERTEX) #1930
Open
github-bot
wants to merge 7 commits from
github-bot/gh-1930 into main
AGit
pull from: github-bot/gh-1930
merge into: github:main
github:main
github:docs/animation-merge-remnants
github:docs/story-dedup-and-cli
github:docs/restofworld-merge-remnants
github:docs/gamedata-dedup-tables
github:docs/textures-bcpack-tables-and-cli
github:docs/exe-fail-fast-shims-sync
github:fix/address-guard-wraparound-parity
github:fix/cvt-f16-denorm-and-clamp
github:docs/pso-cache-scope-note
github:docs/viewer-readme
github:docs/textures-arrays-dds-preview
github:docs/conformance-readme-status
github:fix/docs-validators-fences-urls
github:claude/loop-total
github:claude/pops-collision-seed
github:claude/dstorage-hold-page-reads
github:claude/host-image-copy-switch
github:feat/gdk-lifecycle-window-hook
github:claude/d16s8-uav-nvidia-fallback
github:feat/mfplat-offline-shim
github:claude/gameinput-slow-reader
github:fix/rt-null-barrier-clear
github:claude/depth-resolve-sample-positions
github:integration/palmetto-parity
github:claude/valu-literal-sext
github:claude/slot74-pool-handle
github:claude/rgb9e5-uint-alias-view
github:claude/fssm-root-layout-tables
github:feat/gdk-speech-display-lifecycle
github:asset-audio-skip-current
github:qemmhd/old-9940-rectangle-quad-lists
github:feat/ws2-offline-shim
github:qemmhd/rt-d16-unorm-uav
github:feat/xs-device-stops-7-9
github:qemmhd/rt-depth-same-base-shapes
github:qemmhd/rt-lazy-attachment-variant
github:feat/acphal-xma2-decoder
github:asset-audio-skip
github:codex/coord-claim-check-20261124-7e48
github:feat/xs-frame-pacing-presentx
github:feat/xs-device-vm-options
github:old-pr/9844
github:old-pr/9978
github:old-pr/9815
github:old-pr/10057
github:old-pr/9874
github:old-pr/9965
github:old-pr/9863
github:old-pr/10068
github:old-pr/10066
github:old-pr/10067
github:old-pr/10007
github:old-pr/10061
github:old-pr/10065
github:old-pr/10059
github:old-pr/10063
github:old-pr/10055
github:old-pr/10062
github:old-pr/10042
github:old-pr/10041
github:old-pr/10049
github:old-pr/10047
github:old-pr/10046
github:old-pr/10045
github:old-pr/10056
github:old-pr/10043
github:old-pr/10036
github:old-pr/10034
github:old-pr/9984
github:old-pr/10052
github:old-pr/10038
github:old-pr/10033
github:old-pr/10028
github:old-pr/10050
github:old-pr/9891
github:old-pr/9889
github:old-pr/10051
github:old-pr/10019
github:old-pr/10027
github:old-pr/10029
github:old-pr/10031
github:old-pr/10026
github:old-pr/9941
github:old-pr/10030
github:old-pr/10040
github:old-pr/9990
github:old-pr/10021
github:old-pr/9962
github:old-pr/10022
github:old-pr/10020
github:old-pr/10015
github:old-pr/10025
github:old-pr/9886
github:old-pr/10048
github:old-pr/10014
github:old-pr/10011
github:old-pr/9861
github:old-pr/10010
github:old-pr/10008
github:old-pr/9860
github:old-pr/10006
github:old-pr/9920
github:old-pr/9995
github:old-pr/10000
github:old-pr/10016
github:old-pr/10004
github:old-pr/10023
github:old-pr/9982
github:old-pr/9981
github:old-pr/9983
github:old-pr/9970
github:old-pr/9969
github:old-pr/9968
github:old-pr/9971
github:old-pr/9972
github:old-pr/9942
github:old-pr/9963
github:old-pr/9960
github:old-pr/9964
github:old-pr/9985
github:old-pr/9973
github:old-pr/9862
github:old-pr/9953
github:old-pr/10017
github:old-pr/9952
github:old-pr/9955
github:old-pr/9946
github:old-pr/9954
github:old-pr/9938
github:old-pr/9956
github:old-pr/9856
github:old-pr/9947
github:old-pr/9924
github:old-pr/9961
github:old-pr/9927
github:old-pr/9979
github:old-pr/10032
github:old-pr/9926
github:old-pr/5237
github:old-pr/9951
github:old-pr/9931
github:old-pr/9902
github:old-pr/9921
github:old-pr/9994
github:old-pr/9775
github:old-pr/9768
github:old-pr/9905
github:old-pr/9936
github:old-pr/9901
github:old-pr/9904
github:old-pr/9906
github:old-pr/9988
github:old-pr/9908
github:old-pr/9909
github:old-pr/9911
github:old-pr/9912
github:old-pr/9913
github:old-pr/9887
github:old-pr/9916
github:old-pr/9919
github:old-pr/9925
github:old-pr/9933
github:old-pr/9935
github:old-pr/9918
github:old-pr/9879
github:old-pr/9880
github:old-pr/9881
github:old-pr/9996
github:old-pr/9876
github:old-pr/9892
github:old-pr/9899
github:old-pr/9915
github:old-pr/9914
github:old-pr/9872
github:old-pr/9869
github:old-pr/9866
github:old-pr/9819
github:old-pr/10012
github:old-pr/9857
github:old-pr/9893
github:old-pr/9897
github:old-pr/9928
github:old-pr/9868
github:old-pr/9917
github:old-pr/9940
github:old-pr/9873
github:old-pr/9816
github:old-pr/10009
github:old-pr/9900
github:old-pr/9966
github:old-pr/9859
github:old-pr/9843
github:old-pr/9991
github:old-pr/10058
github:old-pr/9883
github:old-pr/9838
github:old-pr/9835
github:old-pr/9959
github:old-pr/9895
github:old-pr/9837
github:old-pr/9858
github:old-pr/9865
github:old-pr/9864
github:old-pr/9840
github:old-pr/9820
github:old-pr/4669
github:old-pr/9848
github:old-pr/9850
github:old-pr/9810
github:old-pr/9799
github:old-pr/9853
github:old-pr/9875
github:old-pr/9831
github:old-pr/9796
github:old-pr/9801
github:old-pr/9813
github:old-pr/9794
github:old-pr/7417
github:old-pr/9781
github:old-pr/9806
github:old-pr/9958
github:old-pr/9809
github:old-pr/9791
github:old-pr/9792
github:old-pr/10053
github:old-pr/9784
github:old-pr/9789
github:old-pr/9849
github:old-pr/9846
github:old-pr/9773
github:old-pr/9785
github:old-pr/9803
github:old-pr/9826
github:old-pr/9839
github:old-pr/9922
github:old-pr/9948
github:old-pr/7189
github:old-pr/9957
github:old-pr/9823
github:old-pr/9807
github:old-pr/9851
github:old-pr/9774
github:old-pr/9830
github:old-pr/9836
github:old-pr/9822
github:old-pr/9783
github:old-pr/9833
github:old-pr/9890
github:old-pr/9770
github:old-pr/9769
github:old-pr/9772
github:old-pr/9787
github:old-pr/9852
github:old-pr/9834
github:old-pr/9845
github:old-pr/9871
github:old-pr/9771
github:old-pr/9776
github:old-pr/10005
github:old-pr/9949
github:old-pr/9923
github:old-pr/9805
github:old-pr/9829
github:old-pr/9790
github:old-pr/9827
github:old-pr/9929
github:old-pr/9855
github:old-pr/9934
github:old-pr/9907
github:old-pr/9910
github:old-pr/9779
github:old-pr/9780
github:old-pr/9885
github:old-pr/9882
github:old-pr/9877
github:old-pr/9998
github:old-pr/4251
github:old-pr/9987
github:old-pr/9989
github:old-pr/9950
github:old-pr/9777
github:old-pr/10044
github:old-pr/9884
github:old-pr/2906
github:old-pr/5076
github:old-pr/9937
github:old-pr/9986
github:old-pr/3014
github:old-pr/9943
github:old-pr/9939
github:old-pr/4682
github:old-pr/4765
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
question
Further information is requested
wontfix
This will not be worked on
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1930
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1930"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mrgenty on GitHub · 2026-11-25 16:02 UTC · original
mrgenty:rt-bary-fallback-per-vertex→main· +2879 −108 · 24 files · 7 commits · openClaimed in the coordination issue as: RT-BARY-FALLBACK-PER-VERTEX (#1608)
Depends on: #1497, #1426
What and why
The runtime half of the computed-I/J case of #1285, which #1497 leaves out (finding, confirmed in the reviews of #1497).
With
--bary-fallback, #1426 translates a pixel shader that has a computed I/J pair so that the pair's attribute is aFlatvec4[3]input, at the first of three locations the index gives asbary_fallback_input.per_vertex(attribute → first location). #1497's builder reads onlybary_fallback_input.locationand expects every other PS input to be avec4, so it refuses such a PS before the draw (PS pass-through Input at Location 0 is not vec4<f32>) and the PSO is never created.This branch is
main+ #1497 + #1426 + one commit. Only the last commit,07d06992, is this pull request; the rest of the diff goes away as those two land. #1426 conflicted withmainin onedocs/design.mdrow and I took its side, which ismain's text plus its additions.The commit:
runtime/src/shader_library.h: parsesper_vertexintoShaderEntry::bary_fallback_per_vertex. Keys and values are exactu32s; one malformed entry drops the whole map, so the builder refuses the array instead of linking part of a mapping.runtime/src/spirv_bary_fallback.h:build_bary_fallback_gstakes the map. For each mapped attribute the PS declares, the geometry stage reads the VS output at the attribute's number and writes the triangle's three values to aFlatvec4[3]output at the first location (element k = vertex k, the same at each of the three vertices it emits), astools/bary_fallback_gs.pydoes. The three values are loaded once. An attribute the VS does not export is zero-filled, like an ordinary pass-through input. One GS input per VS location, shared when the PS also reads that location as an ordinary input.Refused: a
vec4[3]input the map does not name, a mapped location that is notvec4<f32>[3], a block that runs into another PS input or the barycentric location, two attributes at one first location, and a block past the last location. A mapping the PS does not declare is ignored. The six-argument signature stays as a wrapper with an empty map.runtime/shims/d3d12_vulkan_device.cpp: the two call sites (create_graphicsand the lazystage_words) pass the entry's map.docs/design.md: the runtime builder in the "Barycentric fallback" row, with what was checked and what was not.Tested
Native Windows 11 (build 26300), MSVC 19.44
RelWithDebInfo, Vulkan SDK 1.4.363.0. No game files.ctest -C RelWithDebInfo -R "^(shader_library|spirv_bary_fallback|d3d12_bary_fallback)$": 3/3 pass, and again withLEONIDA_VK_VALIDATION=1;d3d12_bary_fallbackalso withLEONIDA_LAZY_GRAPHICS=0and=1under validation (the test fails on any validation error).spirv_bary_fallback(CPU), five new cases: the block at the attribute's first locations, a relocated block next to ordinary inputs with a shared GS input, two attributes with one zero-filled, an undeclared mapping (module identical to the one built without it), and six refusals that leave the caller's words untouched.spirv-val --target-env vulkan1.2andvulkan1.3on all 9 modulesspirv_bary_fallback_test --dump-dirwrites (the 6 from #1497 and 3 new): 18/18 clean.shader_library, twelve newper_vertexparsing cases (non-numeric, signed and out-of-range keys; negative, fractional, string and overflowing values; two keys for one attribute; an array instead of an object).d3d12_bary_fallback(GPU), new draws 5a–5c through the Xbox-ABI proxy: a VS that gives each vertex a different value, and a PS in the shape #1426 emits that weights the three with its own I/J (0.375, 0.5, 0.125). All 256 pixels match with the block at locations 0..2 and with it relocated to 4..6 next to an ordinary input; the barycentric channel is still the perspective-correct one. The same weights on any other order of the three vertices would be at least 15 LSB away (the test asserts that margin). The same PS with noper_vertexin its index entry is refused withE_FAIL.python -I scripts/check_no_game_data.pyon the touched files,tests/test_bary_fallback_gs.py,tests/test_ctest_registration.py,tests/test_docs_links.py,tests/test_docs_table_rows.py,git diff --check.Not tested:
fragmentShaderBarycentric; the test drives the fallback path on it directly. A run ofd3d12_bary_fallbackon such a card would be welcome.ps_ij_computedfrom #1426 translated byrdna2spirv.pyand drawn through the runtime (nollvm-mcwith the AMDGPU target on this machine).--f16-interp-fallbackrelocation in one PSO.GPUs tested: NVIDIA GeForce RTX 3060, driver 621.24, Windows 11 (10.0.26300)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase). — based onmainb0f3d399plus #1497 and #1426; it will need a rebase as those land.docs/design.md, with how it was confirmed. — no translator rule; the runtime behaviour is recorded in the "Barycentric fallback" row.🤖 Generated with Claude Code
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)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]>@ZroIsHere on GitHub · 2026-11-26 00:11 UTC · original
I found one remaining coverage gap in the fallback GS builder:
spirv_bary_fallback.hrecords both VSClipDistanceandCullDistance, then rejects the shader when both arrays are present (clip_count && cull_count, around line 188). Vulkan permits both in one stage, subject tomaxCombinedClipAndCullDistances; the GS would need to forward two independent built-ins/capabilities rather than choosing onedist_builtin. This is a safe refusal today, but it leaves valid pipelines unavailable on the fallback path. Could this be tracked as a follow-up, or is mixed clip/cull intentionally outside the fallback contract? Spec: https://docs.vulkan.org/spec/latest/chapters/vertexpostproc.html#vertexpostproc-clipping@ZroIsHere on GitHub · 2026-11-26 00:18 UTC · original
I implemented this follow-up in a stacked PR against your integration branch: https://github.com/mrgenty/leonida/pull/1. It forwards ClipDistance and CullDistance independently and updates the generator coverage. Local tests were not run; the PR checks should validate it.
@ecox982745 on GitHub · 2026-11-26 01:49 UTC · original
I checked the two open test cases in the PR description on
07d069924bffc3d103a7fcd4a4eef341d4517dd7. The translatedps_ij_computedfixture and a second shader combining computed I/J with f16 location relocation both rendered through the Xbox D3D12 proxy on an RTX 4090 (Windows 11, NVIDIA 616.64).vs_ids+ps_ij_computed,--bary-fallbackAll four RGBA32F channels matched bit for bit. On the mixed case the low/high channels were exactly 0.25 and 0.75, the computed channel varied by row, and the control was 0.5. Each draw passed with Khronos validation on and off. Removing only
bary_fallback_input.per_vertexfrom the index made the same pipeline fail creation as expected. The stock CPU testsspirv_bary_fallbackandshader_libraryalso passed.For reproduction, I built the assembly with this head's
runtime/test/shaders/build.py. The draw fixture supplied just the resulting VS, PS and index, with synthetic lookup hashes for its two test containers. It did not supply an offline geometry shader. For the mixed case I added a packed0x3a003400at VSparam7.x, raw exports at 14 and 15, and low/highv_interp_p1ll_f16+v_interp_p2_f16onattr7.xbefore the existing computed-I/J operations.@zmasi, for the 207 refusals in your Vega report, this head includes #1426 and its runtime dependencies. If your Vulkan backend reports
geometryShader=true, a before/after count with both fallback flags would test whether this covers the same class in your corpus. The geometry fallback requires that feature for drawing. My counts above cover synthetic shaders on NVIDIA.AI-assisted with OpenAI Codex (
gpt-6.2-astra).@zmasi on GitHub · 2026-11-26 11:02 UTC · original · edited 2026-11-26 11:05 UTC
@ecox982745 — yes. The earlier Vega report and this rerun are missing exactly the same 207 pixel shaders before the change. On
07d069924bffc3d103a7fcd4a4eef341d4517dd7, all 207 are recovered.AMD Radeon Pro Vega II (Vega 20 / gfx906), Mesa RADV 26.0.8, Ubuntu 26.04, Vulkan 1.4.335.
geometryShader=true; subgroup range 64..64. Fresh output directories, the same 26,503 inputs,--f16-interp-fallback --bary-fallbackon both revisions, no--wave64-emulate.spirv-valb0f3d399(base before the stack)07d06992(PR head, includes #1426)I compared the index entries locally: 0 previously accepted shaders lost; all 26,296 common SPIR-V modules were byte-identical. All 207 additions are pixel shaders with
bary_fallback_input.per_vertex. A separatevk_pipeline_checkover exactly those additions on RADV created 207/207 PS pipelines: 0 failed, 0 skipped.That last check uses partner stubs; it is not a claim that 207 retail draws rendered correctly. Separately, a synthetic
ps_ij_computeddraw using the C++ builder test's matching per-vertex geometry shader passed the repository's 4,096-pixel readback check on Vega.The full-corpus before/after RADV pipeline scan is still running. I’ll follow up here with its complete creation, failure and skip counts. Aggregate corpus results only. AI-assisted.
@zmasi on GitHub · 2026-11-26 11:30 UTC · original
@ecox982745 — the full-corpus Vega 20 scan has finished. Both unfiltered
vk_pipeline_checkruns exited 0 on the same Radeon Pro Vega II (gfx906, Mesa RADV 26.0.8, fixed subgroup 64), with--f16-interp-fallback --bary-fallbackused for both translations.b0f3d399(before the stack)07d06992(tested PR head)All 207 additional pipelines were pixel pipelines: 11,894 before, 12,101 after. Compute (2,689), vertex (2,236) and geometry (195) counts were unchanged. Neither run had a shader-module failure. All 9,282 skips in each run were mesh pipelines: RADV created their shader modules, but this GPU does not expose
VK_EXT_mesh_shader.This confirms driver pipeline creation for the same 207 recovered pixel shaders. The checker uses partner stubs for graphics; these counts are not a retail draw or pixel-correctness result.
AI-assisted.
@ecox982745 on GitHub · 2026-11-26 11:50 UTC · original
I tested the stacked mixed clip/cull change linked above. On an RTX 4090 (Windows 11, NVIDIA 616.64), the generated fallback geometry shader produced byte-identical RGBA32F readback to the direct vertex-to-fragment path in all 22 comparisons. This covers 90,112 pixel comparisons across 44 draws.
I used the generator at
096a26220f15with synthetic vertex and fragment stages. The four clip/cull array-length pairs were (1,1), (2,1), (1,2), and (4,4). The generator at its parent,07d069924bff(this PR), refused all four pairs before pipeline creation. On the stacked head the stock CPU test passed, all ten modules it dumped passedspirv-val --target-env vulkan1.2, and every generated stage in the draw matrix passed the same validator.The fragment shader wrote both interpolated UV and barycentric values. The largest absolute channel error against the pixel-center formula was 5.96e−8, and the Khronos validation layer reported no errors. This check exercises simultaneous clipping and primitive culling on synthetic draws. The stacked change is still separate from the head of #1930.
@mrgenty on GitHub · 2026-11-26 13:06 UTC · original
Thanks @zmasi and @ecox982745 for the runs. The Vega 20 corpus numbers are the measurement this PR was missing: 207 refusals to 0, no accepted shader lost, the 26,296 common modules byte-identical and 207/207 pixel pipelines created on RADV. The 4090 draws cover the computed I/J path together with the f16 relocation, which I had only tested separately. I'm noting your caveat that this is pipeline creation, not a retail draw.
@ZroIsHere: right, the builder refuses a VS that writes both ClipDistance and CullDistance. That refusal predates this PR, so it stays out of this one. @ecox982745 already implemented it in mrgenty/leonida#1 and tested it (22/22 byte-identical on the 4090). Thanks for that. To keep one topic per PR I won't merge it into this branch. Could you open it against ubiquitarianism/leonida as its own PR, with Depends on: #1930? I'll close the one on my fork once it's up.
This branch needs a rebase on current main. I'll push it and rerun shader_library, spirv_bary_fallback and d3d12_bary_fallback on the RTX 3060.
07d069924bto682de28946@ecox982745 on GitHub · 2026-11-26 13:17 UTC · original
Opened #2304 against upstream main as a draft with
Depends on: #1930. ZroIsHere wrote the implementation and generator test. My contribution was the RTX 4090 verification and upstream submission. The new PR preserves the original commit096a26220and links the 22 draw comparisons. I'll track the rebase there when #1930 updates.@mrgenty on GitHub · 2026-11-26 14:13 UTC · original
Rebased on
main73516a29(head now682de289), with #1497 at its current head53df7d1aand #1426 unchanged. The conflicts were in #1426'stools/vk_subgroup_info.pyanddocs/design.md, where both sides are kept; this PR's code applied unchanged. On the RTX 3060 (NVIDIA 621.24, validation on),shader_library,spirv_bary_fallbackandd3d12_bary_fallbackpass, andrun_semantic_tests.pypasses: 498 files, 6,357 tests, 0 failed.@ecox982745 the stack is updated, so #2304 can be rebased on it. Thanks for opening it, and @ZroIsHere for the implementation. I credited ecox982745 for the code above; that was my mistake. I'm closing mrgenty/leonida#1 in favour of #2304.
@ecox982745 on GitHub · 2026-11-26 14:15 UTC · original
Thanks for updating the stack and the attribution. I rebased #2304 locally on your exact head
682de2894. The two-file diff matches ZroIsHere’s original patch byte for byte. All 22 pairs of RTX 4090 draws matched across 90,112 pixels, and all ten generated shaders passed SPIR-V validation.The remaining step is publishing that rebase. GitHub rejected the branch update because it carries upstream workflow changes and the connected OAuth credential lacks the required permission. The public draft still points to
096a26220. Anyone reviewing the combined tree can reproduce it by cherry-picking that commit onto682de2894. Results and integration status.@mrgenty on GitHub · 2026-11-26 23:02 UTC · original
Pushed
0b753295with a fix @marcelofrayha found and reproduced on a GPU (mrgenty/leonida#2): with both fallbacks on, f16 linking can put a decoded half on the Location of a computed-I/J attribute the VS does not export, and the geometry stage then forwarded that half instead of zero-filling the array.link_f16_halvesnow returns the VS's raw output Locations from before linking, and the builder forwards an attribute only from one of them. Linking also keeps halves off all three Locations of avec4[3]block, not just the first. The commit follows his7f63a4876and the block-reservation part ofbdff821c1, with him as co-author.Tested on the RTX 3060 (validation on):
shader_library,spirv_f16_halves,spirv_bary_fallback(new cases 7f–7h; 7f also checks that the half is forwarded without the fix, and 7h fails if the block reservation is removed),d3d12_f16_halvesandd3d12_bary_fallbackpass, and the 12 dumped modules passspirv-valfor Vulkan 1.2 and 1.3.@zmasi on GitHub · 2026-11-26 23:59 UTC · original
@mrgenty — verified
0b753295against its immediate parent682de289on Radeon Pro Vega II (gfx906, Mesa RADV 26.0.8) with both fallbacks. At Vega’s geometry-stage half-location ceiling of 14, one more synthetic pipeline drew, and three previously wrong draws became correct.682de2890b753295These were native Vulkan readbacks using the revision’s C++ f16 linker and fallback GS builder, not the Windows D3D12 proxy. Separately, the original 207 recovered pixel shaders still translated, passed
spirv-val, and created 207/207 RADV pipelines (0 failed, 0 skipped). That was the targeted cohort, not a new full-corpus scan.AI-assisted.
@ecox982745 on GitHub · 2026-11-27 00:47 UTC · original
When bringing the new geometry-limit checks from #1497 into #1930, the per-vertex arrays need to count towards those limits. I tested #1497 at
961d719d54combined with #1930 at0b7532951f. Git mergesspirv_bary_fallback.hcleanly (blob6bf9da14bb), but the resulting builder reports a footprint smaller than the geometry shader it emits.CPU check. With the barycentric vector at location 3, a VS attribute at 16, and its computed-I/J
vec4[3]block starting at 14, the builder reported input/output location bounds of 0/15 components. The emitted SPIR-V requires 68/68: the input occupies location 16 and the output spans locations 14–16. A 64-component profile would therefore pass the new precheck. Moving the attribute to 15 and the block to 13 gives a legitimate 64/64 boundary case.Counting inputs from the final
id_in_locmap includes attributes used only by computed I/J and counts a shared ordinary input once. On output, each emittedid_out_pvarray adds 12 scalar components per vertex and occupies locationsbasethroughbase + 2, even when zero-filled. A local adjustment to those counts matched independent SPIR-V reflection in five fixtures and kept all five generated shaders byte-identical.RTX 4090 check. This card reports limits of 128 input and 128 output components. All five synthetic fixtures rendered the expected values across 20,480 pixels with Vulkan validation enabled. The 64-component comparison was CPU-only. The emitted modules also passed
spirv-valfor Vulkan 1.2 and 1.3.I tested the merged builder in isolation. The full merge still has conflicts in the runtime and two test files. In the D3D12 test, several fixture program IDs overlap across the two branches (for example,
vs_10p_progandvs_ij_proghave identical input bytes); giving those distinct IDs will keep both cases independently testable. AI-assisted verification.@zmasi on GitHub · 2026-11-27 01:42 UTC · original
@ecox982745 — confirmed the merged-builder limit issue on a real 64-input-component device. Vega 20 reports geometry limits of 64 input, 128 output, 1,024 total output components (RADV Mesa 26.0.8).
For the merged header
6bf9da14bb(#1497961d719d+ #19300b753295), attribute 16 with the block at 14 reported location bounds 0/15; independent reflection of the emitted GS gave 68/68. The merged precheck would admit it. That case was CPU-only: no over-limit module went to the driver. At the legal edge (attribute 15, block 13–15), reflection gave 64/64, the pipeline was created, and 4,096/4,096 pixels matched. Counting the final input map and all three locations of each emitted block matched reflection in all five fixtures.This is an integration issue in the combined header, not a new failure of either standalone head.
AI-assisted.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.