startup: exercise the pixel-history hook through the real translated draw path #2835

Closed
opened 2026-11-26 13:20:15 +00:00 by lambirou · 1 comment
lambirou commented 2026-11-26 13:20:15 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-26T13:20:15Z.


Context

#2828 added the bounded per-draw texel history (X2W_DRAW_DUMP_PIXEL with X2W_DRAW_DUMP_FRAME). The merged fixture startup_pixel_history covers the report format, the RGBA/BGRA decode and the source-built 3-draw control. It does not run draw_dump_after or draw_dump_flush in src/startup_stubs/d3d12_draw.inl.

tedin7's review of #2828 named the gap: a break in the runtime side (ignoring the one-texel box, misparsing the environment, skipping the 48-copy bound) would not turn the test red. The current negative control only omits draw 2 from the report list, so it guards the report and decode, not the runtime hook.

Proposed fixture

Drive the real translated draw path with the environment set:

  1. Create a guest device, a guest render target and a translated pipeline through the existing stream setup. The target must be a guest wrapper so queue_present can resolve it as a plane; the current startup_stream_consumer creates desktop targets and never presents.
  2. Set X2W_DRAW_DUMP_FRAME=1, X2W_DRAW_DUMP_PIXEL=, and X2W_DRAW_DUMP_DIR=.
  3. Present once to advance frame_number to 1, draw a translated triangle that covers the texel, then present again so draw_dump_flush writes pixel_history.txt.
  4. Assert one line with draw=, frame=1, the requested x=/y=, a non-zero key= and the expected rgba=.

Controls:

  • Without X2W_DRAW_DUMP_PIXEL, the run writes no pixel_history.txt and the full-dump path is unchanged.
  • With an off-target pixel, the report is empty or has no sample.
  • A mutant that copies from the target origin instead of the requested box must produce a different rgba= for a target whose two texels differ.

Why it matters

The feature is intended to answer "which draw changed this pixel" on a real frame. The report logic is proven; the hook that feeds it still has no end-to-end test.

Related: #2828, #1268.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6627540892 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2843). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-26T13:20:15Z. --- ## Context #2828 added the bounded per-draw texel history (X2W_DRAW_DUMP_PIXEL with X2W_DRAW_DUMP_FRAME). The merged fixture startup_pixel_history covers the report format, the RGBA/BGRA decode and the source-built 3-draw control. It does not run draw_dump_after or draw_dump_flush in src/startup_stubs/d3d12_draw.inl. tedin7's review of #2828 named the gap: a break in the runtime side (ignoring the one-texel box, misparsing the environment, skipping the 48-copy bound) would not turn the test red. The current negative control only omits draw 2 from the report list, so it guards the report and decode, not the runtime hook. ## Proposed fixture Drive the real translated draw path with the environment set: 1. Create a guest device, a guest render target and a translated pipeline through the existing stream setup. The target must be a guest wrapper so queue_present can resolve it as a plane; the current startup_stream_consumer creates desktop targets and never presents. 2. Set X2W_DRAW_DUMP_FRAME=1, X2W_DRAW_DUMP_PIXEL=<x>,<y> and X2W_DRAW_DUMP_DIR=<temp>. 3. Present once to advance frame_number to 1, draw a translated triangle that covers the texel, then present again so draw_dump_flush writes pixel_history.txt. 4. Assert one line with draw=, frame=1, the requested x=/y=, a non-zero key= and the expected rgba=. Controls: - Without X2W_DRAW_DUMP_PIXEL, the run writes no pixel_history.txt and the full-dump path is unchanged. - With an off-target pixel, the report is empty or has no sample. - A mutant that copies from the target origin instead of the requested box must produce a different rgba= for a target whose two texels differ. ## Why it matters The feature is intended to answer "which draw changed this pixel" on a real frame. The report logic is proven; the hook that feeds it still has no end-to-end test. Related: #2828, #1268.
stan495 commented 2026-11-26 14:00:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-26T13:40:17Z.


Claiming this issue.

Plan:

  • Add an end-to-end translated-draw pixel-history mode to startup_stream_consumer (tests/startup_stream_draw.cpp / tests/startup_stream_consumer.cpp) using a guest-wrapped render target (create_committed, device slot 76) and queue_present (queue slot 32) on X2W_DRAW_DUMP_FRAME=1, X2W_DRAW_DUMP_PIXEL, and X2W_DRAW_DUMP_DIR.
  • Add a Python driver (tests/startup_pixel_history_draw_check.py) registered for WARP and hardware (using startup_stream_consumer + gfx2hlsl.py) that verifies:
    1. First queue_present advances frame_number to 1; a translated green triangle scissored to (2, 1, 6, 3) over an 8x4 blue-cleared guest target runs; second queue_present flushes pixel_history.txt with draw=1 frame=1 x=3 y=2, non-zero key=, and rgba=0,255,0,255.
    2. Negative controls: omitting X2W_DRAW_DUMP_PIXEL leaves pixel_history.txt absent and writes the full-target BMP; watching off-target out-of-bounds 8,4 writes no pixel_history.txt; watching target origin 0,0 reports rgba=0,0,255,255 (distinct from (3,2), proving origin copy vs box copy).
  • Verify both WARP and local physical hardware (AMD Radeon RX 7900 XTX), plus the origin-box mutant test against d3d12_draw.inl locally before pushing.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7193673045 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2843#issuecomment-7193673045). Originally posted by [stan495](https://github.com/stan495) on 2026-11-26T13:40:17Z. --- Claiming this issue. Plan: - Add an end-to-end translated-draw pixel-history mode to `startup_stream_consumer` (`tests/startup_stream_draw.cpp` / `tests/startup_stream_consumer.cpp`) using a guest-wrapped render target (`create_committed`, device slot 76) and `queue_present` (queue slot 32) on `X2W_DRAW_DUMP_FRAME=1`, `X2W_DRAW_DUMP_PIXEL`, and `X2W_DRAW_DUMP_DIR`. - Add a Python driver (`tests/startup_pixel_history_draw_check.py`) registered for WARP and hardware (using `startup_stream_consumer` + `gfx2hlsl.py`) that verifies: 1. First `queue_present` advances `frame_number` to `1`; a translated green triangle scissored to `(2, 1, 6, 3)` over an `8x4` blue-cleared guest target runs; second `queue_present` flushes `pixel_history.txt` with `draw=1 frame=1 x=3 y=2`, non-zero `key=`, and `rgba=0,255,0,255`. 2. Negative controls: omitting `X2W_DRAW_DUMP_PIXEL` leaves `pixel_history.txt` absent and writes the full-target BMP; watching off-target out-of-bounds `8,4` writes no `pixel_history.txt`; watching target origin `0,0` reports `rgba=0,0,255,255` (distinct from `(3,2)`, proving origin copy vs box copy). - Verify both WARP and local physical hardware (`AMD Radeon RX 7900 XTX`), plus the origin-box mutant test against `d3d12_draw.inl` locally before pushing.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#2835
No description provided.