d3d12: replay programmable sample positions (D3D-SAMPLE-POSITIONS) #778

Open
github-bot wants to merge 7 commits from github-bot/gh-778 into main AGit
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 13:43 UTC · original
kawaii-shakal:d3d-sample-positions → main · +332 −62 · 11 files · 7 commits · open

Claimed in the coordination issue as: D3D-SAMPLE-POSITIONS (claim)

What and why

SetSamplePositions was a stub and OPTIONS2 reported tier 0. Replay now copies the positions into the command list, selects a graphics pipeline variant, sets the Vulkan sample locations, and carries them through depth layout transitions. OPTIONS2 evaluates the supported grids per sample count.

Tested

Three GPU tests passed at 27781f7 with Vulkan validation. The baseline observed tier 0 with the extension disabled. The programmable cases observed tier 2. Pixel readback covered a single pattern, a 2x2 grid, reset in the same command list, and D32 contents after a transition to COPY_SOURCE and back. CPU tests checked ownership of recorded positions and the coordinates supplied to enhanced barriers.

GPUs tested: NVIDIA GeForce RTX 5070 Ti, Windows 11, driver 617.42.

Integration and regressions

The nine-test regression run passed eight tests. The remaining five argument-range mismatches reproduced identically at the parent commit (comparison). A separate combined build with #499 passed four GPU tests including indirect draws with custom sample positions (integration result and merge notes). This changes graphics pipeline variants, depth image creation and barrier replay. Rollback is a source revert.

  • One topic
  • Changed files passed the game-data check
  • GitHub reported mergeable against main at 47c65117

AI-assisted: yes. Implemented and tested by Codex.

**@⁠kawaii-shakal** on GitHub · 2026-11-24 13:43 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/778) `kawaii-shakal:d3d-sample-positions` → `main` · +332 −62 · 11 files · 7 commits · open Claimed in the coordination issue as: D3D-SAMPLE-POSITIONS ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### What and why SetSamplePositions was a stub and OPTIONS2 reported tier 0. Replay now copies the positions into the command list, selects a graphics pipeline variant, sets the Vulkan sample locations, and carries them through depth layout transitions. OPTIONS2 evaluates the supported grids per sample count. ### Tested Three GPU tests passed at 27781f7 with Vulkan validation. The baseline observed tier 0 with the extension disabled. The programmable cases observed tier 2. Pixel readback covered a single pattern, a 2x2 grid, reset in the same command list, and D32 contents after a transition to COPY_SOURCE and back. CPU tests checked ownership of recorded positions and the coordinates supplied to enhanced barriers. GPUs tested: NVIDIA GeForce RTX 5070 Ti, Windows 11, driver 617.42. ### Integration and regressions The nine-test regression run passed eight tests. The remaining five argument-range mismatches reproduced identically at the parent commit ([comparison](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/778)). A separate combined build with #499 passed four GPU tests including indirect draws with custom sample positions ([integration result and merge notes](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/778)). This changes graphics pipeline variants, depth image creation and barrier replay. Rollback is a source revert. - [x] One topic - [x] Changed files passed the game-data check - [x] GitHub reported mergeable against main at 47c65117 AI-assisted: yes. Implemented and tested by Codex.
Conflicts, all kept from both sides:
- GraphicsPipeline: main's rectangle_stage took bit 9, so custom_samples
  moves to bit 10; sample grids sit next to main's async_build.
- The pipeline variant appends VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT to
  main's dyn_list (8 entries at most) and keeps main's lazy shader modules.
- initialize() takes main's per-aspect zeroing and depth-UAV paths and still
  passes the active sample positions to every barrier.
- prepare_draw keeps main's skip/quad-index handling and the sample
  positions argument; emit_commands keeps active_samples, including main's
  clear-pattern round trip and the release (into UNDEFINED) barriers.
- Texture creation keeps main's 1D/3D UAV limits and the sample grid.
- Both new replay_texture_barrier_test cases are kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve indirect draw arguments and programmable sample positions in the same replay preparation path. Conflict resolution and Linux verification by Codex.
Keep depth bounds and programmable sample locations in the same Vulkan pipeline.

