startup: exercise the pixel-history hook through the translated draw path #2843
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2851"
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 stan495 on 2026-11-26T13:50:38Z.
Fixes #2843
Refs #2828
Exercises the runtime
X2W_DRAW_DUMP_PIXEL/X2W_DRAW_DUMP_FRAMEhooks (draw_dump_afteranddraw_dump_flushinsrc/startup_stubs/d3d12_draw.inl) end-to-end through the real translated draw path andqueue_present.Summary of changes
tests/startup_stream_draw.cpp: Adddraw_pixel_history(X2W_TEST_PIXEL_HISTORY=1), which creates a guest-wrapped8x4DXGI_FORMAT_R8G8B8A8_UNORMrender target and readback buffer (deviceslot27), clears to opaque blue(0, 0, 255, 255), callsqueue_present(queue slot32) to advanceframe_numberto1, records and submits a translated green(0, 255, 0, 255)triangle scissored to{2, 1, 6, 3}, callsqueue_presentagain to flushdraw_dump_flush(), and reads back the target bytes via guestCopyTextureRegion(listslot16).tests/startup_pixel_history_draw_check.py: Runsstartup_stream_consumer+gfx2hlsl.pywithX2W_D3D12_RENDER=1,X2W_DRAW_DUMP_FRAME=1, andX2W_DRAW_DUMP_DIR:X2W_DRAW_DUMP_PIXEL=3,2: checks target readback has blue(0, 0, 255, 255)at(0, 0)and green(0, 255, 0, 255)at(3, 2), andpixel_history.txtreportsx2w-pixel-history 1 samples=1withdraw=1 frame=1 x=3 y=2,key=eb5897b13a530568(non-zero, matchinggfx2hlsl.pipeline_key), andrgba=0,255,0,255.X2W_DRAW_DUMP_PIXEL=0,0: verifies(0, 0)reportsrgba=0,0,255,255(distinct from(3, 2)).X2W_DRAW_DUMP_PIXEL=8,4: verifies no sample is written (pixel_history.txtabsent or empty).X2W_DRAW_DUMP_PIXEL): verifies nopixel_history.txtis written anddraw_01_eb5897b13a530568_3.bmpis emitted.tests/cmake/startup_pixel_history_draw.cmake: Registersstartup_pixel_history_draw_warpandstartup_pixel_history_draw_hardware.Verification
0c0065b0(based onupstream/main7538470e)Microsoft Windows NT 10.0.26200.0MSVC 19.44.35228.0+ Ninja (Release) + Windows SDK FXC10.0.26100.0CTest (
startup_pixel_history*)Observed (
4/4 Passed):startup_pixel_history_warp(WARPMicrosoft Basic Render Driver): Passedstartup_pixel_history_hardware(AMD Radeon RX 7900 XTX,vendor=0x1002 device=0x744c): Passedstartup_pixel_history_draw_warp(WARPMicrosoft Basic Render Driver,driver=10.0.26100.9818):warp covered (3,2): draw=1 frame=1 x=3 y=2 key=eb5897b13a530568 count=3 format=28 raw=ff00ff00 rgba=0,255,0,255warp origin control (0,0): draw=1 frame=1 x=0 y=0 key=eb5897b13a530568 count=3 format=28 raw=ffff0000 rgba=0,0,255,255warp off-target control (8,4): no samplewarp full-dump control: draw_01_eb5897b13a530568_3.bmp written, no pixel_history.txtstartup_pixel_history_draw_hardware(AMD Radeon RX 7900 XTX,driver=32.0.32029.2010):hardware covered (3,2): draw=1 frame=1 x=3 y=2 key=eb5897b13a530568 count=3 format=28 raw=ff00ff00 rgba=0,255,0,255hardware origin control (0,0): draw=1 frame=1 x=0 y=0 key=eb5897b13a530568 count=3 format=28 raw=ffff0000 rgba=0,0,255,255hardware off-target control (8,4): no samplehardware full-dump control: draw_01_eb5897b13a530568_3.bmp written, no pixel_history.txtDebug-layer and static checks
Observed:
x2w-d3d12 debug layer: 0x00000000 enabledcleanly across all runs on both WARP andAMD Radeon RX 7900 XTX;bidi_controls_check.py(Checked 2038 tracked source, script and build/CI files: no bidirectional controls.) anddocs_links_check.py(Checked 27 Markdown files and 542 links.) exited0.Origin-box mutant check
Temporarily mutated
src/startup_stubs/d3d12_draw.inl(const D3D12_BOX box{0, 0, 0, 1, 1, 1};instead of{pixel.x, pixel.y, 0, pixel.x + 1, pixel.y + 1, 1}), rebuiltd3d12_xs_shim, and ranstartup_pixel_history_draw_check.py ... warp. Observed failure (exit 1):AssertionError: draw=1 frame=1 x=3 y=2 key=eb5897b13a530568 count=3 format=28 raw=ffff0000 rgba=0,0,255,255Reverted
src/startup_stubs/d3d12_draw.inlcleanly and rebuiltd3d12_xs_shimbefore re-runningctest(4/4 Passed).Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T13:58:46Z.
Review: COMMENTED
Win2025 WARP receipt for head
0c0065b0(3 commits behind main, PR files untouched by them).Review: the tests only; the hook code in
src/startup_stubs/d3d12_draw.inl(draw_dump_after,draw_dump_flush) is unchanged. The newstartup_pixel_history_draw_{warp,hardware}tests are registered next to the siblingstartup_pixel_history_*tests from #2828. Covered texel, origin control, off-target control and full-dump control are all asserted on the real translated draw path.Mutations of the code under test (Win2025 dev,
startup_pixel_history_draw_warp), both made the new test FAIL:draw_dump_afterreturns early when a pixel is watched:AssertionError: missing ...\dump_covered\pixel_history.txtAssertionError: draw=1 frame=1 x=3 y=2 ... rgba=0,0,255,255Unmutated head:
ctest --preset dev -R '^startup_pixel_history'4/4 passed (the two #2828 tests and the two new tests).ctest -R '^startup_pixel_history_draw'2/2 passed in each (startup_pixel_history_draw_warp,startup_pixel_history_draw_hardware; the "hardware" test runs on WARP here).git diff --check,tests/docs_links_check.py,tests/bidi_controls_check.pyclean.Real-GPU run not available (RunPod stopped). Test-only change, no startup claim.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T13:58:52Z.
Win2025 WARP receipt for head
0c0065b0.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
0c0065b0a825d86e4018562be2e6b3203df1b4bf:--preset dev):cmake --build --preset dev --target startup_stream_consumer -- -j 2):5.86s(configure0.00s)ctest --preset dev -R '^startup_pixel_history_draw' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (1.57s:startup_pixel_history_draw_hardware1.30s,startup_pixel_history_draw_warp1.32s)/O2(--preset release):cmake --build --preset release --target startup_stream_consumer -- -j 2):7.37s(configure0.00s)ctest --preset release -R '^startup_pixel_history_draw' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (1.35s:startup_pixel_history_draw_hardware1.10s,startup_pixel_history_draw_warp1.13s)sccache: 10/19 hits; wall24.7stested:
0c0065b0via fetch (pull/2851/head, no patch)AI-assisted; commands listed were executed locally.