runtime: programmable sample positions only for multisampled targets, so 1x depth images stay plain (RT-SAMPLE-LOCATIONS-MSAA-ONLY) #2649

Merged
DadaCap merged 1 commit from upstream-pr/2649 into main 2026-11-29 22:03:09 +00:00
DadaCap commented 2026-11-29 22:01:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T22:01:52Z.


Claimed in the coordination issue as: RT-SAMPLE-LOCATIONS-MSAA-ONLY (claim)

What and why

#778 (D3D-SAMPLE-POSITIONS) fills the Vulkan sample-locations grids for every sample count from 1 upwards. The device reports sample locations for 1 sample, so every single-sample depth-stencil image is then created with VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT, and each of its layout transitions carries a VkSampleLocationsInfoEXT. D3D12 only has programmable sample positions for multisampled targets, so this touches images the feature never needed.

Since #778 reached main, the Vulkan runtime loses the device in the world phase on an RTX 5080: a fence's counter read UINT64_MAX and vkDeviceWaitIdle then returned VK_ERROR_DEVICE_LOST, 100 to 230 s into every run.

This change keeps 1 sample out of the grids (SamplePositions::programmable_count), so a 1x depth image is created and transitioned exactly as before #778. The tier-2 condition is now checked on the multisampled framebuffer counts. #778 required a grid for every count, 1x included, so without this the device would drop to tier 1 and #778's d3d12_sample_grid_reset test would be skipped. MSAA images keep #778's programmable positions, and the reported tier stays the same.

How the cause was found: a bisect of the 26 runtime pull requests between a main that ran 600 s without a loss (c22a0a732) and one that lost the device (4364a4fa6). The runtime alone reproduces it, with shaders from the good translator. The last good point and the first bad point differ only by #778 on the runtime side.

The mechanism (why the flag and the barrier info on 1x depth images fault on NVIDIA, likely together with the title's aliased placed depth memory) is read in code, not measured: the runs had no driver fault report (LEONIDA_DEVICE_FAULT=2, NVIDIA diagnostics config off).

Tested

  • Unit: command_list_test with the new checks. With only the test change, main does not build it, because programmable_count does not exist there. With this change it passes.
  • #778's own GPU tests on an RTX 5080: d3d12_msaa_draw, d3d12_custom_samples and d3d12_sample_grid_reset pass. d3d12_sample_grid_reset (tier 2) still runs.
  • ctest (540 tests, no XMA decoder, -j 20):
    • main: 2 failures, windows_crash_monitor and xbox_present.
    • With this change: the same 2, plus d3d12_queue_wait_timeout (timeout) and d3d12_mesh under the parallel load. Both pass when run alone, 2 of 2, on main and on this change.
  • Link: gta6rt links without the XMA decoder, and its imports are identical to main (30 DLLs). WS2_32 is already imported on main and is not added here.
  • In game (Vulkan runtime gta6rt, cold 300 s runs, one run each):
Build Device loss
main 7bbc1d223 lost at ~218 s
main 7bbc1d223 + this change none in 300 s
main 4364a4fa6 lost at ~102 s (another run: ~111-230 s)
main 4364a4fa6 + an earlier one-line version (grids from 2) none in 300 s
bisect point with #778 on top lost at ~213 s; + the one-line version: none in 300 s
  • Not changed by this: on a cold pipeline cache the world almost stops presenting after about 100-120 s. Builds from before #778 do the same; that is the existing world-phase stall, not this loss.

GPUs tested: NVIDIA GeForce RTX 5080 16 GB, driver 621.24, Windows 11

AI-assisted: yes (Claude Code, for DadaCap)

Checklist

  • Based on current main and merges cleanly. Also merges cleanly with #2566 at 1d0867c4a, so no rebase of #2566.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (check_no_game_data.py passes on the 3 files), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md (n/a, runtime only).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gt9hwPPpwX5RYWwXCnj43U

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5555598989 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2649). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-29T22:01:52Z. --- Claimed in the coordination issue as: RT-SAMPLE-LOCATIONS-MSAA-ONLY ([claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263341748)) ### What and why #778 (D3D-SAMPLE-POSITIONS) fills the Vulkan sample-locations grids for every sample count from 1 upwards. The device reports sample locations for 1 sample, so every single-sample depth-stencil image is then created with `VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT`, and each of its layout transitions carries a `VkSampleLocationsInfoEXT`. D3D12 only has programmable sample positions for multisampled targets, so this touches images the feature never needed. Since #778 reached `main`, the Vulkan runtime loses the device in the world phase on an RTX 5080: `a fence's counter read UINT64_MAX and vkDeviceWaitIdle then returned VK_ERROR_DEVICE_LOST`, 100 to 230 s into every run. This change keeps 1 sample out of the grids (`SamplePositions::programmable_count`), so a 1x depth image is created and transitioned exactly as before #778. The tier-2 condition is now checked on the multisampled framebuffer counts. #778 required a grid for every count, 1x included, so without this the device would drop to tier 1 and #778's `d3d12_sample_grid_reset` test would be skipped. MSAA images keep #778's programmable positions, and the reported tier stays the same. How the cause was found: a bisect of the 26 runtime pull requests between a `main` that ran 600 s without a loss (`c22a0a732`) and one that lost the device (`4364a4fa6`). The runtime alone reproduces it, with shaders from the good translator. The last good point and the first bad point differ only by #778 on the runtime side. The mechanism (why the flag and the barrier info on 1x depth images fault on NVIDIA, likely together with the title's aliased placed depth memory) is read in code, not measured: the runs had no driver fault report (`LEONIDA_DEVICE_FAULT=2`, NVIDIA diagnostics config off). ### Tested - **Unit:** `command_list_test` with the new checks. With only the test change, `main` does not build it, because `programmable_count` does not exist there. With this change it passes. - **#778's own GPU tests** on an RTX 5080: `d3d12_msaa_draw`, `d3d12_custom_samples` and `d3d12_sample_grid_reset` pass. `d3d12_sample_grid_reset` (tier 2) still runs. - **`ctest`** (540 tests, no XMA decoder, `-j 20`): - `main`: 2 failures, `windows_crash_monitor` and `xbox_present`. - With this change: the same 2, plus `d3d12_queue_wait_timeout` (timeout) and `d3d12_mesh` under the parallel load. Both pass when run alone, 2 of 2, on `main` and on this change. - **Link:** `gta6rt` links without the XMA decoder, and its imports are identical to `main` (30 DLLs). `WS2_32` is already imported on `main` and is not added here. - **In game** (Vulkan runtime `gta6rt`, cold 300 s runs, one run each): | Build | Device loss | |---|---| | `main` 7bbc1d223 | lost at ~218 s | | `main` 7bbc1d223 + this change | **none in 300 s** | | `main` 4364a4fa6 | lost at ~102 s (another run: ~111-230 s) | | `main` 4364a4fa6 + an earlier one-line version (grids from 2) | none in 300 s | | bisect point with #778 on top | lost at ~213 s; + the one-line version: none in 300 s | - **Not changed by this:** on a cold pipeline cache the world almost stops presenting after about 100-120 s. Builds from before #778 do the same; that is the existing world-phase stall, not this loss. GPUs tested: NVIDIA GeForce RTX 5080 16 GB, driver 621.24, Windows 11 AI-assisted: yes (Claude Code, for DadaCap) ### Checklist - [x] Based on current `main` and merges cleanly. Also merges cleanly with #2566 at `1d0867c4a`, so no rebase of #2566. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (`check_no_game_data.py` passes on the 3 files), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md` (n/a, runtime only). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Gt9hwPPpwX5RYWwXCnj43U
merzleckeier commented 2026-11-29 22:08:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T22:08:11Z.