Conflict resolution assisted by Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:20:59 +00:00
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 13:48 UTC · original

Regression comparison for 27781f7 on Windows 11, RTX 5070 Ti (617.42), with Vulkan validation enabled. Eight of nine selected CTests passed, including depth resolves, both bundle suites, command recording, enhanced texture barriers and all three MSAA cases. I built the ninth test, d3d12_execute_indirect_validation, separately at the exact parent 51f3160. Both builds produced identical results for all five failing argument-range cases out of 49. The positive GPU dispatch passed. #306 tracks these cases.

Graphics ExecuteIndirect integration overlaps #499, which adds graphics-state preparation to indirect draws. When combining the patches, both calls to prepare_draw need the active sample pattern, and the Vulkan sample-location command belongs in the draw-state setup shared by direct and indirect draws. The nine-test run above did not exercise the two branches combined.

— Codex

**@⁠kawaii-shakal** on GitHub · 2026-11-24 13:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/778#issuecomment-7133373324) Regression comparison for 27781f7 on Windows 11, RTX 5070 Ti (617.42), with Vulkan validation enabled. Eight of nine selected CTests passed, including depth resolves, both bundle suites, command recording, enhanced texture barriers and all three MSAA cases. I built the ninth test, d3d12_execute_indirect_validation, separately at the exact parent 51f3160. Both builds produced identical results for all five failing argument-range cases out of 49. The positive GPU dispatch passed. #306 tracks these cases. Graphics ExecuteIndirect integration overlaps #499, which adds graphics-state preparation to indirect draws. When combining the patches, both calls to prepare_draw need the active sample pattern, and the Vulkan sample-location command belongs in the draw-state setup shared by direct and indirect draws. The nine-test run above did not exercise the two branches combined. — Codex
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 13:53 UTC · original

I tested #778 together with #499 in a separate checkout. There is one textual conflict in vulkan_replay.h. I kept #499's shared emit_graphics_pass, passed active sample positions to its attachment transitions and indirect prepare_draw call, and set the Vulkan sample locations in that shared pass.

To exercise the combination, I changed the MSAA test's red triangle to ExecuteIndirect(DRAW), including the draws before and after resetting the 2x2 pattern. The GPU readback checks were unchanged. On RTX 5070 Ti (617.42), with Vulkan validation, all four tests passed: d3d12_indirect_draw, d3d12_msaa_draw, d3d12_custom_samples and d3d12_sample_grid_reset. These integration edits were local. Whichever PR lands second needs the conflict resolution above.

— Codex

**@⁠kawaii-shakal** on GitHub · 2026-11-24 13:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/778#issuecomment-7133487399) I tested #778 together with #499 in a separate checkout. There is one textual conflict in vulkan_replay.h. I kept #499's shared emit_graphics_pass, passed active sample positions to its attachment transitions and indirect prepare_draw call, and set the Vulkan sample locations in that shared pass. To exercise the combination, I changed the MSAA test's red triangle to ExecuteIndirect(DRAW), including the draws before and after resetting the 2x2 pattern. The GPU readback checks were unchanged. On RTX 5070 Ti (617.42), with Vulkan validation, all four tests passed: d3d12_indirect_draw, d3d12_msaa_draw, d3d12_custom_samples and d3d12_sample_grid_reset. These integration edits were local. Whichever PR lands second needs the conflict resolution above. — Codex
Author
Owner

@⁠moffington on GitHub · 2026-11-24 14:31 UTC · original

Independently tested 27781f7 on an RTX 3060 under Wine 11.20 with Khronos Vulkan validation and synchronization validation enabled.

  • Native Linux tests: 4/4 passed.
  • Wine baseline: 6/6 passed.
  • Wine PR head: 8/8 passed.
  • Both custom-sample tests matched all 4096 pixels.
  • No replay, draw or synchronization validation errors. The pre-existing winevulkan startup validation warning remains.

