XG accepts the depth swizzle for Xbox D16_UNORM_S8_UINT #4266

Open
github-bot wants to merge 1 commit from github-bot/gh-4265 into main AGit
Owner

@⁠RanoGames on GitHub · 2026-11-30 17:57 UTC · original
RanoGames:fix/xg-d16s8-swizzle-validation → main · +18 −3 · 1 files · 1 commits · open

What it changes

A title using D16_UNORM_S8_UINT can ask XG for its depth-stencil swizzle mode, pass the answer straight to the validator, and receive E_INVALIDARG. Xbox uses format 118 for this 16-bit depth plus 8-bit stencil resource.

Recognise 118 as a depth resource in XGValidateDepthStencilSwizzleMode. Formats 119 and 120 are the corresponding shader views. Microsoft DirectXTex format definitions

How it was tested

  • CPU-only Windows regression through XGComputeOptimalDepthStencilSwizzleMode and XGValidateDepthStencilSwizzleMode using a synthetic 640×480 surface.

  • Before the fix the picker returned SW_64KB_Z_X and the validator rejected it for format 118.

  • After the fix the validator accepts that mode for 1, 2, 4 and 8 samples and returns E_INVALIDARG for both shader views.

  • cargo test --locked -p victory-hle -- --test-threads=1 passed (470 unit tests, 2 integration tests, 13 ignored). An XMem timing assertion failed in the first parallel run and passed in isolation.

  • The PR CI run stopped at the same three Clippy diagnostics as the base commit's CI run.

Checked for overlap

  • Searched open and closed PRs for the validator and the format, and checked PRs touching the XG implementation. #1510 introduced the depth-stencil validation export. #3225 concerns mip layout and offsets.
**@⁠RanoGames** on GitHub · 2026-11-30 17:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4265) `RanoGames:fix/xg-d16s8-swizzle-validation` → `main` · +18 −3 · 1 files · 1 commits · open ## What it changes A title using `D16_UNORM_S8_UINT` can ask XG for its depth-stencil swizzle mode, pass the answer straight to the validator, and receive `E_INVALIDARG`. Xbox uses format 118 for this 16-bit depth plus 8-bit stencil resource. Recognise 118 as a depth resource in `XGValidateDepthStencilSwizzleMode`. Formats 119 and 120 are the corresponding shader views. [Microsoft DirectXTex format definitions](https://github.com/microsoft/DirectXTex/blob/main/DirectXTex/DirectXTexP.h) ## How it was tested - CPU-only Windows regression through `XGComputeOptimalDepthStencilSwizzleMode` and `XGValidateDepthStencilSwizzleMode` using a synthetic 640×480 surface. - Before the fix the picker returned `SW_64KB_Z_X` and the validator rejected it for format 118. - After the fix the validator accepts that mode for 1, 2, 4 and 8 samples and returns `E_INVALIDARG` for both shader views. - `cargo test --locked -p victory-hle -- --test-threads=1` passed (470 unit tests, 2 integration tests, 13 ignored). An XMem timing assertion failed in the first parallel run and passed in isolation. - The [PR CI run](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46478991080) stopped at the same three Clippy diagnostics as the [base commit's CI run](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46462292806). ## Checked for overlap - [x] Searched open and closed PRs for the validator and the format, and checked PRs touching the XG implementation. #1510 introduced the depth-stencil validation export. #3225 concerns mip layout and offsets.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 18:09:39 +00:00
Author
Owner

@⁠babuakhil on GitHub · 2026-11-30 19:23 UTC · original

Checked on Windows 11 (Rust 1.98.1, pinned), applied on current main (e1251c31); cherry-picks cleanly. cargo test -p victory-hle --lib modules::xg:: gives 16 passed, 0 failed. With only the 118 taken back out of is_depth_format, the new test fails as described (XGValidateDepthStencilSwizzleMode(118, …) returns 0x80070057 where it expects S_OK), so it pins the fix. Not tested in the game.

The format numbers agree with the rest of the tree: victory_formats::texture::format already has 118..=120 => (2, 1, true), a 2-byte depth with stencil in its own plane, the same family shape as 19..=22 and 44..=47. Accepting the depth resource (118) and refusing its two shader views (119, 120) matches what the validator already does for those families (19/20 and 44/45 accepted, 21/22 and 46/47 not).

**@⁠babuakhil** on GitHub · 2026-11-30 19:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4265#issuecomment-7289326075) Checked on Windows 11 (Rust 1.98.1, pinned), applied on current `main` (`e1251c31`); cherry-picks cleanly. `cargo test -p victory-hle --lib modules::xg::` gives 16 passed, 0 failed. With only the `118` taken back out of `is_depth_format`, the new test fails as described (`XGValidateDepthStencilSwizzleMode(118, …)` returns `0x80070057` where it expects `S_OK`), so it pins the fix. Not tested in the game. The format numbers agree with the rest of the tree: `victory_formats::texture::format` already has `118..=120 => (2, 1, true)`, a 2-byte depth with stencil in its own plane, the same family shape as `19..=22` and `44..=47`. Accepting the depth resource (118) and refusing its two shader views (119, 120) matches what the validator already does for those families (19/20 and 44/45 accepted, 21/22 and 46/47 not).
github-bot force-pushed github-bot/gh-4265 from 002442a0a6 to 1da0fedfa0 2026-12-01 15:55:47 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/4266/head:github-bot/gh-4265'
git switch 'github-bot/gh-4265'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4265'
git switch 'github-bot/gh-4265'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4265'
git switch 'github-bot/gh-4265'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4265'
git switch 'main'
git merge --squash 'github-bot/gh-4265'
git switch 'main'
git merge --ff-only 'github-bot/gh-4265'
git switch 'main'
git merge 'github-bot/gh-4265'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4266
No description provided.