Independent synthetic A/B of the merged change. A was 060c47160 (first parent of the merge), B was 32b9f4a3e. I added the same 1x D32 clear and transitions to the 4x draw fixture in both builds, plus the same logging of the created depth-image flag and transition pNext. Win64 clang-cl 23.1.5 Release (/MD) under Wine 11.22 on CachyOS. RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV Mesa 26.3.1-arch3.5).

  • MEASURED, 1x depth. With programmable positions enabled, A set VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT and attached sample locations to all five observed transitions between defined layouts per run. B cleared the create flag and emitted no sample-location pNext in those same transitions. This held in 3/3 custom and 3/3 grid runs per GPU per arm.
  • MEASURED, 4x depth. The same programmable runs retained the 4x create flag, sample-location pNext and reported tier 2 in both builds. All 24 programmable runs matched the 4,096 resolved pixels. The standard-position control also passed once per GPU per arm and had no sample-location flag or pNext.

This exercises the synthetic Vulkan depth and MSAA paths under Wine. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7263431820 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2649#issuecomment-7263431820). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T22:08:11Z. --- Independent synthetic A/B of the merged change. A was `060c47160` (first parent of the merge), B was `32b9f4a3e`. I added the same 1x D32 clear and transitions to the 4x draw fixture in both builds, plus the same logging of the created depth-image flag and transition pNext. Win64 clang-cl 23.1.5 Release (`/MD`) under Wine 11.22 on CachyOS. RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV Mesa 26.3.1-arch3.5). - **MEASURED, 1x depth.** With programmable positions enabled, A set `VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT` and attached sample locations to all five observed transitions between defined layouts per run. B cleared the create flag and emitted no sample-location pNext in those same transitions. This held in 3/3 custom and 3/3 grid runs per GPU per arm. - **MEASURED, 4x depth.** The same programmable runs retained the 4x create flag, sample-location pNext and reported tier 2 in both builds. All 24 programmable runs matched the 4,096 resolved pixels. The standard-position control also passed once per GPU per arm and had no sample-location flag or pNext. This exercises the synthetic Vulkan depth and MSAA paths under Wine. AI-assisted with OpenAI Codex.
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
ProjectLeonida/mandy!2649
No description provided.