OLD-9773: d3d12: refuse a pipeline whose shader needs VK_KHR_maintenance8 on a device without it #1775
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1775"
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 potatoe0100 on 2026-11-25T11:50:26Z.
Claimed in the coordination issue as: OLD-9773 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161566908)
What and why
Carries on old PR 9773 by @Joaco9020 (draft #51, branch
old-pr/9773, listed in #17), rebased on currentmainwith the author's commit kept.The translator writes
needs_maintenance8intoindex.jsonfor a shader that samples with a texel offset outside a gather (the SPIR-VOffsetimage operand, valid only withVK_KHR_maintenance8), andvk_pipeline_checkalready reads it, but the D3D12 layer never did: on a device without the extension such a pipeline went to the driver as invalid SPIR-V.ShaderLibrarynow reads the flag intoShaderEntry::needs_maintenance8, and graphics and compute pipeline creation refuse such a shader withE_NOTIMPLand a one-line reason, as they already do for mesh limits and workgroup memory. It is not routed throughLEONIDA_STUB_PIPELINES, which is for shaders with no translation.Rebase notes:
shader_library.hkeepsmain'scode_base_knownhandling and adds the new field and read next to it;shader_library_test.cppadds"needs_maintenance8": truetomain's extendedps_outentry;d3d12_mesh_test.cppkeepsmain's DISPATCH_MESH command-signature check and adds the author's refused/created pipeline pair after it.Tested
ctest: 84 of 85 pass or skip, includingshader_library(which checks the flag is read, and absent means false). The one failure,vk_xdxr_postbuild_readback, is the no-GPU skip returning 77 withoutSKIP_RETURN_CODE, the same onmainand already fixed by #1418.ctest -R "d3d12_mesh|shader_library":shader_libraryandd3d12_meshpass,shader_library_corpusskips (needs game files). Fullctest -j 6: 385 of 385 passed. Two earlier full runs each had one or two failures in tests this change does not touch, which then passed when run alone:d3d12_multithreadran out of device memory once under-j 6,d3d12_depth_stencil_uavcrashed once under-j 3(3 of 3 passes alone), andxmem_write_watch's commit-charge check failed once (1 of 3 alone; known flaky, claimed as TEST-XMEM-COMMIT-CHECK).GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro build 26300 (d3d12_mesh_test)
AI-assisted: yes (Claude rebased and tested; the change is Joaco9020's)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: runtime only; the index field is already documented there)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T18:52:41Z.
Reviewed
88de45bf1: built and ran shader_library_test on the PR (pass) and on main (pass); copying the PR's test file into a main worktree fails to compile at the new CHECK, and a probe over shader_library.h shows the PR reads needs_maintenance8 from the index (true parsed, non-boolean ignored, absent = false) where main has no such field. All translated modules are picked at the two patched spots, so graphics and compute now refuse the shader with E_NOTIMPL on a device without VK_KHR_maintenance8. d3d12_mesh_test is Windows/Vulkan-only and was not run here - please confirm it ran on a Windows device (its device_info() leaves maintenance8 off). Non-blocking: these refusals bypass stream_unsupported(), so a traced refusal logs "-" as its reason. No finding.AI-assisted review.
Recommendation: Merge
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-26T05:33:35Z.
Independent verification of head
88de45bf1d76cc2875ae50fa5f2d130d2f0523c9, with currentmain(a73a57e13) merged in, no conflicts.Windows 11 Pro, RTX 4070 SUPER (NVIDIA 621.01), MSVC 19.52.37029, RelWithDebInfo.
d3d12_meshandshader_librarypass; neighboursvk_pipeline_check_cli,vk_pipeline_check_stackpass.d3d12_meshcase againstmain's runtime fails atline 242: create(device.p, needs8, refused) == E_NOTIMPL && !refused.p(main creates the pipeline), so the test catches what the PR adds. (shader_library_test's new check needs the newShaderEntryfield, so it does not compile againstmain.)xbox_presentandd3d12_set_descriptor_heapsfail on plainmaintoo (475/477 there);xmem_no_write_watchfailed once underctest -j 6and passed 3/3 run alone, and the PR does not touch xmem.Diff read: both the graphics and compute paths check
needs_maintenance8againstdevice_.info.maintenance8, whichmainalready fills from the device features. No problem found.No game files used. AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:39:14Z.
Independently verified head
88de45bf1d76cc2875ae50fa5f2d130d2f0523c9merged cleanly ontoorigin/main(5825b02ff89bca1a2d1331d982818e3dbb74d597) on Windows 11 (10.0.26200), MSVC19.44.35207(RelWithDebInfo), NVIDIA GeForce RTX 3090 (driver595.79), withVK_LAYER_KHRONOS_validation1.4.363.1(LEONIDA_VK_VALIDATION=1). No game files used.Red -> Green Verification
main'sruntime/shims/d3d12_vulkan_device.cppwith PR'sd3d12_mesh_test.cpp+shader_library.h):ctest -C RelWithDebInfo -R "^d3d12_mesh$": FAILED (rc=8) atline 248: create(device.p, needs8, refused) == E_NOTIMPL && !refused.p(mainaccepts theneeds_maintenance8pixel shader whendevice.info.maintenance8is false).#1775merged withorigin/main5825b02ff8,LEONIDA_VK_VALIDATION=1on RTX 3090):shader_library: Passed (ps->needs_maintenance8 && !vs->needs_maintenance8).d3d12_mesh(eager mode): Passed ([rt] d3d12: ps_offset samples with a texel offset; the device has no VK_KHR_maintenance8,4096 pixels matched,0Khronos validation errors).vk_pipeline_check_cli,vk_pipeline_check_stack, andscripts/check_no_game_data.py: Passed.Non-Blocking Finding:
LEONIDA_PIPELINE_COMPILE=on-demand(Device::prepare_console_stream)In
d3d12_mesh_test.cpp,create(device.p, needs8, refused)callsID3D12Device2::CreatePipelineState(PC vtable slot 47, which always builds eagerly viaPipelineState::build). However, Xbox titles create stream PSOs via XboxDeviceProxyslot 86 (create_pso_from_stream), which routes throughDevice::prepare_console_stream(runtime/shims/d3d12_vulkan_device.cpp) whenLEONIDA_PIPELINE_COMPILE=on-demand(the boot profile's compilation mode):needs8.desc():slot86_fn(device.p, &needs8_desc, IID_PPV_ARGS(&refused.p))returns0x80004001(E_NOTIMPL) withpso = nullptr.LEONIDA_PIPELINE_COMPILE=on-demand:slot86_fn(device.p, &needs8_desc, IID_PPV_ARGS(&refused.p))returns0x00000000(S_OK) with a non-null deferredID3D12PipelineState*(and cachesidentityinverified_programs_), becauseDevice::prepare_console_stream'sverify(name, code)checkslibrary->program_candidates(...)without checkingentry->needs_maintenance8 && !state_.info.maintenance8(so theE_NOTIMPLonly happens later at bind/draw realization rather than at slot-86 creation).#1818(RT-ONDEMAND-CONSOLE-STREAM):d3d12_mesh_test.cpphas a 2-line adjacent conflict where#1818wrapsLEONIDA_TEST_PS_SPVinvktest::shader_fixture_path(...). Adding theneeds_maintenance8check inDevice::prepare_console_stream(either here or alongside#1818) and asserting slot 86 ind3d12_mesh_test.cppwill cover both eager and on-demand modes.AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T05:47:32Z.
Verified by OreoFR — READY
c8bf0e7b6+ this PR (head88de45bf1) merged with --no-ffd3d12_meshandd3d12_mesh_heavy_cachefail on main at line 248 (create(device.p, needs8, refused) == E_NOTIMPL).shader_library_testdoes not compile on main, becauseneeds_maintenance8is a field the PR adds.d3d12_mesh,d3d12_mesh_heavy_cacheandshader_librarypass; ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p3 = main + #2478 + #1775 (no shared files): 495 tests, new failures vs main: none (main alone: 494 tests, 5 failures: loader, xs_proxy_mock, xmem_no_write_watch, api_ref_state timeout, xbox_present; xbox_present fails in every package as on main)LEONIDA_CARGO=OFF,LEONIDA_XMA2_DECODER_LIBempty), main + this PR alone; imports unchanged vs main (25 DLLs, 655 functions, no WS2_32)d3d12_mesh_test.cpp, as #1818 does; each merges cleanly on its own.AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T15:42:32Z.
Merged. Tested by @OreoFR on head
88de45bf1(RTX 4070 Laptop 8 GB, Windows 11): red: d3d12_mesh/_heavy_cache fail line 248, shader_library_test does not compile; green pass (zmasi, Tyrannys agree). Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @potatoe0100!AI-assisted: yes