Additional synthetic checks confirmed:

  • Disabling sample locations reports Tier 0 and rejects custom-sample draws cleanly.
  • Custom 2x2 patterns survive D32 depth transitions with exact readback.
  • ClearState and Reset restore standard sample locations.
  • ExecuteBundle inherits the direct command list's active pattern.
  • Mismatched pipeline/sample counts are rejected without validation errors.

A trial merge against main at d0da7dade has no textual conflicts.

One integration consideration: #499 overlaps the graphics replay paths. Whichever lands second should preserve sample-position state through the refactored direct and indirect draw paths.

No defects found in the tested configurations. LGTM.

**@⁠moffington** on GitHub · 2026-11-24 14:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/778#issuecomment-7134517996) Independently tested `27781f7` on an RTX 3060 under Wine 11.20 with Khronos Vulkan validation and synchronization validation enabled. - Native Linux tests: 4/4 passed. - Wine baseline: 6/6 passed. - Wine PR head: 8/8 passed. - Both custom-sample tests matched all 4096 pixels. - No replay, draw or synchronization validation errors. The pre-existing winevulkan startup validation warning remains. Additional synthetic checks confirmed: - Disabling sample locations reports Tier 0 and rejects custom-sample draws cleanly. - Custom 2x2 patterns survive D32 depth transitions with exact readback. - ClearState and Reset restore standard sample locations. - ExecuteBundle inherits the direct command list's active pattern. - Mismatched pipeline/sample counts are rejected without validation errors. A trial merge against `main` at `d0da7dade` has no textual conflicts. One integration consideration: #499 overlaps the graphics replay paths. Whichever lands second should preserve sample-position state through the refactored direct and indirect draw paths. No defects found in the tested configurations. LGTM.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 14:47 UTC · original

Thanks for the independent run on Wine/RTX 3060 and the extra synthetic checks (Tier 0 without the extension, D32 transitions, ClearState/Reset, bundles).

On the #499 overlap: the resolution is in the earlier comment. Keep #499's shared emit_graphics_pass, pass the active sample positions to its attachment transitions and to the indirect prepare_draw, and set the Vulkan sample locations in that shared pass. With that, d3d12_indirect_draw, d3d12_msaa_draw, d3d12_custom_samples and d3d12_sample_grid_reset passed together on an RTX 5070 Ti with validation, the MSAA case drawn through ExecuteIndirect(DRAW). Whichever PR lands second gets that change; if #499 lands first, this branch will be rebased with it.

**@⁠kawaii-shakal** on GitHub · 2026-11-24 14:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/778#issuecomment-7134961357) Thanks for the independent run on Wine/RTX 3060 and the extra synthetic checks (Tier 0 without the extension, D32 transitions, ClearState/Reset, bundles). On the #499 overlap: the resolution is in [the earlier comment](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/778). Keep #499's shared `emit_graphics_pass`, pass the active sample positions to its attachment transitions and to the indirect `prepare_draw`, and set the Vulkan sample locations in that shared pass. With that, `d3d12_indirect_draw`, `d3d12_msaa_draw`, `d3d12_custom_samples` and `d3d12_sample_grid_reset` passed together on an RTX 5070 Ti with validation, the MSAA case drawn through `ExecuteIndirect(DRAW)`. Whichever PR lands second gets that change; if #499 lands first, this branch will be rebased with it.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 19:21 UTC · original

Merged main at 6293c1c4 into this branch in 07f9ede7. The depth-clear path now passes the active sample positions to image initialization and keeps the restricted-depth clamp from main. I tested this tree on native Windows with Vulkan validation enabled on an RTX 5070 Ti. All five focused tests passed: d3d12_clear, d3d12_clear_restricted_depth, d3d12_msaa_draw, d3d12_custom_samples, and d3d12_sample_grid_reset.

— Codex

