d3d12_vulkan: the title's R32_UINT textures take R9G9B9E5 views (D3D-RGB9E5-UINT-ALIAS-VIEW) #1456

Closed
QemmHD wants to merge 1 commit from upstream-pr/1456 into main
QemmHD commented 2026-11-25 00:32:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T00:32:51Z.


Claimed in the coordination issue as: D3D-RGB9E5-UINT-ALIAS-VIEW (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7147788092)

What and why

The console title packs light as R9G9B9E5_SHAREDEXP bits into R32_UINT textures from compute shaders, which
cannot store that format, and samples them through R9G9B9E5_SHAREDEXP shader-resource views of the same texture
(sky, sky and light probes, bounced light, cloud and sky volumes). The console allows that view; desktop D3D12
refuses it, and so did the layer ("incompatible R9G9B9E5 view format"), so those reads came out empty.

  • On the title's device only (the Vulkan device behind the Xbox-ABI proxy, set_device_outer, which
    D3D12XboxCreateDevice calls), an R32_UINT or R9G9B9E5_SHAREDEXP texture with ALLOW_UNORDERED_ACCESS, no
    DENY_SHADER_RESOURCE and one sample is a MUTABLE_FORMAT image listing {R32_UINT, E5B9G9R9_UFLOAT_PACK32}
    (both in Vulkan's 32-bit compatibility class), and its SRVs may name the other format. One image takes both views;
    nothing is copied. The other-format view is SAMPLED_BIT only; its T# (5_9_9_9_FLOAT / 32_UINT) names the
    texture's own address. An R32_UINT-backed R9G9B9E5 UAV texture (NVIDIA) already had that list.
  • Why per device, not per call (is_console_caller, as slots 61/74): the decision is needed at creation, the title
    creates through slots 76/127/133 and PC slots the proxy forwards unread, and GetResourceAllocationInfo must agree
    with creation for placements. It lives in texture_format, which all of those share. A device without the proxy
    (the PC tests, the WARP parity comparisons) keeps the refusal.
  • Why only UAV+SRV textures: the packed light is written by compute, and a mutable image may lose the driver's
    compression, so other R32_UINT textures stay plain. Each combination is probed once at device creation.
    UAVs in the other format, multisampled and reserved textures keep the PC rule.
  • Also fixes create_texture chaining its format list to itself when a castable list met a texture that
    TextureCreateInfo had already given one (an R32_UINT-backed UAV texture).

Found by comparing with fxceless/victory-fork, a fork of VIctory, which fixed the same black sky, probes and fog by
pointing the sampled texture at the written one. Credit to that fork and to VIctory; the code here is written anew.

Overlaps: trivial adjacent-line conflicts with #592 (fields and a doc bullet), #1079 (a member) and #578
(write_image_descriptor's signature); none added with #427/#772. Semantically, #1079's slot 70/71 lookup skips a
placement of another format unless it lists it as castable; to resolve an R9G9B9E5 view from raw words to the
R32_UINT texture it also needs to accept candidate->alias_format() — a one-line follow-up for whichever lands
second. #592's fp16 render targets get no alias, so the two don't interact.

Tested

  • New d3d12_rgb9e5_alias_view (GPU): R32_UINT UAV textures from slot 76, placed, 3D and with a castable list
    take an R9G9B9E5 SRV (registered in set 0); the reverse SRV works; UAVs in the other format, a plain R32_UINT
    texture and a device without the proxy stay null; a compute dispatch stores 16 packed words through the R32_UINT
    UAV and a second samples them through the R9G9B9E5 SRV, 16/16 texels exact, and the words read back unchanged.
    Passes plainly and with LEONIDA_VK_VALIDATION=1 (0 validation errors); fails at the R9G9B9E5 SRV with the layer
    change reverted.
  • Full ctest: main 364ab4eab 317/318, this change on it 318/319; rebased onto 1154976d4: 320/321. The one failure
    everywhere is d3d12_depth_resolve; d3d12_close_parity, d3d12_vulkan_device and d3d12_r9g9b9e5_uav (PC
    refusal) pass.
  • tests/ consistency set (test_cmake_, test_docs_, test_ctest_registration, ...): 578 passed, 5 skipped.
  • No retail run: it needs game files. The native-E5-storage path (R9G9B9E5 UAV on AMD) is untested here.

GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (rebased onto 1154976d4).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

AI-assisted (Claude Code, Claude Opus 5.5).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5482784452 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1456). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T00:32:51Z. --- Claimed in the coordination issue as: D3D-RGB9E5-UINT-ALIAS-VIEW (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7147788092) ### What and why The console title packs light as R9G9B9E5_SHAREDEXP bits into `R32_UINT` textures from compute shaders, which cannot store that format, and samples them through `R9G9B9E5_SHAREDEXP` shader-resource views of the same texture (sky, sky and light probes, bounced light, cloud and sky volumes). The console allows that view; desktop D3D12 refuses it, and so did the layer ("incompatible R9G9B9E5 view format"), so those reads came out empty. - On the title's device only (the Vulkan device behind the Xbox-ABI proxy, `set_device_outer`, which `D3D12XboxCreateDevice` calls), an `R32_UINT` or `R9G9B9E5_SHAREDEXP` texture with `ALLOW_UNORDERED_ACCESS`, no `DENY_SHADER_RESOURCE` and one sample is a `MUTABLE_FORMAT` image listing `{R32_UINT, E5B9G9R9_UFLOAT_PACK32}` (both in Vulkan's 32-bit compatibility class), and its SRVs may name the other format. One image takes both views; nothing is copied. The other-format view is `SAMPLED_BIT` only; its T# (`5_9_9_9_FLOAT` / `32_UINT`) names the texture's own address. An `R32_UINT`-backed R9G9B9E5 UAV texture (NVIDIA) already had that list. - Why per device, not per call (`is_console_caller`, as slots 61/74): the decision is needed at creation, the title creates through slots 76/127/133 and PC slots the proxy forwards unread, and `GetResourceAllocationInfo` must agree with creation for placements. It lives in `texture_format`, which all of those share. A device without the proxy (the PC tests, the WARP parity comparisons) keeps the refusal. - Why only UAV+SRV textures: the packed light is written by compute, and a mutable image may lose the driver's compression, so other `R32_UINT` textures stay plain. Each combination is probed once at device creation. UAVs in the other format, multisampled and reserved textures keep the PC rule. - Also fixes `create_texture` chaining its format list to itself when a castable list met a texture that `TextureCreateInfo` had already given one (an `R32_UINT`-backed UAV texture). Found by comparing with fxceless/victory-fork, a fork of VIctory, which fixed the same black sky, probes and fog by pointing the sampled texture at the written one. Credit to that fork and to VIctory; the code here is written anew. Overlaps: trivial adjacent-line conflicts with #592 (fields and a doc bullet), #1079 (a member) and #578 (`write_image_descriptor`'s signature); none added with #427/#772. Semantically, #1079's slot 70/71 lookup skips a placement of another format unless it lists it as castable; to resolve an R9G9B9E5 view from raw words to the `R32_UINT` texture it also needs to accept `candidate->alias_format()` — a one-line follow-up for whichever lands second. #592's fp16 render targets get no alias, so the two don't interact. ### Tested - New `d3d12_rgb9e5_alias_view` (GPU): R32_UINT UAV textures from slot 76, placed, 3D and with a castable list take an R9G9B9E5 SRV (registered in set 0); the reverse SRV works; UAVs in the other format, a plain R32_UINT texture and a device without the proxy stay null; a compute dispatch stores 16 packed words through the R32_UINT UAV and a second samples them through the R9G9B9E5 SRV, 16/16 texels exact, and the words read back unchanged. Passes plainly and with `LEONIDA_VK_VALIDATION=1` (0 validation errors); fails at the R9G9B9E5 SRV with the layer change reverted. - Full ctest: main 364ab4eab 317/318, this change on it 318/319; rebased onto 1154976d4: 320/321. The one failure everywhere is `d3d12_depth_resolve`; `d3d12_close_parity`, `d3d12_vulkan_device` and `d3d12_r9g9b9e5_uav` (PC refusal) pass. - tests/ consistency set (test_cmake_*, test_docs_*, test_ctest_registration, ...): 578 passed, 5 skipped. - No retail run: it needs game files. The native-E5-storage path (R9G9B9E5 UAV on AMD) is untested here. GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11 AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (rebased onto 1154976d4). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) AI-assisted (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
MoonEyes commented 2026-11-28 17:59:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T17:59:51Z.


Hi @QemmHD, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/shims/d3d12_vulkan_device.cpp), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7243448063 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1456#issuecomment-7243448063). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T17:59:51Z. --- Hi @QemmHD, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/shims/d3d12_vulkan_device.cpp`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
enlight3d commented 2026-11-29 12:08:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T12:08:32Z.


