Size read-only console textures in the title's swizzle mode (RT-XS-CONSOLE-PLACEMENT-TITLE-LAYOUT) #2516

Merged
Tyrannys merged 1 commit from upstream-pr/2516 into main 2026-11-29 01:04:39 +00:00
Tyrannys commented 2026-11-28 00:09:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-28T00:09:41Z.


Claimed in the coordination issue as: RT-XS-CONSOLE-PLACEMENT-TITLE-LAYOUT (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230686328). Found by @kevincommits, item 2 of https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230381887. Thanks for the clear repro.

What and why

Device slots 25 (GetResourceAllocationInfo) and 108 (GetResourceAllocationInfo2) size the title's descriptions from their PC form (pc_resource_desc). The PC form drops the console layout word (0x100 | swizzle mode) to 0, so console_placement gets the title's own array as title_descs for the words it lost. The unordered-access rule (console_unordered_access_size) already read the layout from title_descs. console_texture_layout, the rule for a texture only the CPU fills (no render-target, depth-stencil or unordered-access flag), read it from the PC form. So such a texture was sized in XG's default swizzle mode, not the one the title named:

Texture Title's layout word XG size, align (title's mode) Before (default mode)
64 x 64 BC7, 1 mip 0x109 (SW_64KB_S) 65536, 65536 4096, 4096
32 x 32 RGBA8, 1 mip 0x100 (linear) 8192, 256 4096, 4096

The rule exists because the title reads exactly the size it was given for such a texture from its archives, so a size too small is a real fault.

Fix. console_texture_layout takes the layout word as a parameter. console_placement passes (title_descs ? title_descs : descs)[i].Layout at both of its uses, and apply_console_placement does the same at its third. When descs is the title's own array (slot 56, or a PC-form call) nothing changes. The flags and everything else still come from the PC form, as before.

Tested

  • xs_proxy_mock_test (CPU only, synthetic descriptions, no GPU or game data), in check_render_target_sizes:
    • Slot 25 in the console form: the two textures above take XG's size and alignment in the title's mode. The same textures with the mode left to XG (layout 0) keep XG's default answer.
    • Slot 108 on a device with PC slot 68 gives the same per-description answer.
    • On main the first new check fails (info.SizeInBytes == 65536 && info.Alignment == 65536); with the fix the whole test passes (exit 0).
  • Built with MSVC 17 (/W4), Release; no new warnings.

GPUs tested: n/a (CPU mock).

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • 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.
  • Overlap checked: #2027 and #2029 change other parts of d3d12_xs_alloc_size.h (guards and duplicate passes), not where the layout word comes from. #2029 edits the same any_target loop, so whichever lands second needs a small merge there.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5534778695 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2516). Originally posted by [Tyrannys](https://github.com/Tyrannys) on 2026-11-28T00:09:41Z. --- Claimed in the coordination issue as: RT-XS-CONSOLE-PLACEMENT-TITLE-LAYOUT (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230686328). Found by @kevincommits, item 2 of https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230381887. Thanks for the clear repro. ### What and why Device slots 25 (`GetResourceAllocationInfo`) and 108 (`GetResourceAllocationInfo2`) size the title's descriptions from their PC form (`pc_resource_desc`). The PC form drops the console layout word (`0x100 | swizzle mode`) to 0, so `console_placement` gets the title's own array as `title_descs` for the words it lost. The unordered-access rule (`console_unordered_access_size`) already read the layout from `title_descs`. `console_texture_layout`, the rule for a texture only the CPU fills (no render-target, depth-stencil or unordered-access flag), read it from the PC form. So such a texture was sized in XG's default swizzle mode, not the one the title named: | Texture | Title's layout word | XG size, align (title's mode) | Before (default mode) | |---|---|---|---| | 64 x 64 BC7, 1 mip | `0x109` (`SW_64KB_S`) | 65536, 65536 | 4096, 4096 | | 32 x 32 RGBA8, 1 mip | `0x100` (linear) | 8192, 256 | 4096, 4096 | The rule exists because the title reads exactly the size it was given for such a texture from its archives, so a size too small is a real fault. **Fix.** `console_texture_layout` takes the layout word as a parameter. `console_placement` passes `(title_descs ? title_descs : descs)[i].Layout` at both of its uses, and `apply_console_placement` does the same at its third. When `descs` is the title's own array (slot 56, or a PC-form call) nothing changes. The flags and everything else still come from the PC form, as before. ### Tested - `xs_proxy_mock_test` (CPU only, synthetic descriptions, no GPU or game data), in `check_render_target_sizes`: - Slot 25 in the console form: the two textures above take XG's size and alignment in the title's mode. The same textures with the mode left to XG (layout 0) keep XG's default answer. - Slot 108 on a device with PC slot 68 gives the same per-description answer. - On `main` the first new check fails (`info.SizeInBytes == 65536 && info.Alignment == 65536`); with the fix the whole test passes (exit 0). - Built with MSVC 17 (`/W4`), Release; no new warnings. GPUs tested: n/a (CPU mock). AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [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. - [x] Overlap checked: #2027 and #2029 change other parts of `d3d12_xs_alloc_size.h` (guards and duplicate passes), not where the layout word comes from. #2029 edits the same `any_target` loop, so whichever lands second needs a small merge there. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timbot103 commented 2026-11-28 00:53:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T00:53:18Z.


