d3d12x: render a triangle through a graphics list #1221

Merged
lambirou merged 1 commit from upstream-pr/1228 into main 2026-11-24 04:45:33 +00:00
lambirou commented 2026-11-24 04:25:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T04:25:36Z.


Change

Add a graphics command-list fixture that renders a source-built triangle through the device
returned by D3D12XboxCreateDevice (XCL-12, on top of merged XCL-10).

  • The fixture creates a DIRECT queue, command allocator and graphics list, an empty v1.0 root
    signature with ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT, and a VS/PS PSO compiled by DXC.
  • It uploads three POSITION float4 vertices for a clip-space triangle, records the upload,
    render-target and readback transitions, clears a 32x32 R8G8B8A8_UNORM target, draws three
    vertices, copies the target into a readback buffer and compares all 1,024 pixels with a CPU
    reference.
  • Negative controls omit the draw and use an empty scissor; both leave the clear color and report
    1,024 mismatches starting at pixel (0,0). A missing render-target transition is rejected
    with wrong_state render_target=COMMON expected=RENDER_TARGET operation=ClearRenderTargetView(rtv).
  • No src/ change and no production export. The public Microsoft D3D12/Xbox material and the
    Windows SDK do not expose a D3D12Xbox...CommandList creation or recording export; the
    documented desktop methods on the returned device are used.

Verification

  • cmake --preset dev and cmake --build --preset dev --target d3d12x_graphics_list_check d3d12_xs_shim: passed with MSVC 19.44.
  • ctest --preset dev --no-tests=error -R '^d3d12x_graphics_list_' -V: 2/2 passed.
  • ctest --preset dev --no-tests=error -R '^d3d12x_': 19/19 passed after building the compute
    fixture.
  • WARP (Microsoft Basic Render Driver 1414:008c, driver 10.0.26100.10068): positive triangle,
    1,024 pixels, 0 mismatches, FNV-1a 0xff2379c5. Omitted draw and empty scissor: 1,024
    mismatches, clear color only, hash 0x1f116dc5, first mismatch (0,0).
  • Hardware (AMD Radeon RX 9060 XT 1002:7590, driver 32.0.32029.2010): same counts and hash, no
    skip. Windows 10 Pro 26H2 build 26300.10075; debug layer unavailable.
  • tests/docs_links_check.py: Self-test passed., Checked 16 Markdown files and 276 links..
  • git diff --check origin/main...HEAD: clean.
  • Not run: the release preset and the full repository suite outside ^d3d12x_.

Evidence

  • Branch d3d12x/graphics-lists, head 392ba968, based on origin/main 5a0dbd5c.
  • docs/experiments.md records the exact commands, environment, positive hash and negative
    controls; the capability matrix names the new tests.
  • Boundary: this is the desktop graphics command-list path on the D3D12.X device. It does not
    claim a console command-list ABI, PresentX, bundles or multi-queue. The constant-color PSO does
    not measure interpolation, textures, depth, blending or MSAA. The state audit is fixture-owned;
    it is not evidence that the runtime without a debug layer rejects those states.
  • Provenance: public Microsoft D3D12 command-list, barrier, clear, draw and copy documentation,
    the Windows SDK d3d12.h, and the existing local D3D12.X device/heap evidence. No XCL code,
    table or output.
  • No game files, dumps, shader bytes from a title, title paths or secrets.