Run on RTX 3090 (PR head only, because it conflicts with main)

  • Heads: PR head 0365e38ad, main 8fb974878. The merge conflicts in runtime/shims/d3d12_vulkan_device.cpp, so I tested the PR head as it is (detached at the head, not merged).
  • Configure: cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON -DSDL3_DIR=<SDL3 cmake folder>
  • Green: cmake --build build -j 8 --target d3d12_rgb9e5_alias_view_test gta6rt, then ctest --test-dir build -R "^d3d12_rgb9e5_alias_view$" --output-on-failure -j1: Passed (0.8 s, not skipped; the test prints 16/16 packed words stored through the R32_UINT UAV and sampled back through the R9G9B9E5 SRV, and "0 validation errors").
  • Also run, same build, all Passed: d3d12_r9g9b9e5_uav, d3d12_vulkan_device, d3d12_close_parity. (The PR touches no vk_* source.)
  • Red (behavioural; the test builds either way, there is no new API): same head with runtime/shims/d3d12_vulkan_device.cpp and docs/d3d12_vulkan.md put back to their merge-base version (the test and its CMake entry kept), rebuilt, same ctest command: Failed at the R9G9B9E5 SRV of the R32_UINT texture (slot 2: "no T# of format 132", test line 391). Putting the PR's change back makes it pass again.
  • Link: gta6rt.exe imports compared with a plain main build (dumpbin /imports, DLL!symbol): one entry differs, api-ms-win-crt-stdio-l1-1-0.dll!__stdio_common_vswscanf. It comes from the older base of this branch (runtime/src/base_reservation.h still calls a scanf there; main no longer does), not from the PR: the PR diff contains no scanf. Otherwise nothing is added, so no new imports from this PR.
  • Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44.