Independently checked head c05dc2ff5 on Windows 11 Pro 26200, MSVC 2022 (19.44.35230.0, RelWithDebInfo, Ninja), no game files.

Local build & test verification:

  • Clean MSVC build of xs_proxy_mock_test (confirmed apply_console_placement compiles cleanly with title_descs in scope).
  • xs_proxy_mock_test: PASS (12 allocations refused on purpose).

Code review notes:

  • Forwarding the title's layout word (1 for row-major, 0x100 | mode for swizzle modes, otherwise falling back to XG's default) strictly for non-RT/DS/UAV textures and keeping the PC answer when XG refuses looks clean and safely scoped across both console_placement and apply_console_placement.
  • Optional test additions: a row-major (1) case, a mip chain or array texture in a swizzle mode, and an invalid/unknown layout word confirming fallback to XG's default.

Overall looks clean and solid. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7231264549 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2516#issuecomment-7231264549). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T00:53:18Z. --- Independently checked head `c05dc2ff5` on Windows 11 Pro 26200, MSVC 2022 (`19.44.35230.0`, RelWithDebInfo, Ninja), no game files. **Local build & test verification:** - Clean MSVC build of `xs_proxy_mock_test` (confirmed `apply_console_placement` compiles cleanly with `title_descs` in scope). - `xs_proxy_mock_test`: **PASS** (`12 allocations refused on purpose`). **Code review notes:** - Forwarding the title's layout word (`1` for row-major, `0x100 | mode` for swizzle modes, otherwise falling back to XG's default) strictly for non-RT/DS/UAV textures and keeping the PC answer when XG refuses looks clean and safely scoped across both `console_placement` and `apply_console_placement`. - **Optional test additions:** a row-major (`1`) case, a mip chain or array texture in a swizzle mode, and an invalid/unknown layout word confirming fallback to XG's default. Overall looks clean and solid. AI-assisted.
lixonik commented 2026-11-28 09:28:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T09:28:07Z.

Review: APPROVED


Reviewed the diff and tested merged onto main (493867366) with Ninja Release (MSVC).

Passing the title's original layout word ((title_descs ? title_descs : descs)[i].Layout) into console_texture_layout in both console_placement and apply_console_placement cleanly preserves swizzle-mode sizing for CPU-filled console textures across slots 25 and 108.

Tests run

  • ctest --output-on-failure -R "^xs_proxy_mock$": 1/1 passed (2.64 s).

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6096961544 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2516#pullrequestreview-6096961544). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T09:28:07Z. **Review:** APPROVED --- Reviewed the diff and tested merged onto `main` (`493867366`) with Ninja Release (MSVC). Passing the title's original layout word (`(title_descs ? title_descs : descs)[i].Layout`) into `console_texture_layout` in both `console_placement` and `apply_console_placement` cleanly preserves swizzle-mode sizing for CPU-filled console textures across slots 25 and 108. ### Tests run - `ctest --output-on-failure -R "^xs_proxy_mock$"`: **1/1 passed** (2.64 s). AI-assisted (Antigravity, Gemini).
zmasi commented 2026-11-28 09:52:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T09:52:17Z.


