GPU: multisampled host textures have no unordered access #2351

Closed
BastienRodz wants to merge 1 commit from upstream-pr/2353 into main
BastienRodz commented 2026-11-25 11:26:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-25T11:26:34Z.


What's wrong

host_desc keeps the console's ALLOW_UNORDERED_ACCESS on multisampled textures. It drops the flag only for depth targets. D3D12 says of that flag "Can't be used with MSAA textures" (D3D12_RESOURCE_FLAGS), so the host refuses such a texture and the title's texture has no host copy. With the flag on, sRGB multisampled textures are also made typeless for no reason, and legal_for allows them the unordered-access state.

What the fix does

The condition that drops UNORDERED for depth targets in host_desc also covers sample_count > 1. legal_for and the unordered-view check (descriptor::host::fits) already go by the host texture's flags, so multisampled textures leave the unordered-access state and get no unordered views. Single-sampled textures are unchanged.

Tests

New device-free resource::tests::msaa_textures_drop_unordered_access:

  • a 4x render target with the unordered flag keeps only the render-target flag, and legal_for drops UNORDERED_ACCESS from its states;
  • a 2x sRGB target stays typed;
  • a single-sampled one keeps both flags.

Results:

Not tested

No title run, and no GPU run. Whether the title creates multisampled textures with the unordered flag is not measured; if it does, they currently have no host texture.

Fixes #2352

AI-assisted (Gemini 4 Neon found and wrote it, Claude Code reviewed, simplified and verified it). No game data used.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6603427632 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2353). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-25T11:26:34Z. --- ### What's wrong `host_desc` keeps the console's `ALLOW_UNORDERED_ACCESS` on multisampled textures. It drops the flag only for depth targets. D3D12 says of that flag "Can't be used with MSAA textures" ([`D3D12_RESOURCE_FLAGS`](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_resource_flags)), so the host refuses such a texture and the title's texture has no host copy. With the flag on, sRGB multisampled textures are also made typeless for no reason, and `legal_for` allows them the unordered-access state. ### What the fix does The condition that drops `UNORDERED` for depth targets in `host_desc` also covers `sample_count > 1`. `legal_for` and the unordered-view check (`descriptor::host::fits`) already go by the host texture's flags, so multisampled textures leave the unordered-access state and get no unordered views. Single-sampled textures are unchanged. ### Tests New device-free `resource::tests::msaa_textures_drop_unordered_access`: - a 4x render target with the unordered flag keeps only the render-target flag, and `legal_for` drops `UNORDERED_ACCESS` from its states; - a 2x sRGB target stays typed; - a single-sampled one keeps both flags. Results: - On `main` (940d32f) it fails: `left: 5`, `right: 1`. - With the fix it and the other `resource::tests` pass (11 of 11, Wine 10, x86_64-pc-windows-msvc). - windows-latest run on the fork: https://github.com/BastienRodz/VIctory/actions/runs/45604386874 ### Not tested No title run, and no GPU run. Whether the title creates multisampled textures with the unordered flag is not measured; if it does, they currently have no host texture. Fixes #2352 AI-assisted (Gemini 4 Neon found and wrote it, Claude Code reviewed, simplified and verified it). No game data used. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-25 12:03:29 +00:00
DenRakEiw commented 2026-11-25 12:03:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T11:30:19Z.

Review: APPROVED


Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Dropping UNORDERED on multisampled host textures cleanly avoids invalid D3D12 resource descriptions.
  • cargo test -p victory-gpu resource::tests: 11/11 passed on RTX 5090, 11/11 passed on WARP (including msaa_textures_drop_unordered_access).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6056809828 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2353#pullrequestreview-6056809828). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T11:30:19Z. **Review:** APPROVED --- Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Dropping `UNORDERED` on multisampled host textures cleanly avoids invalid D3D12 resource descriptions. - `cargo test -p victory-gpu resource::tests`: 11/11 passed on RTX 5090, 11/11 passed on WARP (including `msaa_textures_drop_unordered_access`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 12:03:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T11:52:02Z.

