runtime/d3d12: synthesize --bary-fallback geometry shader in graphics PSOs #1497
Closed
robot00f wants to merge 3 commits from
upstream-pr/1497 into main
pull from: upstream-pr/1497
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!1497
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1497"
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 robot00f on 2026-11-25T02:14:07Z.
Claimed in the coordination issue as: RT-BARY-FALLBACK-PSO (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7149404640)
What and why
On GPUs without
VK_KHR_fragment_shader_barycentric(for example NVIDIA Pascal),rdna2spirv.py --bary-fallbackemits a pixel shader's raw barycentrics as an ordinary perspective-interpolatedvec3<f32>Inputand records"bary_fallback_input": {"location": N}inspirv/index.json. Offlinetools/bary_fallback_gs.pyalready specified the triangle pass-through geometry shader shape, andPipelineState::create_graphicsalready supported explicit geometry stages (#2109), rectangle-list geometry stages (#984) and per-pipeline--f16-interp-fallbacklinking (spirv_f16_halves.h), butShaderLibrarydid not readbary_fallback_inputandcreate_graphicsdid not insert the pass-through geometry stage — leaving any graphics PSO with a--bary-fallbackPS without a stage writingbary_location.This PR wires
--bary-fallbackpixel shaders end to end into D3D12→Vulkan graphics PSO creation:runtime/src/shader_library.h: parses"bary_fallback_input": {"location": N}(exact non-negativeuint32_t) intoShaderEntry::bary_fallback_location.runtime/src/spirv_bary_fallback.h: pure C++20leonida::build_bary_fallback_gs(vs_words, ps_words, bary_location, gs_words, &info, &error)synthesizing a SPIR-V 1.5Geometrymodule (Trianglesin,Invocations 1,OutputTriangleStrip,OutputVertices 3) for the(VS, PS)pair:BuiltIn Positionacross the three triangle vertices and writes(1, 0, 0),(0, 1, 0),(0, 0, 1)toOutput vec3<f32>atbary_location;vec4<f32>Locationinput the PS declares (other thanbary_location) that the VS exports, leaves unread VS outputs unconsumed onVS -> GS(even if the VS exports an unread output atbary_location), and zero-fills any unexported PSLocationinput viaOpConstantNullwithout declaring a dangling GSInput(VUID-RuntimeSpirv-OpEntryPoint-08743);BuiltIn ClipDistanceorBuiltIn CullDistance(float[1..8]) and forwards it with the matching capability, rejecting mixedClipDistance+CullDistanceandShaderLayer/ShaderViewportIndex.runtime/shims/d3d12_vulkan_device.cpp: inPipelineState::create_graphicsandstage_words(StageSource::bary_fallbackfor lazy graphics pipeline builds), runsbuild_bary_fallback_gsafterlink_f16_halveson the post-link(vs, ps)words (clampingtop_locationagainstmaxGeometryInputComponents/maxGeometryOutputComponents) so relocated/synthesizedf16_halveslocations are forwarded automatically through the GS. Refuses mesh PSOs, explicitdesc.GS, rectangle-list PSOs, disabledgeometryShader/shaderClipDistance/shaderCullDistance(E_NOTIMPLviastream_unsupported), and non-trianglePrimitiveTopologyType(E_INVALIDARG).runtime/CMakeLists.txt,runtime/test/vk_test_device.h,runtime/test/*):shader_library_testwithbary_fallback_inputindex parsing checks;spirv_bary_fallback(spirv_bary_fallback_test.cpp), a portable pure-CPU test covering pass-through locations, unread VS locations, unexported PSFlatzero-fill,ClipDistance[2],CullDistance[3], combinedlink_f16_halves+build_bary_fallback_gs, and clean refusals;shaderClipDistanceandshaderCullDistancewhere available invktest::Deviceand addsd3d12_bary_fallback(d3d12_bary_fallback_test.cpp), exercising real Vulkan GPU draws through the Xbox-ABI proxy.Tested
ctest --output-on-failure -R "^(shader_library|spirv_bary_fallback|d3d12_bary_fallback)$", plusLEONIDA_LAZY_GRAPHICS=0andLEONIDA_LAZY_GRAPHICS=1): 3/3 passed on all runs:d3d12_bary_fallbackverified all 256 pixels of: (1) a non-uniform-W (w = 1, 2, 4) triangle checking perspective-correct(b0, b1, b2)+ pass-throughLocation 0(center=(184,49,22,191)vs affine(128,64,64,191)), (2)ClipDistance[1]clippingndc_x < 0while preserving barycentrics onndc_x > 0, (3) a 16-param VS + collidingf16_halves+bary_fallback_inputPSO combininglink_f16_halvesrelocation/synthesis withbuild_bary_fallback_gs, plusE_INVALIDARG/E_NOTIMPLrefusal checks.spirv_bary_fallback_test --dump-dir(gs_basic,gs_unread_vs,gs_zero_fill,gs_clip2,gs_cull3,gs_f16_linked) and validated each withspirv-val --target-env vulkan1.2andspirv-val --target-env vulkan1.3(0 errors).spirv_f16_halves,d3d12_f16_halves,d3d12_geometry,d3d12_translated_draw(4/4 passed).python -I scripts/check_no_game_data.pyon all touched files,tests/test_bary_fallback_gs.py(29),tests/test_ctest_registration.py(5),tests/test_docs_links.py(16),tests/test_docs_table_rows.py(2),git diff --check.VK_LAYER_KHRONOS_validationis not installed on this Windows 10 host; no game shaders or executable were run.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 (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T02:45:42Z.
I checked how this runtime builder handles the two kinds of fallback shader produced by #1426 (
b9191a31). The ordinary barycentric case works on my RTX 4090. The computed-I/J case needs an additional runtime change before these PRs together cover the RX 5700 XT report in #1285.I built
vs_ids,ps_baryandps_ij_computedat the translator head with both fallbacks enabled. I passed the resulting VS/PS modules and the location in their index directly tobuild_bary_fallback_gsfrom this PR's head,bff50180. Neither PS had f16-halves relocation metadata.ps_bary, location 1ps_ij_computed, location 3 withper_vertex: {"0": 0}PS pass-through Input at Location 0 is not vec4<f32>The computed input at location 0 is a flat array of three vec4s. The runtime currently reads only
bary_fallback_input.locationand expects the other inputs to be ordinary vec4s. The integration needs to carry theper_vertexmapping into GS generation and fill each array element from the corresponding vertex, as #1426's offline builder does. The existingps_ij_computedfixture would make a regression test for that link.The GPU draws used this PR's
vk_harnesson Windows 11, NVIDIA 616.64. I tested the runtime builder directly; the computed-case refusal occurred on CPU before a Vulkan pipeline was created. AI-assisted verification.Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:36:37Z.
[KEEP]
31ff7194:change-scope,no-game-data,windows,linux-gpu-toolsandmacosare all queued.ps_ij_computed) is refused by the runtime builder (PS pass-through Input at Location 0 is not vec4<f32>), becauseper_vertexis not carried into GS generation. The ordinary barycentric case works. The PR does not yet cover the RX 5700 XT report in #1285 for that case.runtime/src/spirv_bary_fallback.h,runtime/shims/d3d12_vulkan_device.cppand tests). It sits alongside open #1426, #120, #1440 and #875 on the same fallback feature, so ordering needs a maintainer decision.ps_ij_computedregression test) and green CI.Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T07:53:07Z.
Independent verification (native Windows 11, validation on):
spirv_bary_fallback+shader_librarypass; all 6 dumped GS SPIR-V modules passspirv-valunder bothvulkan1.2andvulkan1.3targets (12/12 clean).d3d12_bary_fallback,d3d12_f16_halves,d3d12_geometry,spirv_f16_halves; alsod3d12_bary_fallbackpasses withLEONIDA_LAZY_GRAPHICS=1.StageSource::bary_fallbackrebuild path is included. Looks careful.One scope note confirmed independently: this PR does not include #1426's per-vertex attribute mapping (
git merge-base --is-ancestornegative), so the computed-I/Jper_vertexcase from the original report still needs that carry-over — matching @ecox982745's comment. #1426 is itself currently conflicting vs main.AI-assisted verification.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T19:30:27Z.
Tested
483f0128emerged ontomain, Windows build under Wine, on Mesa lavapipe and RADV (gfx1036 iGPU):spirv_bary_fallbackpasses on both.d3d12_bary_fallbackpasses on lavapipe but fails on RADV, 3 of 3 runs, atd3d12_bary_fallback_test.cpp:623:CreateGraphicsPipelineStatefails for case 3 (vs_16p+ps_bary_f16). Cases 1 and 2 pass.maxGeometryInputComponents = 64. Lavapipe reports 128.Could the runtime either forward only the locations the pixel shader reads, or refuse with a logged reason when the inputs exceed the limit? The test should then skip case 3 on such devices rather than fail.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by ZroIsHere on 2026-11-26T00:59:19Z.
I opened a focused stacked follow-up for the low
maxGeometryInputComponentscase: https://github.com/robot00f/leonida/pull/1. It preserves the PS interface outputs while zero-filling declared inputs the PS never loads, so the synthesized GS only reads needed values from the VS.Imported from ubiquitarianism/leonida. Originally posted by mrgenty on 2026-11-26T21:00:43Z.
Tested at your current head
53df7d1a, merged ontomain73516a29together with #1426: this is the base of #1930, which builds on both. On an RTX 3060 (NVIDIA 621.24, Windows 11, MSVC 19.44, Vulkan validation on),shader_library,spirv_bary_fallbackandd3d12_bary_fallbackpass with no validation message, andrun_semantic_tests.pypasses: 498 files, 6,357 tests, 0 failed. The merge ontomainhad no conflict in this PR's files. The run includes #1930's commit on top, so these are this PR's tests on the combined tree, not this head alone.Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-27T00:42:38Z.
Thanks for testing on RADV
gfx1036and catching both the silent failure andVUID-RuntimeSpirv-Location-06272, @aslan2142 (and thanks @ZroIsHere forrobot00f/leonida#1)!Updated in
961d719d(merged currentmainwith no rebase/force-push):mainto clear the unrelated baseline CI failures (vk_null_descriptor_test.cppandcs_dpp_cmp.asm).Inputs onVS -> GS(runtime/src/spirv_bary_fallback.h, co-authored with @ZroIsHere):build_bary_fallback_gsnow tracks pointer aliases rooted at PSInputvariables (throughOpAccessChain/OpPtrAccessChain,OpCopyObject,OpSelect, andOpPhiintoOpLoad,GLSL.std.450InterpolateAt*,OpFunctionCall, andOpCopyMemory*) and zero-fills unread FSSM table declarations in the synthesized GS without declaring GSInputs from the VS.[rt] d3d12:diagnostics (runtime/shims/d3d12_vulkan_device.cpp):maxGeometryInputComponents,maxGeometryOutputComponents, andmaxGeometryTotalOutputComponentsfromVkPhysicalDeviceProperties::limits.BaryFallbackGsInfonow reports both per-vertex scalar component totals and highest4 * Location + componentsbounds (VUID-RuntimeSpirv-Location-06272), andcreate_graphicsrefuses pipelines that exceed device geometry limits beforevkCreateShaderModule/vkCreateGraphicsPipelineswhile logging the shader names, location/component count, and device limit (including when--bary-fallbackcapsf16_halvestop_location).spirv_bary_fallback_test&d3d12_bary_fallback_testformaxGeometryInputComponents = 64GPUs:ps_bary_pruned(16-param VS + 25 unread PS inputs pruned so live inputs stay< 16) andps_bary_f16_low(10-param VS +f16_halvesrelocated into0..14), both running within 64 geometry input components.vs_16p + ps_bary_f16case (where raw VS outputs occupy0..15, so relocatedf16_halvessit at[28, 29]and genuinely require>= 120geometry components), devices withmaxGeometryInputComponents < 120ormaxGeometryOutputComponents < 120now assert clean refusal andSKIPthat draw check instead of failing.max_geometry_input_components = 64test block exercising both the pruned/10-param passes and theLocation 16(4 * 16 + 4 = 68 > 64) / 16-param refusals on all GPUs.Validated locally on NVIDIA GeForce GTX 1050 Ti (driver 582.28, Windows 10 19045) with
spirv_bary_fallback,d3d12_bary_fallback(eager + lazy),d3d12_f16_halves,d3d12_geometry,spirv_f16_halves,shader_library,spirv-val(vulkan1.2+vulkan1.3on all 7 synthesized GS binaries), and the Python/semantic test suites.AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:34:54Z.
Independent Windows 11 + NVIDIA GeForce RTX 3090 Verification (
961d719d54merged ontomain53b77df14f)Environment: Windows 11 (
10.0.26200), MSVC19.44.35228, Python3.12.10(-I), SPIRV-Tools /VK_LAYER_KHRONOS_validation1.4.363.1, physical NVIDIA GeForce RTX 3090 (Ampere, driver610.88, Vulkan1.4,maxGeometryInputComponents = 128,maxGeometryOutputComponents = 128). Synthetic in-memory SPIR-V fixtures only; no game files.Results — PASS (
0validation errors)main(5825b02ff8):ShaderLibrarydoes not parsebary_fallback_input, leaving graphics PSOs whose pixel shader expects a synthesized--bary-fallbackgeometry stage without a producer forbary_location.spirv_bary_fallback_test --dump-dir):spirv_bary_fallback_test:rc=0across all 7 cases (gs_basic,gs_unread_vs,gs_zero_fill,gs_clip2,gs_cull3,gs_f16_linked,gs_pruned_unused, including the new unread-PS-input pointer-alias pruning).spirv-val(--target-env vulkan1.2and--target-env vulkan1.3):14/14clean (0errors) across all 7 dumped GS binaries.LEONIDA_VK_VALIDATION=1):d3d12_bary_fallback_testunder bothLEONIDA_LAZY_GRAPHICS=0(eagercreate_graphicspath) andLEONIDA_LAZY_GRAPHICS=1(StageSource::bary_fallbacklazy rebuild path) —rc=0,0VUID-errors on both:ps_bary(non-uniform clipw = 1, 2, 4):center=(184,49,22,191)exact across all256pixels.ps_bary + ClipDistance[1]: left half clipped to(0,0,0,0), right half perspective-interpolated across all pixels.ps_bary_pruned(25unread PSInputs pruned, liveLocation 7+bary 14): all256pixels exact.ps_bary_f16_low(10-param VS +f16_halvesrelocation<= 14+ bary GS): all256pixels exact.ps_bary_f16(16-param VS +f16_halvesrelocated to[28, 29]+ bary GS — active on RTX 3090 since128 >= 120): all256pixels exact.max_geometry_input_components = 64(RADV limit): pruned &10-param PSOs succeed, while16-param and liveLocation 16(4 * 16 + 4 = 68 > 64) refuse cleanly withE_NOTIMPL.ctest -R "^(shader_library|spirv_bary_fallback|d3d12_bary_fallback|spirv_f16_halves|d3d12_f16_halves|d3d12_geometry)$"(LEONIDA_VK_VALIDATION=1):6/6passed (2.16s).tests/test_bary_fallback_gs.py(34/34 OK) andtests/test_ctest_registration.py(7/7 OK).(Confirmed the scope note from earlier comments:
per_vertexarray forwarding for computed-I/J--bary-fallbackpixel shaders remains separate follow-up work.)AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T09:04:28Z.
RUN of #1497 (red/green, GPU box, PR head only: it conflicts with main)
Heads: PR head
961d719d544, main54b2a81e95c4.git merge --no-ffof the PR into main conflicts inruntime/src/shader_library.h(the other touched files auto-merge), so I aborted the merge and tested the PR head as it is (detached, based ond1dff7949be6, the merge-base with main). The results below are for that base, not for current main.Commands (VS 2022 x64 environment, from the worktree root):
cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ONcmake --build runtime/build -j 8 --target shader_library_test spirv_bary_fallback_test d3d12_bary_fallback_test spirv_f16_halves_test d3d12_f16_halves_test d3d12_geometry_test d3d12_translated_draw_test gta6rtctest -R "^(shader_library|spirv_bary_fallback|d3d12_bary_fallback|spirv_f16_halves|d3d12_f16_halves|d3d12_geometry|d3d12_translated_draw)$" --output-on-failure -j1shader_library.h,d3d12_com.h,d3d12_vulkan_device.cpp, andspirv_bary_fallback.hremoved; tests and CMake registration kept): build failures only,bary_fallback_locationis not a member ofShaderEntry(shader_library_test) andspirv_bary_fallback.his missing (spirv_bary_fallback_test,d3d12_bary_fallback_test). That only proves the new API is needed.d3d12_vulkan_device.cppreverted to the merge-base, the new header, the index parsing and the tests kept, so everything compiles):d3d12_bary_fallbackfails on the first pixel check,persp (0,0): got (0,0,0,191) want (203,3,49,191), i.e. no geometry stage is inserted so the barycentrics are never written. That is the wiring this PR adds.shader_library,spirv_f16_halves,spirv_bary_fallback,d3d12_f16_halves,d3d12_bary_fallback,d3d12_translated_draw,d3d12_geometry: 7 of 7 Passed on the RTX 3090, none skipped (sogeometryShader,shaderClipDistanceandshaderCullDistancewere available).dumpbin /importsofgta6rt.exe, DLL!symbol, sorted: 700 entries before and after the PR).vk_test_device.h(the PR only adds two feature enables there, gated on the device having them).Author: this branch conflicts with current main in
runtime/src/shader_library.h; could you merge main into it? Thank you.Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44 (VS 2022 Build Tools), CMake + Ninja, RelWithDebInfo,
-DLEONIDA_REQUIRE_VULKAN=ON, Vulkan SDK 1.4.363.1.Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-29T09:25:41Z.
I tested a local merge of PR head
961d719d544065e08053e758d256de53bd2eea34with main54b2a81e95c470c953ddee6177fd6255cbaf041d. Git reported one conflict, in the include block ofruntime/src/shader_library.h. Keep both headers in the resolution.<memory>supports main's block index reader and<optional>supports the fallback metadata.The other changes merged cleanly. The resulting tree was
c80ebbecfd12b7372c22de74fb9dea83094f4c26.shader_library,spirv_bary_fallbackandspirv_f16_halvespassed. The generator dumped seven geometry modules. Each passedspirv-valfor both Vulkan 1.2 and 1.3.d3d12_bary_fallback,d3d12_f16_halves,d3d12_geometryandd3d12_translated_drawall passed with NVIDIA RTX 4090, driver 616.64, Windows 11 build 26300, MSVC 19.44 Release and Khronos Vulkan validation enabled. All four ran on the named GPU and CTest reported zero failures. The changed-file game-data check passed.Coordination claim
AI-assisted with OpenAI Codex (GPT-6.2 Sol).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:17:30Z.
Needs rebase: conflicts with
main3535eb5c4inruntime/src/shader_library.h. The lastmainchange to those lines isd66464eb4(2026-11-29, "Merge pull request #1218 from sodove/perf/shader-index-block-read"). Not inmainyet (git cherry: 2 commit(s) not there), and no duplicate found among the open pull requests.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:36:26Z.
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