vk_pipeline_check: synthesize --bary-fallback GS stage for PS pipelines (VK-PIPELINE-CHECK-BARY-FALLBACK) #1890
Open
github-bot
wants to merge 2 commits from
github-bot/gh-1890 into main
AGit
pull from: github-bot/gh-1890
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!1890
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1890"
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?
@robot00f on GitHub · 2026-11-25 14:33 UTC · original
robot00f:feat/vk-pipeline-check-bary-fallback→main· +2413 −28 · 12 files · 2 commits · openClaimed in the coordination issue as:
VK-PIPELINE-CHECK-BARY-FALLBACK(#14; continued in #1608)Depends on: #1497
What and why
When
tools/rdna2spirv.py --bary-fallbacktranslates a pixel shader (for GPUs withoutVK_KHR_fragment_shader_barycentric, such as NVIDIA Pascal, or drivers with brokenBaryCoordKHR), the Fragment SPIR-V reads perspective barycentrics from a smoothvec3<f32>Inputrecorded under"bary_fallback_input": {"location": N}inindex.json, while"inputs"lists only thevec4<f32>userparamlocations exported by<spirv dir>/stubs/vs_<inputs>.spv(tools/spirv_stubs.py).Previously
runtime/test/vk_pipeline_check.cppignored"bary_fallback_input"and built a 2-stageVS_stub + PSgraphics pipeline (runtime/test/vk_pipeline_check.cpp:1748-1764), which:Location Nunwritten by the preceding stage (VUID-RuntimeSpirv-OpEntryPoint-08743);geometryShader(shaderClipDistance/shaderCullDistance); andpipeline_cache.binthat misses the runtime's 3-stageVS + synthesized GS + PSpipeline (#1497).Changes:
runtime/test/vk_pipeline_check.cpp:"bary_fallback_input"inJsonParserintoShaderMeta::bary_fallback_location(acceptingnullor{"location": 0..31}and rejecting non-objects, missing"location", or out-of-range locations before loading Vulkan).VkShaderModuleinstub_cachewithout re-reading disk per shader.--bary-fallbackpsentries withno geometryShaderwhenf2.features.geometryShaderis unavailable; otherwise synthesizes the triangle pass-throughVK_SHADER_STAGE_GEOMETRY_BITmodule in memory vialeonida::build_bary_fallback_gs(runtime/src/spirv_bary_fallback.h), gates forwarded VSClipDistance/CullDistanceonshaderClipDistance/shaderCullDistancebeforevkCreateShaderModule, compiles the 3-stageVS + GS + PSgraphics pipeline, and fails the check (PIPELINE FAIL, exit 1) ifbuild_bary_fallback_gsrejects an incompatibleVS/PSinterface.vk_pipeline_check_bary_fallback(runtime/test/check_vk_pipeline_bary_fallback.py, pure Python stdlib SPIR-V fixtures so Windows/Linux/macOS CI need nollvm-mc), index parser tests intests/test_vk_pipeline_check_index.py, and docs indocs/pipeline_check.md.Tested
ps_bary.asm(--bary-fallback,VK_LOADER_LAYERS_DISABLE=~implicit~,__GL_SHADER_DISK_CACHE=0):VS_stub + PS)VS_stub + bary_GS + PS)tools/shader_link_check.py)Location 1unwritten byvs_0.spv,VUID-RuntimeSpirv-OpEntryPoint-08743)1 compatible, 0 incompatible, 0 invalid(2 links checked)--cache-feedback)0 hits, 1 no hit reported(confirms 2-stage cache missed 3-stage pipeline)--cache-feedback)1 hits, 0 no hit reportedvk_pipeline_check_bary_fallback,vk_pipeline_check_cli,pipeline_cache_seed,vk_pipeline_check_stack,spirv_bary_fallback,d3d12_bary_fallback— all PASS 3/3python -I runtime/test/check_vk_pipeline_bary_fallback.py -v— PASS (valid 3-stageVS + GS + PScompile + cache write, incompatiblevec4bary_fallback_inputrejected withPIPELINE FAILexit 1, malformedindex.jsonbary_fallback_inputrejected with exit 2)python -I tests/test_vk_pipeline_check_index.py -v— 13/13 PASSpython -I tests/test_ctest_registration.py,tests/test_docs_links.py,tests/test_docs_table_rows.py,tests/test_text_write_line_endings.py— PASSpython -I scripts/check_no_game_data.pyon all touched files — PASSgeometryShader(MoltenVK; covered by CI'smacosjob).GPUs tested: NVIDIA GeForce GTX 1050 Ti (Pascal, 4 GB), driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045
AI-assisted: yes (Antigravity)
Checklist
mainand merges cleanly (rebased onto #1497, which is rebased onto currentmain).docs/design.md, with how it was confirmed (n/a:vk_pipeline_checkchecker change, no translator change).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)When `tools/rdna2spirv.py --bary-fallback` translates a pixel shader (for GPUs without `VK_KHR_fragment_shader_barycentric` or drivers with broken `BaryCoordKHR`), the emitted Fragment SPIR-V reads perspective barycentrics from an ordinary smooth `vec3<f32>` `Input` recorded under `"bary_fallback_input": {"location": N}` in `index.json`, while `"inputs"` lists only the `vec4<f32>` user `param` locations exported by `stubs/vs_<inputs>.spv`. Previously `vk_pipeline_check` ignored `"bary_fallback_input"` and built a 2-stage `VS_stub + PS` pipeline, leaving `Location N` unwritten by the preceding stage (`VUID-RuntimeSpirv-OpEntryPoint-08743`), omitting the `geometryShader` / `shaderClipDistance` / `shaderCullDistance` feature gates, and writing a 2-stage entry into `pipeline_cache.bin` that misses the runtime's 3-stage `VS + GS + PS` pipeline key. - Parse `"bary_fallback_input"` in `vk_pipeline_check`'s `JsonParser` into `ShaderMeta::bary_fallback_location` (accepting `null` or an object with an unsigned 32-bit `"location" < 32`, rejecting non-objects, missing `"location"`, and out-of-range locations with exit code 2 before loading Vulkan). - Cache each loaded partner stub's SPIR-V words alongside its `VkShaderModule` in `stub_cache` without re-reading disk per shader. - Skip `--bary-fallback` `ps` entries with `no geometryShader` when the selected device lacks `geometryShader`; otherwise synthesize the triangle pass-through `VK_SHADER_STAGE_GEOMETRY_BIT` module in memory via `leonida::build_bary_fallback_gs` (`runtime/src/spirv_bary_fallback.h`), gate forwarded VS `ClipDistance` / `CullDistance` on `shaderClipDistance` / `shaderCullDistance` before creating the GS module, compile the 3-stage `VS + GS + PS` graphics pipeline, and fail the check (`PIPELINE FAIL`, exit 1) if `build_bary_fallback_gs` rejects an incompatible `VS`/`PS` interface. - Add CTest `vk_pipeline_check_bary_fallback` (`runtime/test/check_vk_pipeline_bary_fallback.py`), index parser cases in `tests/test_vk_pipeline_check_index.py`, and documentation in `docs/pipeline_check.md`. Depends on: #1497 Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7152197322 AI-assisted: yes (Antigravity)@madvillain91 on GitHub · 2026-11-25 14:58 UTC · original · reviewed
Reviewed diff and independently verified commit
6a707a00d(including stacked#1497commit483f0128e) on Windows 11 with an NVIDIA Ampere GPU (againstmain71a769d7d):Environment
3.12.3(python -I)19.44.35230.0, Ninja,RelWithDebInfo)1.4.363.0617.14, Vulkan1.4.351Checks run
git diff --checkacross both commits (483f0128e,6a707a00d): cleanspirv_bary_fallback_test,shader_library_test,d3d12_bary_fallback_test,vk_pipeline_check, andpipeline_cache_seed_testcleanly in an isolated build: 0 errorsspirv_bary_fallback_test: PASSshader_library_test: PASS (SHA-256, inflate, JSON, FSSM extraction, FSPX programs and index lookup OK)d3d12_bary_fallback_test(plain &LEONIDA_VK_VALIDATION=1): PASS, 0 VUIDs (ps_bary (perspective w=1,2,4): center=(184,49,22,191) OK,ps_bary + ClipDistance[1]: left half clipped, right half interpolated OK,ps_bary_f16 (combined f16_halves relocation + bary GS): all 256 pixels OK)pipeline_cache_seed_test <vk_pipeline_check.exe>(LEONIDA_VK_VALIDATION=1): PASS, 0 VUIDs (ok: vk_pipeline_check cache hits on the runtime's device (NVIDIA GeForce RTX 3070 Ti))python -I runtime/test/check_vk_pipeline_bary_fallback.py --ctest --exe <vk_pipeline_check.exe>(plain &LEONIDA_VK_VALIDATION=1): 6/6 PASS in both modes (~5.7s)python -I tests/test_vk_pipeline_check_index.py -v(withLEONIDA_VK_PIPELINE_CHECKset): 13/13 PASS (1.62s)Diff notes
parse_bary_fallback_input()cleanly validates"bary_fallback_input"(nullor object with unsigned"location" < 32) before loading Vulkan.stub_cache(std::map<std::string, StubEntry>) preserves reference stability across concurrent worker insertions, andgs_modis always destroyed after pipeline creation.geometryShader,shaderClipDistance, andshaderCullDistancefeature gates match the runtime path ind3d12_vulkan_device.cpp.Not checked
--bary-fallbackshaders, non-NVIDIA hardware, or a GPU lackinggeometryShader/VK_KHR_fragment_shader_barycentric.LGTM from this Windows 11 + NVIDIA RTX 3070 Ti verification (AI-assisted verification; synthetic test fixtures only, no game data).
@Mby159 on GitHub · 2026-11-25 15:06 UTC · original
The new bary-fallback test script passes on an AMD Radeon 780M
The checker's new bary-fallback path builds a real pipeline on real hardware here, with synthetic fixtures: AMD Radeon 780M Graphics (RDNA3 iGPU), Windows 11, driver 32.0.32015.12012, Vulkan apiVersion 1.4.359.
Built from this PR's tree (
6a707a00d8, base71a769d7d8) with llvm-mingw clang++ 23.1.6 - this machine has no MSVC and no Windows SDK, and the build was configured withLEONIDA_BUILD_WINDOWS_RUNTIME=OFF. That is not the toolchain upstream CI uses.spirv_bary_fallback_test.exe(the new pure-CPU test forruntime/src/spirv_bary_fallback.h): exits 0.python -I runtime/test/check_vk_pipeline_bary_fallback.py --ctest --exe <build>/vk_pipeline_check.exe(run directly, not through CTest): 6 tests, all ok, none skipped. One verbose run of that script lists the six astest_invalid_bary_fallback_input_rejected_at_index_parse,test_null_and_unknown_keys_in_bary_fallback_input_parse_cleanly,test_synthetic_modules_validate_with_spirv_val,test_valid_bary_fallback_ps_compiles_with_synthesized_gs_and_writes_cache,test_bary_fallback_clip_distance_forwarding_and_unexported_ps_input_zerofill,test_broken_bary_fallback_interface_fails_pipeline_check.python -I tests/test_vk_pipeline_check_index.py: 13 tests OK, exit 0 (that file covers the newbary_fallback_inputvalidation).What that means on this card: the checker built the synthesized
VS + GS + PSpipeline and this driver accepted it. Running the checker on the same synthetic corpus givesps: 1 modules ok, 0 failed,ps pipelines: 1 ok, 0 failed, 0 skipped, noSKIPPEDand noPIPELINE FAIL, and a 7404-bytepipeline_cache.bin. Test 4 asserts the same1 okfor the run seeded with that cache and under--isolate, and test 6 asserts that a deliberately brokenVS/PSinterface fails the check with exit 1, directly and under--isolate.Scope of what ran: tests 5 and 6 skip on a device without
geometryShader; test 4 instead asserts the skip line, and none of them skipped here - this device compiled the script's own GS probe. Only the new CPU test and this new script were run; the full GPU suite was not re-run with this PR's checker.This exercises the checker half only. The runtime/D3D12 half - the
#1497dependency,d3d12_bary_fallback_test.cppand theruntime/shims/d3d12_vulkan_device.cppchange - was not built or run here, so the runtime's behaviour with a--bary-fallbackPSO is not exercised by this run. This card does reportbarycentric_fallback: falsefromtools/vk_subgroup_info.py, so the runtime would not ask for--bary-fallbackhere; what runs on it is the checker's synthesis path.AI-assisted (MiniMax Code). No game files.
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.