Skip to content

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

Merged
aslan2142 merged 2 commits into
ProjectLeonida:mainfrom
Rain156:fix/ia-rectangle-triangle-pso-20261124
Nov 25, 2026
Merged

aslan2142 merged 2 commits into
ProjectLeonida:mainfrom
Rain156:fix/ia-rectangle-triangle-pso-20261124

Conversation

@Rain156

@Rain156 Rain156 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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 d3d12: a constant-buffer view's V# steps 16 bytes a row (RT-CBV-VSHARP-STRIDE) #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 OLD-9940: draw Xbox rectangle and indexed quad lists as triangles #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.

…ida#682

Carry only runtime/src/rect_list_geometry.h, byte-for-byte from 6aa8eb1. The stage generator and its original commits are by tedin7 (ProjectLeonida#207, carried forward in ProjectLeonida#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.

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@BadgersMC

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
@aslan2142
aslan2142 merged commit abed2e1 into ProjectLeonida:main Nov 25, 2026
1 check passed
aslan2142 pushed a commit that referenced this pull request Nov 25, 2026
…first-run UI

Build on the public frame-loop integration in #321. Carry the texture-view and depth work from #213 and #261, the layout provider from #461, the responsive window from #526, and the rectangle generator from #682. Integrate the Xbox constant-buffer row addressing measured in #513 and the draw-time rectangle selection in #722. Keep all fixtures synthetic.

The Windows GPU path resolves title-owned shader objects, retires geometry uploads per submission, materializes texture views on use, maps linear surfaces, and delivers completed GPU label writes. A first-run UI launch selects the tested settings for these paths.
aslan2142 pushed a commit that referenced this pull request Nov 25, 2026
…published renderer fixes

Use the tagged pipeline variants and indexed quad expansion from #722 and #682 with the shared shader cache. Retain title-backed index uploads, cross-queue scratch sharing, amd64 console return conventions and the PC/console caller discriminator. The local shader build indexes native containers and includes the executable's embedded stages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants