D3D12.X: a placed view's padding does not make a second texture #2764

Open
github-bot wants to merge 1 commit from github-bot/gh-2764 into amd-dev AGit
Owner

@⁠GreemSC on GitHub · 2026-11-26 10:59 UTC · original
GreemSC:amd-dev-placed-key-padding → amd-dev · +20 −0 · 1 files · 1 commits · draft

format_alias::prepare_placed_srv_desc and prepare_placed_uav_desc key placed_srvs / placed_uavs by (address, the 0x38-byte console resource description) and clear only 0x34.. of it. Bytes 0x04..0x08 are the padding between Dimension and Alignment; the retail title leaves stack bytes there, so the same view at the same address made a second PC texture, with its own views, whenever that padding differed. Both now clear it too.

This is the amd-dev side of #2743; main's resource_at has the same key and is fixed by #2762 (joeypercia). Spotting the padding came from the VIctory project's notes (GPL-3.0, read only; no code taken).

What is in it

  • crates/xcl/src/hle/d3d12x/format_alias.rs: clear 0x04..0x08 in both prepares; test placed_descs_ignore_the_padding_after_dimension (fails without the change: the key keeps the padding bytes).

Tested

  • RX 7900 XT 20 GB (Mesa 26.2.5 RADV), i7-12700K, Linux 7.2, Proton-CachyOS Wine 11, vkd3d-proton with dxil-spirv 53aac41; Rust 1.100.0; the Windows MSVC test binary run under Wine (release).
  • placed_descs_ignore_the_padding_after_dimension and placed_uav_and_srv_descs_are_sanitized: pass; the new test fails with the two lines taken out.
  • Whole xcl lib suite under Wine, --test-threads=4, skipping pso_async::used_tests and list_x::tests::a_dispatch_with_a_pipeline_still_building (they abort the binary on amd-dev, #2632): the binary still stops at the same test on this head and on amd-dev b5c0275, after 1,046 ok / 84 failed here and 1,047 ok / 81 failed there. The failures are the same tests on both, plus 3 GPU tests on this run (gpu_qsad_and_mqsad, gpu_split_wave64_cross_half_operations, gpu_split_wave64_lane_local_masks) that pass run alone; the new test passes.
  • Retail title, amd-dev b5c0275 + the Wine stack this machine needs (#1732 with #867/#871/#877, #684, #1860, a readback-list guard from #846) + a local counter of the table, warm caches, 200 s, one run each:
without with this change
placed_srvs entries at 150 s 59,112 41,194
at 190 s 60,925 41,965 (−31 %)
tracked textures at 190 s 64,473 45,531
title's anonymous memory at 190 s 11.85 GB 11.83 GB
crashes / device removals 0 / 0 0 / 0

Fewer objects; no memory difference measurable in a 200 s run (each entry is a few KB of host memory here).

Regression run

  • Not yet: under Wine, amd-dev without the Wine stack stops at ~2.5 s, so a smoke pair from this machine covers nothing. Keeping this a draft until there is a Windows pair (amd-dev b5c0275 and this head).

Not tested

  • Windows (native), NVIDIA, a smoke pair, more than one run a side, the open world.

AI use

  • Claude Code (Claude Opus 5.5): wrote the change, the test and this description, ran the tests and the runs.
**@⁠GreemSC** on GitHub · 2026-11-26 10:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/2764) `GreemSC:amd-dev-placed-key-padding` → `amd-dev` · +20 −0 · 1 files · 1 commits · draft `format_alias::prepare_placed_srv_desc` and `prepare_placed_uav_desc` key `placed_srvs` / `placed_uavs` by (address, the 0x38-byte console resource description) and clear only `0x34..` of it. Bytes `0x04..0x08` are the padding between `Dimension` and `Alignment`; the retail title leaves stack bytes there, so the same view at the same address made a second PC texture, with its own views, whenever that padding differed. Both now clear it too. This is the `amd-dev` side of #2743; `main`'s `resource_at` has the same key and is fixed by #2762 (joeypercia). Spotting the padding came from the VIctory project's notes (GPL-3.0, read only; no code taken). **What is in it** - `crates/xcl/src/hle/d3d12x/format_alias.rs`: clear `0x04..0x08` in both prepares; test `placed_descs_ignore_the_padding_after_dimension` (fails without the change: the key keeps the padding bytes). **Tested** - RX 7900 XT 20 GB (Mesa 26.2.5 RADV), i7-12700K, Linux 7.2, Proton-CachyOS Wine 11, vkd3d-proton with dxil-spirv 53aac41; Rust 1.100.0; the Windows MSVC test binary run under Wine (release). - `placed_descs_ignore_the_padding_after_dimension` and `placed_uav_and_srv_descs_are_sanitized`: pass; the new test fails with the two lines taken out. - Whole `xcl` lib suite under Wine, `--test-threads=4`, skipping `pso_async::used_tests` and `list_x::tests::a_dispatch_with_a_pipeline_still_building` (they abort the binary on `amd-dev`, #2632): the binary still stops at the same test on this head and on `amd-dev` `b5c0275`, after 1,046 ok / 84 failed here and 1,047 ok / 81 failed there. The failures are the same tests on both, plus 3 GPU tests on this run (`gpu_qsad_and_mqsad`, `gpu_split_wave64_cross_half_operations`, `gpu_split_wave64_lane_local_masks`) that pass run alone; the new test passes. - Retail title, `amd-dev` `b5c0275` + the Wine stack this machine needs (#1732 with #867/#871/#877, #684, #1860, a readback-list guard from #846) + a local counter of the table, warm caches, 200 s, one run each: | | without | with this change | |---|---:|---:| | `placed_srvs` entries at 150 s | 59,112 | 41,194 | | at 190 s | 60,925 | **41,965 (−31 %)** | | tracked textures at 190 s | 64,473 | 45,531 | | title's anonymous memory at 190 s | 11.85 GB | 11.83 GB | | crashes / device removals | 0 / 0 | 0 / 0 | Fewer objects; no memory difference measurable in a 200 s run (each entry is a few KB of host memory here). **Regression run** - Not yet: under Wine, `amd-dev` without the Wine stack stops at ~2.5 s, so a smoke pair from this machine covers nothing. Keeping this a draft until there is a Windows pair (`amd-dev` `b5c0275` and this head). **Not tested** - Windows (native), NVIDIA, a smoke pair, more than one run a side, the open world. **AI use** - Claude Code (Claude Opus 5.5): wrote the change, the test and this description, ran the tests and the runs.
`prepare_placed_srv_desc` and `prepare_placed_uav_desc` key `placed_srvs` /
`placed_uavs` by (address, 0x38-byte console resource description) and
clear only 0x34.. of it. Bytes 0x04..0x08 are the padding between
`Dimension` and `Alignment`; the retail title leaves stack bytes there, so
the same view at the same address made a second PC texture (and its views)
whenever that padding differed. Both now clear it too.

Measured on the retail title (RX 7900 XT, RADV, Wine, amd-dev b5c0275 with
the Wine stack), one 200 s run each: `placed_srvs` held 60,925 entries at
190 s without the change and 41,965 with it (-31 %); the same share as
main's `resource_at` (#2743, fixed there by #2762).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:15:03 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2764/head:github-bot/gh-2764'
git switch 'github-bot/gh-2764'

Merge

Merge the changes and update on Forgejo.
git switch 'amd-dev'
git merge --no-ff 'github-bot/gh-2764'
git switch 'github-bot/gh-2764'
git rebase 'amd-dev'
git switch 'amd-dev'
git merge --ff-only 'github-bot/gh-2764'
git switch 'github-bot/gh-2764'
git rebase 'amd-dev'
git switch 'amd-dev'
git merge --no-ff 'github-bot/gh-2764'
git switch 'amd-dev'
git merge --squash 'github-bot/gh-2764'
git switch 'amd-dev'
git merge --ff-only 'github-bot/gh-2764'
git switch 'amd-dev'
git merge 'github-bot/gh-2764'
git push origin 'amd-dev'
This discussion has been locked. Commenting is limited to contributors.
No description provided.