shader: record a diagnostic draw while translation is missing #3220
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3220
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3218"
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?
@Leyukaka on GitHub · 2026-11-27 22:14 UTC · original
Leyukaka:shader/missing-draw-fallback→main· +198 −19 · 7 files · 1 commits · merged 2026-11-27 22:21 UTCAdd an opt-in D3D12 fallback for direct, non-indexed triangle-list draws while the translation manifest is absent. Enable it with
X2W_DRAW_MISSING_SHADER=1.The fallback uses the bound single-sample attachment formats and clips all geometry. It records the draw without writing colour, depth or UAV data. It has its own render counter and keeps the normal translation request and manifest polling active. Downstream passes still need the original shader's outputs.
The WARP fixture checks three IA vertices and unchanged colour and depth readbacks with fallback enabled. The disabled control checks zero IA vertices. Both verify that a shader request was published, then publish a source-built translation and check that the same guest pipeline renders red.
Tested at
1d011315on Windows build 26300 with WARP (Microsoft Basic Render Driver 10.0.26100.9818). The D3D12 debug layer was unavailable. All five selected tests passed, including three existing indirect draw regressions.@pigalot on GitHub · 2026-11-27 22:21 UTC · original · approved these changes
I reviewed
1d011315merged overmaine582a9a4. The merge is clean (tree1c9afeb5) andgit diff --cached --checkis clean.What I traced.
When it applies: the fallback is reached only from
list_draw(slot 12, non-indexed) throughdraw_startup_direct. It applies only when a translation exists and its manifest retry is pending. It also needs:X2W_DRAW_MISSING_SHADERto be exactly1;Indexed and indirect draws keep their existing paths.
The PSO: it takes the bound RTV and DSV formats, with blend, depth and stencil left at zero. So there are no colour writes and depth and stencil are off. The vertex shader puts every vertex at the same point outside the clip volume, and the pixel shader discards. So nothing can reach the attachments, and nothing reads a guest buffer or binds a heap.
The cache: the cached root signature holds a reference to the guest root, so a pointer key cannot be reused while the entry lives. The map is only touched under
draw_lock.State afterwards: the translated path calls
SetPipelineStateandSetGraphicsRootSignatureitself, so a fallback draw does not leak its PSO into a later translated draw in the same list. The guest root is reused when there is one, so its bindings are kept. The native topology is the guest's (slot 20 forwards it).Counters: a fallback draw counts in its own counter and in neither
translated drawsnornot drawn, as documented.What I ran. I built
startup_indirect_draw_indexed startup_indirect_dispatch startup_stream_consumerindevandrelease, then ran/O2. That covers the two new cases and the existing indirect fixtures on WARP, with no skips.tests/docs_links_check.pyalso passes.main, the two new tests are not registered. Mutant 1 below ismain's behaviour for this draw, and it fails the enabled case.Mutants in
src/startup_stubs/d3d12_draw.inl. For each, I rebuilt indevand ran both new tests:missing translation: IA vertices 0, expected 3)IA vertices 3, expected 0)published translation (rtv0) pixel (0,0): got 0xff000000, expected 0xff0000ff)Restored and rebuilt afterwards;
git diff --quietis clean.Non-blocking.
clip(-1), the off-screen position and the zero write mask each guard the attachments on their own. The fixture can't tell them apart, which is fine for a no-write draw.missing shader fallback drawsis not checked by the fixture. A one-line assert on the render totals would pin it.Verdict: approve on
1d011315.Environment: WARP (Microsoft Basic Render Driver) on Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0, Python 3.12.10, debug layer off.
CI:
Build and test on Windowspasses on1d011315.This reply was AI-assisted.