Checklist

  • One reviewable behavior: one graphics command list renders and reads back a known triangle.
  • Positive pixel-exact comparison and omitted-draw, empty-scissor and wrong-state controls.
  • Documentation and capability matrix updated.
  • No game files, dumps, logs or secrets.
  • Provenance checked; no XCL code used.
  • AI-assisted (Codex).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6574593152 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1228). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T04:25:36Z. --- ## Change Add a graphics command-list fixture that renders a source-built triangle through the device returned by `D3D12XboxCreateDevice` (XCL-12, on top of merged XCL-10). - The fixture creates a DIRECT queue, command allocator and graphics list, an empty v1.0 root signature with `ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT`, and a VS/PS PSO compiled by DXC. - It uploads three `POSITION` float4 vertices for a clip-space triangle, records the upload, render-target and readback transitions, clears a 32x32 `R8G8B8A8_UNORM` target, draws three vertices, copies the target into a readback buffer and compares all 1,024 pixels with a CPU reference. - Negative controls omit the draw and use an empty scissor; both leave the clear color and report 1,024 mismatches starting at pixel `(0,0)`. A missing render-target transition is rejected with `wrong_state render_target=COMMON expected=RENDER_TARGET operation=ClearRenderTargetView(rtv)`. - No `src/` change and no production export. The public Microsoft D3D12/Xbox material and the Windows SDK do not expose a `D3D12Xbox...CommandList` creation or recording export; the documented desktop methods on the returned device are used. ## Verification - `cmake --preset dev` and `cmake --build --preset dev --target d3d12x_graphics_list_check d3d12_xs_shim`: passed with MSVC 19.44. - `ctest --preset dev --no-tests=error -R '^d3d12x_graphics_list_' -V`: 2/2 passed. - `ctest --preset dev --no-tests=error -R '^d3d12x_'`: 19/19 passed after building the compute fixture. - WARP (Microsoft Basic Render Driver 1414:008c, driver 10.0.26100.10068): positive triangle, 1,024 pixels, 0 mismatches, FNV-1a `0xff2379c5`. Omitted draw and empty scissor: 1,024 mismatches, clear color only, hash `0x1f116dc5`, first mismatch `(0,0)`. - Hardware (AMD Radeon RX 9060 XT 1002:7590, driver 32.0.32029.2010): same counts and hash, no skip. Windows 10 Pro 26H2 build 26300.10075; debug layer unavailable. - `tests/docs_links_check.py`: `Self-test passed.`, `Checked 16 Markdown files and 276 links.`. - `git diff --check origin/main...HEAD`: clean. - Not run: the release preset and the full repository suite outside `^d3d12x_`. ## Evidence - Branch `d3d12x/graphics-lists`, head `392ba968`, based on `origin/main` `5a0dbd5c`. - `docs/experiments.md` records the exact commands, environment, positive hash and negative controls; the capability matrix names the new tests. - Boundary: this is the desktop graphics command-list path on the D3D12.X device. It does not claim a console command-list ABI, PresentX, bundles or multi-queue. The constant-color PSO does not measure interpolation, textures, depth, blending or MSAA. The state audit is fixture-owned; it is not evidence that the runtime without a debug layer rejects those states. - Provenance: public Microsoft D3D12 command-list, barrier, clear, draw and copy documentation, the Windows SDK `d3d12.h`, and the existing local D3D12.X device/heap evidence. No XCL code, table or output. - No game files, dumps, shader bytes from a title, title paths or secrets. ## Checklist - [x] One reviewable behavior: one graphics command list renders and reads back a known triangle. - [x] Positive pixel-exact comparison and omitted-draw, empty-scissor and wrong-state controls. - [x] Documentation and capability matrix updated. - [x] No game files, dumps, logs or secrets. - [x] Provenance checked; no XCL code used. - [x] AI-assisted (Codex).
upstream-sync closed this pull request 2026-11-24 06:47:06 +00:00
tedin7 commented 2026-11-24 06:47:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:37:13Z.

Review: COMMENTED


Technical review on Linux at commit 392ba968 (Windows build and D3D12 runtime tests were not executed locally).

