mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #1890] vk_pipeline_check: synthesize --bary-fallback GS stage for PS pipelines (VK-PIPELINE-CHECK-BARY-FALLBACK) #1902
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1902
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1890
Author: @robot00f
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:feat/vk-pipeline-check-bary-fallback📝 Commits (2)
53df7d1runtime/d3d12: synthesize --bary-fallback geometry shader in graphics PSOs79a2437vk_pipeline_check: synthesize --bary-fallback GS stage for PS pipelines📊 Changes
12 files changed (+2413 additions, -28 deletions)
View changed files
📝
docs/pipeline_check.md(+11 -4)📝
runtime/CMakeLists.txt(+16 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+90 -10)📝
runtime/src/shader_library.h(+10 -0)➕
runtime/src/spirv_bary_fallback.h(+428 -0)➕
runtime/test/check_vk_pipeline_bary_fallback.py(+524 -0)➕
runtime/test/d3d12_bary_fallback_test.cpp(+678 -0)📝
runtime/test/shader_library_test.cpp(+34 -0)➕
runtime/test/spirv_bary_fallback_test.cpp(+495 -0)📝
runtime/test/vk_pipeline_check.cpp(+110 -14)📝
runtime/test/vk_test_device.h(+2 -0)📝
tests/test_vk_pipeline_check_index.py(+15 -0)📄 Description
Claimed in the coordination issue as:
VK-PIPELINE-CHECK-BARY-FALLBACK(https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7152197322; 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).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.