mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #42] d3d12: LEONIDA_STUB_PIPELINES, a pipeline without a translated shader is a no-op stub (boot past stop 18) #96
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#96
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/42
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/7417📝 Commits (5)
aae44fcd3d12: LEONIDA_STUB_PIPELINES creates a pipeline without a translated shader as a no-op stub9c99166d3d12: read LEONIDA_STUB_PIPELINES with GetEnvironmentVariableW (no C4996 under MSVC /W4)780d1a4d3d12: LEONIDA_STUB_PIPELINES does not stub an ambiguous FSPX programf8dad85d3d12: a stubbed pipeline's draws and dispatches are dropped, and the list stays valid0ba54d3Merge main into feat/stub-pipelines📊 Changes
7 files changed (+199 additions, -10 deletions)
View changed files
📝
docs/boot.md(+8 -0)📝
runtime/CMakeLists.txt(+7 -0)📝
runtime/shims/d3d12_com.cpp(+9 -1)📝
runtime/shims/d3d12_com.h(+3 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+36 -9)📝
runtime/test/d3d12_fspx_compute_test.cpp(+12 -0)➕
runtime/test/d3d12_stub_pipelines_test.cpp(+124 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claimed in the coordination issue: https://github.com/ItsNotRexed/Leonida/issues/7231#issuecomment-7107135285
No dependency any more:
#7007, which made every draw or dispatch with no PSO bound a no-op, was closed. Sincef8dad8586the command list drops a stub's draws and dispatches itself, so the list stays valid onmainas it is.What and why
The retail title creates every pipeline it needs at boot. One of them is
XboxBvhBuilder.dll's 52 compute programs (stop 18 of the boot chain). If a single creation fails, the title stops: the builder throws a C++ exception, and other sites assert. To follow the boot past that point, every pipeline currently needs its translated shader inLEONIDA_SHADERS. That means a full translation, and running those shaders on the GPU. On a machine whose GPU also drives the display, a bad shader can hang it.With
LEONIDA_STUB_PIPELINES=1, a pipeline whose translated shader is missing is created as a stub. That covers two cases: no shader library at all, or no library entry for this program. The stub is aPipelineStatethatcreate_graphics/create_computereturnS_OKfor before any Vulkan pipeline is built. It's never registered, so:compute_pipeline_id/graphics_pipeline_idgive 0;SetPipelineStatebinds no PSO;pipeline_is_stub) and records nothing forDrawInstanced,DrawIndexedInstanced,Dispatch,DispatchMeshandExecuteIndirectwhile it is bound.Closesucceeds and the list holds none of them. With no pipeline state bound at all, the same calls still makeClosefail, as before.No game shader is translated or run, and nothing the title draws reaches the screen. Like
LEONIDA_SKIP_INT3, this is a diagnostic for finding the next boot stop, not a way to play.0or empty is off too.[rt] d3d12: LEONIDA_STUB_PIPELINES: compute pipeline without a translated shader is a no-op stub (64 so far).On the retail executable (my own copy, local integration tree with the open boot PRs), the switch takes the run past stop 18. The builder's programs and the title's 64 compute pipelines are stubbed, and the title gets as far as recording frames and reaching
PresentX. Integration report:#7231comment 7107135285.Changes
runtime/shims/d3d12_vulkan_device.cpp:stub_pipelines()andstub_or()inPipelineState, used at four places:create_graphics;create_compute;create_graphics;create_compute.runtime/test/d3d12_stub_pipelines_test.cpp(new), registered next tod3d12_draw, with skip code 77 when there is no Vulkan device. WithLEONIDA_SHADERSunset, it checks a graphics PSO description:E_FAILand no object;0: the same;1:S_OK, an object, andgraphics_pipeline_id/compute_pipeline_id0;E_INVALIDARG.runtime/test/d3d12_fspx_compute_test.cpp: with a loaded library and the switch on, a compute PSO whose kind-0 state has no translation is stubbed (S_OK), while the bare kind-6 program with two differing translations (ambiguous) is stillE_INVALIDARG.runtime/shims/d3d12_com.cpp,d3d12_com.h:pipeline_is_stub, andstub_pipeline_in the command list, set bySetPipelineStateandReset. A stub no longer logs "pipeline from another device".runtime/test/d3d12_stub_pipelines_test.cppalso binds the stub, draws, draws indexed and dispatches, and checksClose() == S_OKwith no recorded command. The control is the same draw with no pipeline state:E_INVALIDARG.docs/boot.md: the switch, next to the other diagnostic switches.Tested
Windows 11 Pro 26200, RTX 3060, clang-cl/xwin cross build (MSVC 14.44 headers), RelWithDebInfo:
d3d12_stub_pipelines_test: PASS.d3d12_vulkan_device.cppchange stashed, it FAILs at theS_OKand object checks.d3d12_fspx_compute_test: PASS. With the ambiguity return reverted (ambiguous program stubbed), it FAILs at the ambiguous check.f8dad8586(the stub's draws and dispatches): with thed3d12_com.cppchange reverted, the test FAILs at bothClose() == S_OKchecks; with it, PASS. Together withd3d12_draw,d3d12_compute,d3d12_close_parity,d3d12_execute_indirect_validation,d3d12_bundle,d3d12_bundle_forbiddenandcommand_list: 8/8 pass, on this head and with the same change onmainf5bcc679d.mainf48adad76:runtime/does not compile there with this toolchain (three errors aroundcreate_console_descriptor_heap, in files this PR does not touch).Thanks
@lines9686-rgb:#7007, the no-PSO no-op this first relied on.@AAyberkUand@TanmaySatyam: both found that a stub's draws and dispatches madeClosefail, against the description. Fixed inf8dad8586along the lines TanmaySatyam suggested (a stub flag on the list).@KkelebekKand@sennecools: the stop 18 measurements (builder programs, compile time, watchdog) that showed why a boot needs a way past it.@MartinIndra02: tested it on an RTX 3080 with MSVC (pass).@KarolKurzyna: tested it on an RTX 3070 Ti and an Intel UHD 770 with validation on and off. The review also caught the MSVCC4996onstd::getenv, fixed by reading the switch withGetEnvironmentVariableW, and noted that the compute and loaded-library paths had no test.@Alpha325: caught that an ambiguous FSPX program was stubbed in the compute path, against the description; now refused withE_INVALIDARG, with a synthetic loaded-library test.@Kadthicu: tested on an RTX 3060 with MSVC, with a negative control for the ambiguous FSPX program.@sh1shu1: ran it on the retail executable on an RTX 4070 SUPER (stop 18 without the switch, stops 26 and 27 with it) and saw the failingCloseon a stubbed list.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.