gpu: explicitly clear the pixel-history fixture target #2860
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2868"
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 chadhyatt on 2026-11-26T15:01:35Z.
AI-assisted backport patch from x2w-microlift.
The optimized clear value passed to CreateCommittedResource does not initialize the texture contents (API contract). The fixture currently assumes black initial pixels. Clear explicitly once before each independent sequence and keep the existing readback/history oracle unchanged. Refs #1268; follows #2828, separate from #2851.
Verification at
bd84fbff20on macOS ARM64: Clang x64 Windows cross-std=c++17 -fms-extensions -fsyntax-only tests/startup_pixel_history.cppwith MinGW headers passed. Windows MSVC and GPU execution not available; relevant native check:cmake --build --preset dev --target startup_pixel_historyandctest --preset dev --no-tests=error -R "^startup_pixel_history_(warp|hardware)$" -V.Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-27T01:20:24Z.
Independent Windows/AMD result on
bd84fbff— measurements only, not a code change.Environment
Windows 11, build 26200.9974. MSVC toolset
14.44.35207(BuildTools 2022).ctest -NreportsTotal Tests: 2442. D3D12 debug layer not installed (d3d12SDKLayers.dllabsent fromSystem32and from the Windows Kitsbintree, noTools.Graphics.DirectXcapability package), so this run carries no validation output. Adapters: WARPMicrosoft Basic Render Driver(1414:008c) andAMD Radeon RX 9070 XT(1002:7550, driver32.0.32029.2010). The fixture compiles its HLSL throughD3DCompile, not DXC.Commands
Observed
Head, three consecutive runs, both entries pass on both adapters. The fixture's own lines are the same in all six runs (three on the base, three on the head); only ctest's per-test durations vary between runs:
The base commit
b505c32bpasses the same two entries, three runs out of three, with the same fixture lines. So on this machine the PR repairs no observable failure: it removes a dependency.Controls (mine, not in the PR)
D3D12_CLEAR_VALUEinitialisers (tests/startup_pixel_history.cpp:101and:125) set to opaque magenta{1,0,1,1}: stillraw=00000000at draw 1 and in the control, PASS on both adapters. On these adapters the optimised clear value does not show up in the readback, so the black the old fixture watched was not produced by the field it declared.ClearRenderTargetView(target.rtv, black, ...)(:120) changed to magenta: both entries fail on both adapters,draw 1: ... raw=ffff00ffandcontrol without draw 2: ... raw=ffff00ff,first_black=0 ... control_black=0. Magenta is the colour of no draw, so that word cannot come from one. Each mutation is traced in the logs (sha256 before and after, the edited line,git status --porcelain --untracked-files=noshowingM tests/startup_pixel_history.cpp), and the file was restored to0a4203ac…afterwards.What this leaves
Nothing reads the target between the clear and draw 1, so the added clear is only observed after a draw — and with
blacka no-op clear is indistinguishable from memory that already reads zero, which is what this allocation does on both adapters. The control sequence is the only place where the clear is observable, and only because draw 2 would otherwise leave green there. Clearing to a colour no draw uses and asserting the texel straight afterclear_targetwould turn the dependency into a guard; the copy and decode path is already there inrecord_draw.CI
startup_pixel_historyis absent from theprconfigure preset's target list, so on apull_requestthis file is not even compiled, and no job names the entry. After merge, the dev sweep runsctest --preset dev -E '_hardware$'(windows.yml:494):_warpruns,_hardwarenever.Limits
One machine, one hardware adapter plus WARP, no debug layer. The mutation shows the declared value is not what the readback sees; it does not identify the cause of the zero (a zeroed allocation, or a driver keeping the value behind the fast-clear path — either way the old fixture's green stays uncontrolled). The fixture exercises two sequences on one 4x4
R8G8B8A8_UNORMtarget with one texel copied: no blending, depth, MSAA, mip, UAV, and no cross-resource aliasing of that allocation. The sample metadata (frame=7,count=3,key) is filled by the test, so the GPU supplies the RGBA bytes only. The hardware entry returns 77 when no non-software adapter is found, so "passes" always means a GPU was present.AI-assisted; runs executed on the machine above.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T03:00:55Z.
Review: APPROVED
Reviewed
bd84fbff208b31e6af8e13c57c94a54f20533692. Both explicit clears are submitted and fence-complete before the next sequence, with the target back in render-target state. I independently built the exact-head fixture and its headers with MSVC (cl /EHsc /std:c++17, separately/Od /Ziand/O2) and ranpixel_history.exe warpandpixel_history.exe hardwarefor both builds. All four runs passed on Windows 11 build 26200.9974, Microsoft Basic Render Driver 10.0.26100.9818 and RTX 4060 Laptop driver 32.0.16.1656. The first and control samples were00000000, and draws 2 and 3 wereff00ff00. The fixture does not enable the D3D12 debug layer. The independent AMD report also demonstrates that a magenta explicit clear changes the readback, and documents the remaining limits. The required Windows check passed.