#2516 | head c05dc2ff52 (merged cleanly with main 3ca0707dde) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^xs_proxy_mock" --output-on-failure | red on main: xs_proxy_mock_test fails (line 3057: info.SizeInBytes == 65536 && info.Alignment == 65536 — console_texture_layout ignored the title's swizzle/linear Layout word after pc_resource_desc stripped it, sizing a 64x64 BC7 0x109 texture as 4096 B instead of 65536 B) | green on PR+main: 9/9 xs_proxy_mock* CTests pass (xs_proxy_mock in 2.67s plus all 8 slot/reserve/protect/layout variants); check_no_game_data.py 0 violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237520728 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2516#issuecomment-7237520728). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T09:52:17Z. --- #2516 | head c05dc2ff523524183cb78df75055ddee7e4c186a (merged cleanly with main 3ca0707ddec7fd868ecd6df924d751901102fd9c) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^xs_proxy_mock" --output-on-failure` | red on main: `xs_proxy_mock_test` fails (`line 3057: info.SizeInBytes == 65536 && info.Alignment == 65536` — `console_texture_layout` ignored the title's swizzle/linear `Layout` word after `pc_resource_desc` stripped it, sizing a `64x64` BC7 `0x109` texture as `4096 B` instead of `65536 B`) | green on PR+main: `9/9` `xs_proxy_mock*` CTests pass (`xs_proxy_mock` in `2.67s` plus all 8 slot/reserve/protect/layout variants); `check_no_game_data.py` `0` violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yes
OreoFR commented 2026-11-28 22:03:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:03:43Z.


Verified by OreoFR

Run 1 (lot 4)

  • Base: main 09c153948 + PR head c05dc2ff5; integration package 3 of 6 (4 PRs, merged without conflict)
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests
  • Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps)
  • Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main
  • Verdict: CLEAN PACKAGE (no new failure vs main)

Run 2 (lot 4 bis)

  • Base: main 33db04a70 + PR head c05dc2ff5; integration package of 15 PRs
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests; translator suite
  • Red on main: n/a (integration test; main baseline: xbox_present, and flaky xmem)
  • Green with the PR: ctest: only xbox_present fails as on main (xs_proxy_mock failed once, flaky: passes on rerun and 5/5 direct runs); Python: same failures as main, the PRs' tests pass; translator: 507 files, 6405 tests, 0 failures
  • Verdict: CLEAN PACKAGE (no new failure vs main)

All runs

  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246468522 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2516#issuecomment-7246468522). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T22:03:43Z. --- **Verified by OreoFR** **Run 1 (lot 4)** - Base: main `09c153948` + PR head `c05dc2ff5`; integration package 3 of 6 (4 PRs, merged without conflict) - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests - Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps) - Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main - Verdict: CLEAN PACKAGE (no new failure vs main) **Run 2 (lot 4 bis)** - Base: main `33db04a70` + PR head `c05dc2ff5`; integration package of 15 PRs - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests; translator suite - Red on main: n/a (integration test; main baseline: xbox_present, and flaky xmem) - Green with the PR: ctest: only xbox_present fails as on main (xs_proxy_mock failed once, flaky: passes on rerun and 5/5 direct runs); Python: same failures as main, the PRs' tests pass; translator: 507 files, 6405 tests, 0 failures - Verdict: CLEAN PACKAGE (no new failure vs main) **All runs** - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
enlight3d commented 2026-11-29 00:46:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:46:47Z.


Run on PR head c05dc2ff5 (base d44285197, 1 commit; the base is old), checked against main 1bc055e6c (and origin/main c7753ed98): git merge-tree --write-tree finds no conflict with either.