The branch is 4146 commits behind main; could you merge main into it when you have a moment? Thanks.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7255596412 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1456#issuecomment-7255596412). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T12:08:32Z. --- Run on RTX 3090 (PR head only, because it conflicts with main) - Heads: PR head 0365e38ad, main 8fb974878. The merge conflicts in `runtime/shims/d3d12_vulkan_device.cpp`, so I tested the PR head as it is (detached at the head, not merged). - Configure: `cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON -DSDL3_DIR=<SDL3 cmake folder>` - Green: `cmake --build build -j 8 --target d3d12_rgb9e5_alias_view_test gta6rt`, then `ctest --test-dir build -R "^d3d12_rgb9e5_alias_view$" --output-on-failure -j1`: **Passed** (0.8 s, not skipped; the test prints 16/16 packed words stored through the R32_UINT UAV and sampled back through the R9G9B9E5 SRV, and "0 validation errors"). - Also run, same build, all Passed: `d3d12_r9g9b9e5_uav`, `d3d12_vulkan_device`, `d3d12_close_parity`. (The PR touches no `vk_*` source.) - Red (behavioural; the test builds either way, there is no new API): same head with `runtime/shims/d3d12_vulkan_device.cpp` and `docs/d3d12_vulkan.md` put back to their merge-base version (the test and its CMake entry kept), rebuilt, same ctest command: **Failed** at the R9G9B9E5 SRV of the R32_UINT texture (slot 2: "no T# of format 132", test line 391). Putting the PR's change back makes it pass again. - Link: gta6rt.exe imports compared with a plain main build (`dumpbin /imports`, DLL!symbol): one entry differs, `api-ms-win-crt-stdio-l1-1-0.dll!__stdio_common_vswscanf`. It comes from the older base of this branch (`runtime/src/base_reservation.h` still calls a scanf there; main no longer does), not from the PR: the PR diff contains no scanf. Otherwise nothing is added, so no new imports from this PR. - Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44. The branch is 4146 commits behind main; could you merge main into it when you have a moment? Thanks.
aslan2142 commented 2026-12-01 16:35:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:35:59Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317872604 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1456#issuecomment-7317872604). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:35:59Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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!1456
No description provided.