**@⁠kawaii-shakal** on GitHub · 2026-11-24 19:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/778#issuecomment-7141979793) Merged main at 6293c1c4 into this branch in 07f9ede7. The depth-clear path now passes the active sample positions to image initialization and keeps the restricted-depth clamp from main. I tested this tree on native Windows with Vulkan validation enabled on an RTX 5070 Ti. All five focused tests passed: `d3d12_clear`, `d3d12_clear_restricted_depth`, `d3d12_msaa_draw`, `d3d12_custom_samples`, and `d3d12_sample_grid_reset`. — Codex
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-25 08:57 UTC · original

Merged main (237deb64c) into this branch as a3e2088fd. 15 conflict hunks, in vulkan_replay.h, d3d12_vulkan_device.cpp, command_list.h and replay_texture_barrier_test.cpp, all kept from both sides:

  • Main's rectangle_stage took variant bit 9, so custom_samples is now bit 10.
  • The sample-locations dynamic state is appended to main's dyn_list, which holds 8 at most.
  • initialize, the release barriers into UNDEFINED, and main's clear-pattern round trip all still pass the active sample positions.
  • prepare_draw keeps main's skip and quad-index handling.

Tested on native Windows 11 Pro 26300, RTX 5070 Ti, NVIDIA 617.42, MSVC 19.50: full ctest, 380 of 381 pass. xmem_write_watch failed once under -j 10 and passes alone; this merge does not touch xmem. d3d12_msaa_draw and replay_texture_barrier pass.

**@⁠kawaii-shakal** on GitHub · 2026-11-25 08:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/778#issuecomment-7157683416) Merged main (237deb64c) into this branch as `a3e2088fd`. 15 conflict hunks, in `vulkan_replay.h`, `d3d12_vulkan_device.cpp`, `command_list.h` and `replay_texture_barrier_test.cpp`, all kept from both sides: - Main's `rectangle_stage` took variant bit 9, so `custom_samples` is now bit 10. - The sample-locations dynamic state is appended to main's `dyn_list`, which holds 8 at most. - `initialize`, the release barriers into UNDEFINED, and main's clear-pattern round trip all still pass the active sample positions. - `prepare_draw` keeps main's skip and quad-index handling. Tested on native Windows 11 Pro 26300, RTX 5070 Ti, NVIDIA 617.42, MSVC 19.50: full `ctest`, 380 of 381 pass. `xmem_write_watch` failed once under `-j 10` and passes alone; this merge does not touch xmem. `d3d12_msaa_draw` and `replay_texture_barrier` pass.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-25 12:28 UTC · original

AI-assisted update by Codex in ec2af135e. I merged upstream main at 0d80bc5df into the PR branch and resolved the conflict in vulkan_replay.h. The replay preparation path passes both the upstream indirect draw arguments and the PR's programmable sample positions.

Linux verification passed all seven targeted CTest cases, including Vulkan command replay on Mesa llvmpipe. A synthetic Vulkan check confirmed that the custom MSAA pipeline variant is selected and that sample locations are emitted before the indirect draw. Native Windows D3D12 tests are pending.

Configuration: the conflict resolution required no build or runtime configuration changes.

**@⁠kawaii-shakal** on GitHub · 2026-11-25 12:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/778#issuecomment-7162420777) AI-assisted update by Codex in `ec2af135e`. I merged upstream `main` at `0d80bc5df` into the PR branch and resolved the conflict in `vulkan_replay.h`. The replay preparation path passes both the upstream indirect draw arguments and the PR's programmable sample positions. Linux verification passed all seven targeted CTest cases, including Vulkan command replay on Mesa llvmpipe. A synthetic Vulkan check confirmed that the custom MSAA pipeline variant is selected and that sample locations are emitted before the indirect draw. Native Windows D3D12 tests are pending. Configuration: the conflict resolution required no build or runtime configuration changes.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/778/head:github-bot/gh-778'
git switch 'github-bot/gh-778'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-778'
git switch 'github-bot/gh-778'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-778'
git switch 'github-bot/gh-778'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-778'
git switch 'main'
git merge --squash 'github-bot/gh-778'
git switch 'main'
git merge --ff-only 'github-bot/gh-778'
git switch 'main'
git merge 'github-bot/gh-778'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.