Environment: NVIDIA GeForce RTX 3090 (24 GB), driver 621.40, Windows 11 Pro (build 26300), MSVC 14.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo, SDL3 3.4.20 static installed. CPU tests only.

Configure (as scripts/build_runtime.ps1 does, own build folder): cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON. Only the test target was built, not the whole runtime: cmake --build runtime/build -j 8 --target xs_proxy_mock_test.

Green (PR head): ctest -R "^xs_proxy_mock" --output-on-failure -> 9/9 passed (xs_proxy_mock 2.64 s).

Red (behavioural; no new header, the new checks are in check_render_target_sizes): runtime/shims/d3d12_xs_alloc_size.h and runtime/shims/d3d12_xs_device.cpp put back to base d44285197, test kept, rebuilt xs_proxy_mock_test, ctest -R "^xs_proxy_mock$" -> failed: line 3057: info.SizeInBytes == 65536 && info.Alignment == 65536 (the first new check, the one the PR description names).
Link check: merged into main 1bc055e6c, gta6rt.exe builds and links (RelWithDebInfo, MSVC 19.44); no new imports vs main.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248344655 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2516#issuecomment-7248344655). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T00:46:47Z. --- Run on PR head `c05dc2ff5` (base `d44285197`, 1 commit; the base is old), checked against main `1bc055e6c` (and origin/main `c7753ed98`): `git merge-tree --write-tree` finds no conflict with either. Environment: NVIDIA GeForce RTX 3090 (24 GB), driver 621.40, Windows 11 Pro (build 26300), MSVC 14.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo, SDL3 3.4.20 static installed. CPU tests only. Configure (as scripts/build_runtime.ps1 does, own build folder): `cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON`. Only the test target was built, not the whole runtime: `cmake --build runtime/build -j 8 --target xs_proxy_mock_test`. **Green** (PR head): `ctest -R "^xs_proxy_mock" --output-on-failure` -> 9/9 passed (`xs_proxy_mock` 2.64 s). **Red** (behavioural; no new header, the new checks are in `check_render_target_sizes`): `runtime/shims/d3d12_xs_alloc_size.h` and `runtime/shims/d3d12_xs_device.cpp` put back to base `d44285197`, test kept, rebuilt `xs_proxy_mock_test`, `ctest -R "^xs_proxy_mock$"` -> failed: `line 3057: info.SizeInBytes == 65536 && info.Alignment == 65536` (the first new check, the one the PR description names). Link check: merged into main 1bc055e6c, gta6rt.exe builds and links (RelWithDebInfo, MSVC 19.44); no new imports vs main.
MoonEyes commented 2026-11-29 01:04:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:04:41Z.


Merged after enlight3d (Thib)'s red/green run (RUN, RTX 3090, driver 621.40, Windows 11: green with this PR, red without it, and gta6rt.exe still links) and a re-check here: no conflict with main 193a69286, same head as run, no-game-data green, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on main or Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ).

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248543732 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2516#issuecomment-7248543732). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T01:04:41Z. --- Merged after **enlight3d** (Thib)'s red/green run ([RUN](https://github.com/ProjectLeonida/mandy/pull/2516#issuecomment-7248344655), RTX 3090, driver 621.40, Windows 11: green with this PR, red without it, and `gta6rt.exe` still links) and a re-check here: no conflict with `main` 193a69286, same head as run, `no-game-data` green, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on `main` or Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ). _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
KelboLive commented 2026-11-30 17:02:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T17:02:51Z.


Independent check on Windows (not the author), at c05dc2ff5.

  • Built xs_proxy_mock_test and ran it: PASS (12 allocations refused on purpose), including the bundle/state carry-over, cross-queue ordering, timeout back-off, deferred page remap and non-tearing value-store cases.

Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7285634888 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2516#issuecomment-7285634888). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T17:02:51Z. --- Independent check on Windows (not the author), at `c05dc2ff5`. - Built `xs_proxy_mock_test` and ran it: **PASS** (`12 allocations refused on purpose`), including the bundle/state carry-over, cross-queue ordering, timeout back-off, deferred page remap and non-tearing value-store cases. Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711. AI-assisted: yes (opencode).
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!2516
No description provided.