Review: COMMENTED


Multisampled host textures drop unordered access (same family as depth+UAV refusal). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Small correct fix with test.

<!-- greyfinch-sync:Marvisak/VIctory:review:6057090521 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2353#pullrequestreview-6057090521). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T11:52:02Z. **Review:** COMMENTED --- Multisampled host textures drop unordered access (same family as depth+UAV refusal). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Small correct fix with test.
DrDarkDK commented 2026-11-25 12:03:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DrDarkDK on 2026-11-25T11:30:00Z.


I tested synthetic 32×32 committed render targets on native Windows with an RTX 4070 Ti (621.01) and WARP, with the D3D12 debug layer off and on. I verified that the debug info queue was active in the enabled runs.

Both backends behaved the same:

Guest resource Parent 940d32f PR 095aabc
4× MSAA UNORM, RT + UAV Created with both flags Created with RT only
4× MSAA sRGB, RT + UAV Created as typeless with both flags Created as typed sRGB with RT only
Single-sample UNORM, RT + UAV Created with both flags Created with both flags

This confirms the host descriptor correction on both backends. The parent did not reproduce a missing host texture in this fixture, even with the debug layer active. This was a resource-creation test only.

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161126594 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2353#issuecomment-7161126594). Originally posted by [DrDarkDK](https://github.com/DrDarkDK) on 2026-11-25T11:30:00Z. --- I tested synthetic 32×32 committed render targets on native Windows with an RTX 4070 Ti (621.01) and WARP, with the D3D12 debug layer off and on. I verified that the debug info queue was active in the enabled runs. Both backends behaved the same: | Guest resource | Parent `940d32f` | PR `095aabc` | |---|---|---| | 4× MSAA UNORM, RT + UAV | Created with both flags | Created with RT only | | 4× MSAA sRGB, RT + UAV | Created as typeless with both flags | Created as typed sRGB with RT only | | Single-sample UNORM, RT + UAV | Created with both flags | Created with both flags | This confirms the host descriptor correction on both backends. The parent did not reproduce a missing host texture in this fixture, even with the debug layer active. This was a resource-creation test only. *AI-assisted with Codex.*
BastienRodz commented 2026-11-25 12:03:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-25T11:32:25Z.


Thanks @DrDarkDK, that settles it the other way. The parent creating the 4x texture with both flags on an RTX 4070 Ti and on WARP means the host doesn't refuse the combination. Newer runtimes and drivers support writable MSAA textures (D3D12_FEATURE_DATA_D3D12_OPTIONS14::WriteableMSAATexturesSupported), and the "Can't be used with MSAA textures" line in the flag docs predates that.

So on hosts like these, this PR would take away unordered access the title can actually use, which is a regression rather than a fix. A correct version would drop the flag only when that option is false. That needs a new host capability query for old drivers alone, and nothing shows a title hitting it. I'm closing this PR and #2352. Thanks @DenRakEiw for the runs as well.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161178653 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2353#issuecomment-7161178653). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-25T11:32:25Z. --- Thanks @DrDarkDK, that settles it the other way. The parent creating the 4x texture with both flags on an RTX 4070 Ti and on WARP means the host doesn't refuse the combination. Newer runtimes and drivers support writable MSAA textures (`D3D12_FEATURE_DATA_D3D12_OPTIONS14::WriteableMSAATexturesSupported`), and the "Can't be used with MSAA textures" line in the flag docs predates that. So on hosts like these, this PR would take away unordered access the title can actually use, which is a regression rather than a fix. A correct version would drop the flag only when that option is false. That needs a new host capability query for old drivers alone, and nothing shows a title hitting it. I'm closing this PR and #2352. Thanks @DenRakEiw for the runs as well.

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
Marvisak/VIctory!2351
No description provided.