runtime/d3d12: synthesize --bary-fallback geometry shader in graphics PSOs #1497
Closed
leonida/mandy
robot00f wants to merge 0 commits from
feat/rt-bary-fallback-pso into main
pull from: feat/rt-bary-fallback-pso
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!1497
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/rt-bary-fallback-pso"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
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.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.[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.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.
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).
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.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.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
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.
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.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).
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).
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.