runtime: programmable sample positions only for multisampled targets, so 1x depth images stay plain (RT-SAMPLE-LOCATIONS-MSAA-ONLY) #2649
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2649"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 aVkSampleLocationsInfoEXT. 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'sd3d12_sample_grid_resettest 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
mainthat 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
command_list_testwith the new checks. With only the test change,maindoes not build it, becauseprogrammable_countdoes not exist there. With this change it passes.d3d12_msaa_draw,d3d12_custom_samplesandd3d12_sample_grid_resetpass.d3d12_sample_grid_reset(tier 2) still runs.ctest(540 tests, no XMA decoder,-j 20):main: 2 failures,windows_crash_monitorandxbox_present.d3d12_queue_wait_timeout(timeout) andd3d12_meshunder the parallel load. Both pass when run alone, 2 of 2, onmainand on this change.gta6rtlinks without the XMA decoder, and its imports are identical tomain(30 DLLs).WS2_32is already imported onmainand is not added here.gta6rt, cold 300 s runs, one run each):main7bbc1d223main7bbc1d223+ this changemain4364a4fa6main4364a4fa6+ an earlier one-line version (grids from 2)GPUs tested: NVIDIA GeForce RTX 5080 16 GB, driver 621.24, Windows 11
AI-assisted: yes (Claude Code, for DadaCap)
Checklist
mainand merges cleanly. Also merges cleanly with #2566 at1d0867c4a, so no rebase of #2566.check_no_game_data.pypasses on the 3 files), including in logs or reports quoted here.docs/design.md(n/a, runtime only).🤖 Generated with Claude Code
https://claude.ai/code/session_01Gt9hwPPpwX5RYWwXCnj43U
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 was32b9f4a3e. 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).VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXTand 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.This exercises the synthetic Vulkan depth and MSAA paths under Wine. AI-assisted with OpenAI Codex.