[PR #1079] [CLOSED] d3d12: resolve views of live placed textures (RT-TITLE-TEXTURE-VIEWS) #1117

Closed
opened 2026-11-26 20:20:08 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1079
Author: @Moriz82
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: split/rt-title-texture-views


📝 Commits (1)

  • 0a92b13 d3d12: resolve views of live placed textures (RT-TITLE-TEXTURE-VIEWS)

📊 Changes

3 files changed (+95 additions, -6 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+5 -0)
📝 runtime/CMakeLists.txt (+3 -0)
📝 runtime/test/d3d12_set0_compute_test.cpp (+87 -6)

📄 Description

Rebased diff at 0a92b139. Main already has the placed-texture SRV and UAV paths. This PR keeps regression coverage for choosing the right live array placement when two textures share an address, rejecting a view after that placement is released, and accepting a complete 3D mip while rejecting a partial view. CTest also runs the same fixture with LEONIDA_PLACED_TEXTURE_UAV=0. The test results below apply to earlier heads.

Claimed in the coordination issue as: RT-TITLE-TEXTURE-VIEWS (claim).

Part of the split of #984 into small pull requests.

Depends on: none

Overlaps: #356 supplied the null SRV fallback for Xbox device slot 70. This child retains that fallback for missing images. #461 concerns CPU texture layout. The live-image path uses the Vulkan image already created by slot 133.

What and why

A shader-resource view of an existing GPU texture returned a null descriptor when the caller supplied the texture's placement address. The equivalent unordered-access call could reach an unrelated PC device method.

Slots 70 and 71 now resolve a live slot-133 texture by address, shape and format. When several images share an address, the most recent compatible image wins. The lookup holds a reference while writing the descriptor. Final release removes only that resource from the index. A UAV requires writable backing. A 3D UAV must span a complete mip. Unmatched views produce null descriptors. Set LEONIDA_PLACED_TEXTURE_UAV=0 to return null placed UAVs for comparison.

CPU-source uploads and refresh belong to the separate RT-TITLE-TEXTURE-SOURCES topic.

Tested

Linux/Proton Experimental (Wine 11), GeForce RTX 4070 12 GB, NVIDIA 620.73.04. Release cross-build with clang-cl 23 and an xwin SDK. Each command below used the same configured build directory. PROTON_WINE names the Wine executable and WINEPREFIX selects the test prefix.

cmake --build runtime/build/boot --target gta6rt -j6
cmake --build runtime/build/boot --target d3d12_set0_compute_test -j6
cmake --build runtime/build/boot --target xs_proxy_mock_test -j6
cd runtime/build/boot
export WINEDEBUG=-all
unset LEONIDA_PLACED_TEXTURE_UAV
timeout 120 "$PROTON_WINE" d3d12_set0_compute_test.exe
LEONIDA_PLACED_TEXTURE_UAV=0 timeout 120 "$PROTON_WINE" d3d12_set0_compute_test.exe
for arg in "" --fail-virtualalloc --fail-virtualprotect --fail-veh --env-slots --env-slots-invalid; do
    timeout 120 "$PROTON_WINE" xs_proxy_mock_test.exe $arg
done

All three targets built. The default and rollback runs each sampled all 64 expected texels through the placed SRV. Each also checked an ordinary SRV, a clamping sampler and a missing-descriptor fallback, for 256 texel checks per run. The default produced two valid UAVs (an array layer and a complete volume mip) and two null controls (released placement and partial mip). The rollback produced four null UAVs. The plain-device proxy test passed at both emulated device interface levels and checked both slots with and without destinations. The six ways CTest runs it (plain, three refused allocations, and the two environment-slot cases) all exit zero.

Fixed after the first version. xs_proxy_mock --env-slots-invalid failed on the first head. It used device slot 71 as its example of a PC slot that is forwarded unchanged, and this change routes slot 71 to the placed texture UAV. The first version ran only the plain form of the test, so it missed that. The case now probes slot 72 and asserts that it is not overridden. Reported by Plaaasma on native Windows and reproduced by madhyn on Wine; reproduced here before the fix (exit 1 at that line) and passing after it.

Rebased onto main 9f25f1ef2. #375 (XMem hooks and console render-target sizes) changed the same two places as this change. In device_slot_overridden (runtime/shims/d3d12_xs_device.cpp) it adds slots 17 to 24 and 56 and this change adds slot 71; in the list of checks of runtime/test/xs_proxy_mock_test.cpp it adds five checks and this change renames check_slot70 to check_placed_views. Both sides are kept, and nothing else conflicted. Slot 72, which the invalid environment-slot case probes, is still not routed. On the rebased head the three targets were rebuilt and all eight registered forms were run again: d3d12_set0_compute, d3d12_placed_texture_uav_off (LEONIDA_PLACED_TEXTURE_UAV=0) and the six xs_proxy_mock forms. These runs used Wine 11.22 (distribution package, a prefix of its own) instead of Proton Experimental, on the same GPU and driver. All exit 0 with the results described above (2 matching UAVs and 2 null controls by default, 4 null controls in the rollback, 64 texels per sampled view), and the plain xs_proxy_mock run includes the five checks #375 added.

GPUs tested: NVIDIA GeForce RTX 4070. Native Windows, AMD, Intel and a game boot were not tested on this child by us; the reviewers' native Windows and Wine runs were on the first head. The cross-build omitted the optional XMA decoder because the Rust Windows target was unavailable.

AI-assisted: yes.

Checklist

  • One commit based on upstream main 3aa975421. Merges cleanly.
  • Live placement views only, with synthetic GPU and proxy coverage.
  • All eight changed files passed scripts/check_no_game_data.py.
  • Runtime change only. No translator rule changed.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1079 **Author:** [@Moriz82](https://github.com/Moriz82) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `split/rt-title-texture-views` --- ### 📝 Commits (1) - [`0a92b13`](https://github.com/ubiquitarianism/leonida/commit/0a92b1396858836939d39df84ffc933e5b3ed8d6) d3d12: resolve views of live placed textures (RT-TITLE-TEXTURE-VIEWS) ### 📊 Changes **3 files changed** (+95 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+5 -0) 📝 `runtime/CMakeLists.txt` (+3 -0) 📝 `runtime/test/d3d12_set0_compute_test.cpp` (+87 -6) </details> ### 📄 Description **Rebased diff at `0a92b139`.** Main already has the placed-texture SRV and UAV paths. This PR keeps regression coverage for choosing the right live array placement when two textures share an address, rejecting a view after that placement is released, and accepting a complete 3D mip while rejecting a partial view. CTest also runs the same fixture with `LEONIDA_PLACED_TEXTURE_UAV=0`. The test results below apply to earlier heads. Claimed in the coordination issue as: RT-TITLE-TEXTURE-VIEWS ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140073053)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #356 supplied the null SRV fallback for Xbox device slot 70. This child retains that fallback for missing images. #461 concerns CPU texture layout. The live-image path uses the Vulkan image already created by slot 133. ### What and why A shader-resource view of an existing GPU texture returned a null descriptor when the caller supplied the texture's placement address. The equivalent unordered-access call could reach an unrelated PC device method. Slots 70 and 71 now resolve a live slot-133 texture by address, shape and format. When several images share an address, the most recent compatible image wins. The lookup holds a reference while writing the descriptor. Final release removes only that resource from the index. A UAV requires writable backing. A 3D UAV must span a complete mip. Unmatched views produce null descriptors. Set `LEONIDA_PLACED_TEXTURE_UAV=0` to return null placed UAVs for comparison. CPU-source uploads and refresh belong to the separate RT-TITLE-TEXTURE-SOURCES topic. ### Tested Linux/Proton Experimental (Wine 11), GeForce RTX 4070 12 GB, NVIDIA 620.73.04. Release cross-build with clang-cl 23 and an xwin SDK. Each command below used the same configured build directory. `PROTON_WINE` names the Wine executable and `WINEPREFIX` selects the test prefix. ```sh cmake --build runtime/build/boot --target gta6rt -j6 cmake --build runtime/build/boot --target d3d12_set0_compute_test -j6 cmake --build runtime/build/boot --target xs_proxy_mock_test -j6 cd runtime/build/boot export WINEDEBUG=-all unset LEONIDA_PLACED_TEXTURE_UAV timeout 120 "$PROTON_WINE" d3d12_set0_compute_test.exe LEONIDA_PLACED_TEXTURE_UAV=0 timeout 120 "$PROTON_WINE" d3d12_set0_compute_test.exe for arg in "" --fail-virtualalloc --fail-virtualprotect --fail-veh --env-slots --env-slots-invalid; do timeout 120 "$PROTON_WINE" xs_proxy_mock_test.exe $arg done ``` All three targets built. The default and rollback runs each sampled all 64 expected texels through the placed SRV. Each also checked an ordinary SRV, a clamping sampler and a missing-descriptor fallback, for 256 texel checks per run. The default produced two valid UAVs (an array layer and a complete volume mip) and two null controls (released placement and partial mip). The rollback produced four null UAVs. The plain-device proxy test passed at both emulated device interface levels and checked both slots with and without destinations. The six ways CTest runs it (plain, three refused allocations, and the two environment-slot cases) all exit zero. **Fixed after the first version.** `xs_proxy_mock --env-slots-invalid` failed on the first head. It used device slot 71 as its example of a PC slot that is forwarded unchanged, and this change routes slot 71 to the placed texture UAV. The first version ran only the plain form of the test, so it missed that. The case now probes slot 72 and asserts that it is not overridden. Reported by Plaaasma on native Windows and reproduced by madhyn on Wine; reproduced here before the fix (exit 1 at that line) and passing after it. **Rebased onto `main` `9f25f1ef2`.** #375 (XMem hooks and console render-target sizes) changed the same two places as this change. In `device_slot_overridden` (`runtime/shims/d3d12_xs_device.cpp`) it adds slots 17 to 24 and 56 and this change adds slot 71; in the list of checks of `runtime/test/xs_proxy_mock_test.cpp` it adds five checks and this change renames `check_slot70` to `check_placed_views`. Both sides are kept, and nothing else conflicted. Slot 72, which the invalid environment-slot case probes, is still not routed. On the rebased head the three targets were rebuilt and all eight registered forms were run again: `d3d12_set0_compute`, `d3d12_placed_texture_uav_off` (`LEONIDA_PLACED_TEXTURE_UAV=0`) and the six `xs_proxy_mock` forms. These runs used Wine 11.22 (distribution package, a prefix of its own) instead of Proton Experimental, on the same GPU and driver. All exit 0 with the results described above (2 matching UAVs and 2 null controls by default, 4 null controls in the rollback, 64 texels per sampled view), and the plain `xs_proxy_mock` run includes the five checks #375 added. GPUs tested: NVIDIA GeForce RTX 4070. Native Windows, AMD, Intel and a game boot were not tested on this child by us; the reviewers' native Windows and Wine runs were on the first head. The cross-build omitted the optional XMA decoder because the Rust Windows target was unavailable. AI-assisted: yes. ### Checklist - [x] One commit based on upstream main `3aa975421`. Merges cleanly. - [x] Live placement views only, with synthetic GPU and proxy coverage. - [x] All eight changed files passed `scripts/check_no_game_data.py`. - [x] Runtime change only. No translator rule changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:08 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1117
No description provided.