runtime: trace writes to presentation textures by color #2231
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2239"
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 R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T07:04:25Z.
Refs #874.
Add an opt-in trace that compares an RGBA8 texel before and after graphics writes to the title-selected presentation resources. Records include the queue, ordered operation, pipeline key, and current color and depth attachments. A submission fence protects readback. A manual frame window and an automatic exact-RGB trigger both use the same bounded capture.
For an automatic capture, set
X2W_RED_PRODUCER_AUTO=3700,12,X2W_RED_PRODUCER_RGB=255,0,255, andX2W_PRESENT_SIGNATURE_EVERY=1. The automatic trigger waits until the first eligible color transition. Logs retain up to 64 earlier recording identities to help correlate the delayed sample.Verification
Release on Windows build 26200, MSVC 19.51.36244.0. Ran the source-built control on WARP (Microsoft Basic Render Driver) and NVIDIA GeForce RTX 4060 Laptop GPU, driver 616.56. The fixture enabled the D3D12 debug layer. All five selected CTests passed.
The synthetic test reverses known color clears and resubmits the closed recording. Automatic controls check both red and magenta, reject an earlier exact match, a later near match, and an out-of-range RGB value, and compare the paired texels to the same surface at present.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:10:15Z.
Review: COMMENTED
Review of head
2e095a4e7da6c5a2cc2e1b20a457861c1cb0a63c.Scope read:
git diff --stat origin/main...HEAD(8 files, +616/-8), then targeted reads ofd3d12_draw.inl, thed3d12_xs_device.cpphooks (draw, indirect, clear, OMSetRenderTargets, queue execute, present) andpresent_signature_sampler.h.Commands executed locally (Linux):
python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 418 links OK.python3 tests/bidi_controls_check.py: 1522 files, no bidirectional controls.git diff --check origin/main...HEAD: clean.git merge-tree --write-tree origin/main HEAD: one conflict,docs/experiments.md.gh pr checks: Linux Python checks, gfx1013 fixtures and Windows build/test pass; /O2 job skipped.P2 - merge conflict. The PR reports CONFLICTING. The only conflict is
docs/experiments.md(both sides appended sections). Rebase onorigin/mainand keep both sections; re-run the docs link check after.P2 - the new C++ and the CTest are not exercised on Linux.
startup_present_producer*is Windows/D3D12 only, so I could not run it or mutate the new logic here (for example flipping the exact-RGB compare inmatches()or the fence guard before readback). The PR body already reports 5 CTests on WARP and a hardware GPU; please confirm they were re-run after the rebase, since the conflict may touch neighbouring code. The check scripttests/startup_present_producer_check.pyneeds the backend and exe arguments, so it cannot run standalone.Observations (no action required):
list_targetscopiestargets[8](zero-initialised at declaration) intopass.trace_targetsonly when tracing is on, after the early return for no targets. A stale entry could only matter iftarget_countwere stale;target_countis reset at entry, so draws read at most the current count. OK.may_record()/enabled()gate), so default behaviour of draw, clear, indirect and execute paths is unchanged.queue_executenow routes through a lambda; both the readback and plain branches still callExecuteCommandListsonce.discard_red_produceris called from reset and from the failed-close path, which matches how draw dumps are discarded.Samplernow takes a third positional bool (capture_center); a named option would read clearer at the call site inpresent_signature.No P1 found. Title is neutral and the body keeps the clean-room framing.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:38:44Z.
Review: COMMENTED
Re-review of head
91bc515d26398354e5d90bf4a6385ce4833c9bf2(previous review was on2e095a4e).Previous P2 findings
docs/experiments.md: RESOLVED.git merge-tree --write-tree origin/main HEADnow yields a clean tree,gh pr viewreports MERGEABLE, no conflict markers remain indocs/experiments.mdorsrc/startup_stubs, and the new section sits next to the sections from main.d3d12_xs_device.cpp:2366-2369next to the red-producer hooks (draw, clear, execute, present) without a visible clash, and theWindows build and testCI job passes on this head. The PR body's WARP and hardware results (5 CTests) were taken before the merge. Please confirm the five selected CTests were re-run on this merged head, or say CI covers them.Commands executed locally (Linux)
git merge-tree --write-tree origin/main HEAD: clean tree.python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 419 links OK.python3 tests/bidi_controls_check.py: 1526 files, no bidirectional controls.git diff --check origin/main...HEAD: clean.gh pr checks 2239: Linux Python checks, gfx1013 fixtures and Windows build/test pass; /O2 job skipped.Findings
Sampler(every, always, capture_center)takes a third positional bool; a named option would read clearer atd3d12_xs_device.cpp:3879.Title is neutral and the clean-room framing is kept.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by SuperCraft3M on 2026-11-25T21:05:19Z.
Follow-up using the presentation color trace on Windows 11 26300.9711, RTX 4070, driver 32.0.16.2114, Release build.
On the baseline with a packed pixel-position experiment already enabled, the trace triggered on RGB (255, 0, 0). The captured full-surface mean was also (255, 0, 0), and the sampled presentation pixel was already red before the subsequent direct graphics writes. The descriptor diagnostics found a sampled texture slot backed by a zero-padded index word where the translated draw expected an SRV token.
I tried an opt-in resolver that follows a bounded chain of zero-padded indices within the graphics list's bound guest view heap. It accepts a terminal registered SRV and leaves the normal resource and view-dimension checks in place. Source-built C++ checks passed for direct and chained indices and for rejection of empty, out-of-range, cyclic, non-SRV, non-index and unreadable entries.
A later local run with this resolver and an unrelated XMem fix reached the stage where the solid-red output had been visible. The observer reported that the solid red was gone, and the automatic RGB trigger did not fire through that stage. The bounded resolver log confirms successful view resolution in this run. A descriptor-only A/B comparison, per-pass input readback, and a source-built D3D12 integration fixture remain open.