runtime/d3d12: the --bary-fallback geometry stage feeds computed I/J pairs (RT-BARY-FALLBACK-PER-VERTEX) #1930
Closed
mrgenty wants to merge 18 commits from
upstream-pr/1930 into main
pull from: upstream-pr/1930
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
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.
Reference
ProjectLeonida/mandy!1930
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-25T16:02:05Z.
Claimed in the coordination issue as: RT-BARY-FALLBACK-PER-VERTEX (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7167254678)
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
Imported from ubiquitarianism/leonida. Originally posted by ZroIsHere on 2026-11-26T00:11:52Z.
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-clippingImported from ubiquitarianism/leonida. Originally posted by ZroIsHere on 2026-11-26T00:18:24Z.
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.
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T01:49:16Z.
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).Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-26T11:02:41Z.
@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.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-26T11:30:46Z.
@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.
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T11:50:05Z.
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.
Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-26T13:06:28Z.
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.
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T13:17:53Z.
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.Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-26T14:13:12Z.
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.
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T14:15:18Z.
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.Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-26T23:02:20Z.
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.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-26T23:59:31Z.
@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.
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-27T00:47:47Z.
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.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-27T01:42:06Z.
@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.
Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-27T13:43:20Z.
Updated: merged #1497 at
961d719dandmain3d6050b9, thenc6aa3894counts the computed-I/J blocks in #1497's geometry-limit check, as @ecox982745 and @zmasi worked out. Inputs come from the GS's final Input map, and each block adds its three output Locations (12 components), zero-filled or not. The 16/14 case now reports 68/68 and the 15/13 edge 64/64; the new test 7i fails with the old count. The overlapping D3D12 fixture IDs now differ (vs_ij0x5653ba06,ps_ij*0x5053ba06..08).RTX 3060, NVIDIA 621.24, validation on:
shader_library,spirv_f16_halves,spirv_bary_fallback,d3d12_f16_halvesandd3d12_bary_fallbackpass (all of #1497's cases and ours), the 13 dumped modules passspirv-valfor Vulkan 1.2 and 1.3, andrun_semantic_tests.pypasses (502 files, 6,393 tests). Not tested on a 64-component device here: this card reports 128/128.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T02:30:14Z.
@mrgenty @ecox982745 — tested
c6aa3894on physical gfx906, RADV Mesa 26.0.8 (geometry limits: 64 input / 128 output / 1,024 total output components). The 68-input refusal works. The nominal 64-input edge draws correctly, but is not validation-clean.spirv-valpassed. Khronos validation 1.4.341 reportedVUID-RuntimeSpirv-Location-06272once: it counts the four built-in Position components in addition to the occupied location end.E_NOTIMPL, null PSO, zero geometry modules and zero graphics pipeline calls, in both eager and lazy modes.--bary-fallbackand--f16-interp-fallback: computed I/J plus another f16 varying. Eager and lazy each matched all 256 expected pixels (center RGBA 191, 48, 135, 135), with zero validation messages. Its 16/14 counterpart also refused before a geometry module or pipeline.The practical remaining boundary is the built-in accounting in the geometry precheck, not a pixel mismatch. Layer check in the tested SDK · interface limit in the spec. I did not resubmit the flagged module.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-28T10:10:05Z.
Updated, thanks @zmasi and @ecox982745:
32b2d6e66counts the built-ins in the geometry-limit check. The layer adds the components of the GS's built-in variables to the last interface slot (the line you linked), so the fallback GS's Position (4) and any forwarded Clip/CullDistance now count on top of the Location end. On a 64-component device the 15/13 case (64 + 4) is refused like 16/14, and 14/12 (60 + 4) is the edge. Test 7i checks those and a ClipDistance[2] adding 2.9a51aff6dis @ecox982745'sd1361e9cfor the sparse-locationStopIterationthat @zmasi reported in #1608, cherry-picked unchanged.fcfc1eefdmergesmain33db04a7(the conflict wasdocs/design.md: kept both rows).RTX 3060, NVIDIA 621.24, validation on:
shader_library,spirv_f16_halves,spirv_bary_fallback,d3d12_f16_halvesandd3d12_bary_fallbackpass, the 13 dumped modules passspirv-valfor Vulkan 1.2 and 1.3, andrun_semantic_tests.pypasses (506 files, 6,407 tests, including the new sparse-location test). Not tested on a 64-component device here.Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-29T12:47:36Z.
Merged
maincc0f662a(0ce4df8a). #2239 now lowers a computed I/J pair under--f16-interp-fallbackalone with quad derivatives, and this PR lowers it under--bary-fallback(alone or with the f16 fallback) from the geometry shader'sFlat vec4[3]. They cover different modes, so the merge keeps both and refuses a computed pair in neither: the per-vertex path when--bary-fallbackis on or there is no f16 fallback,Gen.ij_quad_evalotherwise.build.py,check.pyandrun_gpu_tests.pybuild and runps_ij_computedin every mode, and the two tests that expected a refusal under one of the fallbacks (ours for the f16 one, #2239's for--bary-fallback) now check the translation. @zmasi, in case you want to look at the resolution intools/rdna2spirv.py.RTX 3060, NVIDIA 621.24, validation on:
run_gpu_tests.py --filter ps_ij_computedpasses in all four modes (no fallback,--bary-fallback, both,--f16-interp-fallbackalone);shader_library,spirv_f16_halves,spirv_bary_fallback,d3d12_f16_halvesandd3d12_bary_fallbackpass and the 13 dumped modules passspirv-val;run_semantic_tests.pyruns 529 files and 6,532 tests with the same 4 failures asmaincc0f662aalone (2 intest_valu_cvt_f16_int16_mods, 2 intest_interp_computed_ij_fallback).Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:24:36Z.
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed