d3d12: expand IA-selected rectangles on triangle-family PSOs (RT-IA-RECTANGLE-VARIANT) #722

Manually merged
github merged 2 commits from gh-pr/722/head into gh-pr/722/base 2026-11-26 09:18:03 +00:00
Owner

@⁠Rain156 on GitHub · 2026-11-24 12:55 UTC · original
Rain156:fix/ia-rectangle-triangle-pso-20261124 → main · +374 −2 · 5 files · 2 commits · merged 2026-11-25 02:33 UTC

Claimed in the coordination issue as: RT-IA-RECTANGLE-VARIANT (claim).

Depends on: #682

What and why

The first-run UI compositor binds a triangle-family graphics pipeline, then selects Xbox rectangle-list topology (17) on the input assembler. The three submitted corners drew one triangle. In a 3840 × 2160 pass, this left half the output untouched.

Replay now selects a pipeline variant with a generated geometry stage for that draw. The variant cache distinguishes rectangle expansion and the unbound attachment mask. Triangle draws on the same PSO keep their original pipeline. PSOs with the same linked vertex program share the snapshot used to build the geometry stage on first use.

The first commit carries only tedin7’s geometry generator from #207 / #682, byte-for-byte, so this can build against current main. The second commit contains the draw-time selection and its regression. The explicit type-19 PSO and quad-list implementation are tracked in #682.

Tested

  • Clean main 51f316092 with the new synthetic GPU test fails at pixel (0, 32) on the first rectangle draw. On this branch, the same PSO alternates rectangle and triangle draws twice. All 4,096 target pixels match on each frame. The regression also passes with the Khronos validation layer and synchronization validation enabled. Run ctest --test-dir <build> -C RelWithDebInfo -R ^d3d12_translated_draw$ --output-on-failure on a Vulkan-enabled Windows runtime build.
  • In separate offline runs of a local integration build, selecting the variant raised the two fullscreen passes from 4,147,200 to 8,294,400 fragment invocations each. Swapchain readback went from 926,903 to 1,855,276 non-black pixels out of 1,858,304. A Windows compositor capture independently showed the diagonal cutoff gone and the full row of first-run controller prompts visible. A second launch with the exact generator shipped here produced pixel-identical RGB at the swapchain and, independently, in the Windows window capture. The screen has a plain background. These runs exercise an integration that also includes the constant-buffer row addressing tracked in #513. Gameplay and the 3D world have not been verified.
  • Full Windows runtime build and all 305 registered CTests. Across the standard run and two validation-enabled reruns, 293 passed and 11 skipped. The remaining d3d12_vulkan_device failure reproduced on clean main on this adapter, with identical HRESULT differences for committed-resource flags 0x200 and 0x400.
  • The translator suite ran 465 files containing 6,108 tests. The one module that failed to launch llvm-mc with a backslash-delimited Windows path passed all nine tests when rerun with a forward-slash LLVM_MC path. Viewer streaming passed 57/57 and documentation links passed 16/16.
  • Repository game-data scan and git diff --check pass. Local merge checks against current main and #682 are clean.

GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 x64 build 26200 (MSVC RelWithDebInfo).

AI-assisted: Yes (Codex).

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • Repository game-data scan passed for all tracked files.
  • Shader translator rules are unchanged.