Diff & fixture audit

  • CMakeLists.txt: compiles tests/d3d12x_graphics.hlsl (VSMain as vs_6_0, PSMain as ps_6_0) via DXC into headers and registers d3d12x_graphics_list_warp (timeout 60s) and d3d12x_graphics_list_hardware (SKIP_RETURN_CODE 77, timeout 60s).
  • tests/d3d12x_graphics_list_check.cpp: loads d3d12_xs.dll explicitly, verifies D3D12XboxCreateDevice resolves inside that module, creates an ID3D12Device, and records a DIRECT graphics command list (empty v1.0 root signature with ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT, 1 POSITION input, R8G8B8A8_UNORM 32x32 target, fullscreen triangle covering all 1,024 pixel centers, expected word 0xff996633).
  • Negative controls: omitted_draw and empty_scissor both verify 1,024 mismatches against the triangle reference (all 0x00000000 clear pixels, first mismatch at (0,0)). wrong_state omits the COMMON -> RENDER_TARGET transition and verifies the source-owned StateAudit rejects before ClearRenderTargetView(rtv) (documented as a fixture policy rather than runtime debug-layer validation).
  • docs/experiments.md & docs/xcl-capability-matrix.md: scope and caveats accurately state that this covers desktop ID3D12GraphicsCommandList methods on the XCL-08 device and does not claim console command-list interfaces, vtable slots, or PresentX.

Checks run (Linux, commit 392ba968)

  • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: passed (Self-test passed. Checked 16 Markdown files and 276 links.).
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: passed (Self-test passed. Checked 1033 tracked source, script and build/CI files: no bidirectional controls.).
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/hardware_reports_check.py: passed (Ran 12 tests in 0.061s - OK).
  • Windows build and ctest (d3d12x_graphics_list_warp, d3d12x_graphics_list_hardware): not executed on Linux.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033714855 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1228#pullrequestreview-6033714855). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T04:37:13Z. **Review:** COMMENTED --- Technical review on Linux at commit `392ba968` (Windows build and D3D12 runtime tests were **not** executed locally). ### Diff & fixture audit - `CMakeLists.txt`: compiles `tests/d3d12x_graphics.hlsl` (`VSMain` as `vs_6_0`, `PSMain` as `ps_6_0`) via DXC into headers and registers `d3d12x_graphics_list_warp` (timeout 60s) and `d3d12x_graphics_list_hardware` (`SKIP_RETURN_CODE 77`, timeout 60s). - `tests/d3d12x_graphics_list_check.cpp`: loads `d3d12_xs.dll` explicitly, verifies `D3D12XboxCreateDevice` resolves inside that module, creates an `ID3D12Device`, and records a `DIRECT` graphics command list (empty v1.0 root signature with `ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT`, 1 `POSITION` input, `R8G8B8A8_UNORM` 32x32 target, fullscreen triangle covering all 1,024 pixel centers, expected word `0xff996633`). - Negative controls: `omitted_draw` and `empty_scissor` both verify 1,024 mismatches against the triangle reference (all `0x00000000` clear pixels, first mismatch at `(0,0)`). `wrong_state` omits the `COMMON -> RENDER_TARGET` transition and verifies the source-owned `StateAudit` rejects before `ClearRenderTargetView(rtv)` (documented as a fixture policy rather than runtime debug-layer validation). - `docs/experiments.md` & `docs/xcl-capability-matrix.md`: scope and caveats accurately state that this covers desktop `ID3D12GraphicsCommandList` methods on the XCL-08 device and does not claim console command-list interfaces, vtable slots, or `PresentX`. ### Checks run (Linux, commit `392ba968`) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: passed (`Self-test passed. Checked 16 Markdown files and 276 links.`). - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: passed (`Self-test passed. Checked 1033 tracked source, script and build/CI files: no bidirectional controls.`). - `/root/.local/share/x2w-rev-venv/bin/python -B tests/hardware_reports_check.py`: passed (`Ran 12 tests in 0.061s - OK`). - Windows build and `ctest` (`d3d12x_graphics_list_warp`, `d3d12x_graphics_list_hardware`): **not executed** on Linux.
Sign in to join this conversation.
No reviewers
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!1221
No description provided.