**@⁠Rain156** on GitHub · 2026-11-24 12:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/722) `Rain156:fix/ia-rectangle-triangle-pso-20261124` → `main` · +374 −2 · 5 files · 2 commits · merged 2026-11-25 02:33 UTC Claimed in the coordination issue as: RT-IA-RECTANGLE-VARIANT ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). Depends on: #682 ### What and why The first-run UI compositor binds a triangle-family graphics pipeline, then selects Xbox rectangle-list topology (17) on the input assembler. The three submitted corners drew one triangle. In a 3840 × 2160 pass, this left half the output untouched. Replay now selects a pipeline variant with a generated geometry stage for that draw. The variant cache distinguishes rectangle expansion and the unbound attachment mask. Triangle draws on the same PSO keep their original pipeline. PSOs with the same linked vertex program share the snapshot used to build the geometry stage on first use. The first commit carries only tedin7’s geometry generator from #207 / #682, byte-for-byte, so this can build against current main. The second commit contains the draw-time selection and its regression. The explicit type-19 PSO and quad-list implementation are tracked in #682. ### Tested - Clean main `51f316092` with the new synthetic GPU test fails at pixel (0, 32) on the first rectangle draw. On this branch, the same PSO alternates rectangle and triangle draws twice. All 4,096 target pixels match on each frame. The regression also passes with the Khronos validation layer and synchronization validation enabled. Run `ctest --test-dir <build> -C RelWithDebInfo -R ^d3d12_translated_draw$ --output-on-failure` on a Vulkan-enabled Windows runtime build. - In separate offline runs of a local integration build, selecting the variant raised the two fullscreen passes from 4,147,200 to 8,294,400 fragment invocations each. Swapchain readback went from 926,903 to 1,855,276 non-black pixels out of 1,858,304. A Windows compositor capture independently showed the diagonal cutoff gone and the full row of first-run controller prompts visible. A second launch with the exact generator shipped here produced pixel-identical RGB at the swapchain and, independently, in the Windows window capture. The screen has a plain background. These runs exercise an integration that also includes the constant-buffer row addressing tracked in #513. Gameplay and the 3D world have not been verified. - Full Windows runtime build and all 305 registered CTests. Across the standard run and two validation-enabled reruns, 293 passed and 11 skipped. The remaining `d3d12_vulkan_device` failure reproduced on clean main on this adapter, with identical HRESULT differences for committed-resource flags `0x200` and `0x400`. - The translator suite ran 465 files containing 6,108 tests. The one module that failed to launch `llvm-mc` with a backslash-delimited Windows path passed all nine tests when rerun with a forward-slash `LLVM_MC` path. Viewer streaming passed 57/57 and documentation links passed 16/16. - Repository game-data scan and `git diff --check` pass. Local merge checks against current main and #682 are clean. GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 x64 build 26200 (MSVC RelWithDebInfo). AI-assisted: Yes (Codex). ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] Repository game-data scan passed for all tracked files. - [x] Shader translator rules are unchanged.
Carry only runtime/src/rect_list_geometry.h, byte-for-byte from 6aa8eb11c. The stage generator and its original commits are by tedin7 (#207, carried forward in #682). This makes the draw-time change buildable against main while the explicit rectangle/quad work is in review.
Select the geometry-stage variant when the input assembler requests an Xbox rectangle and cache it alongside the attachment-format variants. Keep a shared snapshot of the linked vertex program for that draw. Exercise alternating rectangle and triangle draws through the same PSO and compare the complete target after each switch.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:18:02 +00:00
github manually merged commit c55ecc9cbf into gh-pr/722/base 2026-11-26 09:18:03 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 13:16 UTC · original · approved these changes

LGTM. Excellent GPU-level emulation of Xbox rectangle lists (topology 17) via geometry-stage expansion on triangle-family PSOs (
ect_list_geometry.h). Verified with translated draw pixel tests in d3d12_translated_draw_test.cpp and documented in docs/d3d12_vulkan.md.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 13:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/722#pullrequestreview-6039849281) · **approved these changes** LGTM. Excellent GPU-level emulation of Xbox rectangle lists (topology 17) via geometry-stage expansion on triangle-family PSOs ( ect_list_geometry.h). Verified with translated draw pixel tests in d3d12_translated_draw_test.cpp and documented in docs/d3d12_vulkan.md.
Author
Owner

@⁠BadgersMC on GitHub · 2026-11-24 13:24 UTC · original

Independent native Windows pixel check on RTX 3060 Ti (driver 610.88, Windows 11 build 26100, MSVC 19.44, Khronos Vulkan validation 1.4.369).

I used the same d3d12_translated_draw test source from #722 in all runs:

Runtime LEONIDA_LAZY_PSO Result
Base 51f316092 plus the test source 0 Reproduced rectangle draw mismatch at (0, 32) in frame 2
#722 c55ecc9cb 0 Pass
#722 c55ecc9cb merged with #511 88658f1b 0 Pass
Same combined tree 1 Pass

The merge was clean (tree 5ca657a39667aceb1c5e3faf90b786c1cb9f515e). In each passing run, the new test alternated two rectangle draws and two triangle controls on the same PSO, comparing all 4,096 target pixels on each frame. Vulkan validation was enabled and the passing runs reported zero validation errors. Both synthetic shaders passed spirv-val.

This covers the IA-selected rectangle variant with #511 enabled, using synthetic inputs. AI-assisted.

**@⁠BadgersMC** on GitHub · 2026-11-24 13:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/722#issuecomment-7132795270) Independent native Windows pixel check on RTX 3060 Ti (driver 610.88, Windows 11 build 26100, MSVC 19.44, Khronos Vulkan validation 1.4.369). I used the same `d3d12_translated_draw` test source from #722 in all runs: | Runtime | `LEONIDA_LAZY_PSO` | Result | | --- | --- | --- | | Base `51f316092` plus the test source | `0` | Reproduced `rectangle draw mismatch at (0, 32) in frame 2` | | #722 `c55ecc9cb` | `0` | Pass | | #722 `c55ecc9cb` merged with #511 `88658f1b` | `0` | Pass | | Same combined tree | `1` | Pass | The merge was clean (tree `5ca657a39667aceb1c5e3faf90b786c1cb9f515e`). In each passing run, the new test alternated two rectangle draws and two triangle controls on the same PSO, comparing all 4,096 target pixels on each frame. Vulkan validation was enabled and the passing runs reported zero validation errors. Both synthetic shaders passed `spirv-val`. This covers the IA-selected rectangle variant with #511 enabled, using synthetic inputs. AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.