Keep the shape of default texture SRV fallbacks #4883

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

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 12:42 UTC · original
andrewpozdnakov7-jpg:codex2/fix/default-srv-null-dimension → main · +37 −9 · 2 files · 1 commits · open

Refs #4860

What it changes

A texture SRV created with a default descriptor normally takes its dimension from the resource. If the host copy is missing, null_for currently substitutes a 2D descriptor, even for an array, a 1D or 3D texture, or a multisampled texture. D3D12 default SRV behavior

This change uses the registered texture's dimension, array size, and sample count to select the null descriptor. The metadata lookup can return immediately when the texture table is busy. The generic 2D fallback is used when the shape is unavailable.

How it was tested

  • One Windows Rust fixture ran the exact fallback functions with the texture registry and D3D12 device stubbed. Main 5fabb46e and release e1251c31 use the same fallback source. It selected the wrong dimension in 6 of 7 implicit SRV cases.
  • On 35b8b3e84a50247366914706d66a7ad17ccfd4b0, all seven matched, including the 2D MSAA array. The fixture also checked a typed cube descriptor, a buffer, a missing resource, and a busy texture table. This checks the descriptor fields sent to the device stub. An in-game check focused on fallback dimensions remains open.
  • An independent Linux/RTX 5090 comparison on 5fabb46e with and without 35b8b3e8 found that the flashing in #4860 persisted. The “another dimension” bucket was 83.0% on main and 83.6% with the patch. That comparison measured flashing and slot rewrite frequency. A follow-up measurement split roughly 480,000 entries from that bucket. About 98% had a buffer or other non-texture destination, and the sampled set contained zero default-description resource views. That result narrows the flashing investigation in #4860. The synthetic cases above remain the evidence for this PR's null descriptor dimensions. Independent report Counter breakdown
  • cargo xtask policy --staged accepted both source files.
  • Main's CI check has five existing Clippy errors tracked in #4708.

Checked for overlap

  • Searched for default SRV, null descriptor dimensions, and texture fallback work. #3780 added stand-ins for explicitly dimensioned views, #2955 concerns default depth-stencil views, and #4864 retries temporary stand-in allocation failures.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 12:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4882) `andrewpozdnakov7-jpg:codex2/fix/default-srv-null-dimension` → `main` · +37 −9 · 2 files · 1 commits · open Refs #4860 ## What it changes A texture SRV created with a default descriptor normally takes its dimension from the resource. If the host copy is missing, `null_for` currently substitutes a 2D descriptor, even for an array, a 1D or 3D texture, or a multisampled texture. [D3D12 default SRV behavior](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createshaderresourceview) This change uses the registered texture's dimension, array size, and sample count to select the null descriptor. The metadata lookup can return immediately when the texture table is busy. The generic 2D fallback is used when the shape is unavailable. ## How it was tested - One Windows Rust fixture ran the exact fallback functions with the texture registry and D3D12 device stubbed. Main `5fabb46e` and release `e1251c31` use the same fallback source. It selected the wrong dimension in 6 of 7 implicit SRV cases. - On `35b8b3e84a50247366914706d66a7ad17ccfd4b0`, all seven matched, including the 2D MSAA array. The fixture also checked a typed cube descriptor, a buffer, a missing resource, and a busy texture table. This checks the descriptor fields sent to the device stub. An in-game check focused on fallback dimensions remains open. - An independent Linux/RTX 5090 comparison on `5fabb46e` with and without `35b8b3e8` found that the flashing in #4860 persisted. The “another dimension” bucket was 83.0% on main and 83.6% with the patch. That comparison measured flashing and slot rewrite frequency. A follow-up measurement split roughly 480,000 entries from that bucket. About 98% had a buffer or other non-texture destination, and the sampled set contained zero default-description resource views. That result narrows the flashing investigation in #4860. The synthetic cases above remain the evidence for this PR's null descriptor dimensions. [Independent report](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/4860) [Counter breakdown](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/4860) - `cargo xtask policy --staged` accepted both source files. - Main's [CI check](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46563306780/job/142355972539) has five existing Clippy errors tracked in #4708. ## Checked for overlap - [x] Searched for default SRV, null descriptor dimensions, and texture fallback work. #3780 added stand-ins for explicitly dimensioned views, #2955 concerns default depth-stencil views, and #4864 retries temporary stand-in allocation failures. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 12:43:07 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-12-01 16:23 UTC · original · approved these changes

Reviewed crates/victory-gpu/src/descriptor/host.rs and crates/victory-gpu/src/resource.rs: resolving View::Shader(r, None) through default_texture_srv_dimension (non-blocking extures_now()) keeps fallback null SRVs matched to the texture's actual D3D12 SRV dimension (1D/2D/3D, array, MSAA) instead of defaulting to 2D. Verified on Windows (RTX 5090): cargo test -p victory-gpu --lib descriptor::host::tests::null_ -- --test-threads=1 (2 passed, 0 failed).

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-12-01 16:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4882#pullrequestreview-6135368480) · **approved these changes** Reviewed crates/victory-gpu/src/descriptor/host.rs and crates/victory-gpu/src/resource.rs: resolving View::Shader(r, None) through default_texture_srv_dimension (non-blocking extures_now()) keeps fallback null SRVs matched to the texture's actual D3D12 SRV dimension (1D/2D/3D, array, MSAA) instead of defaulting to 2D. Verified on Windows (RTX 5090): cargo test -p victory-gpu --lib descriptor::host::tests::null_ -- --test-threads=1 (2 passed, 0 failed). Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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/4883/head:github-bot/gh-4882'
git switch 'github-bot/gh-4882'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4882'
git switch 'github-bot/gh-4882'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4882'
git switch 'github-bot/gh-4882'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4882'
git switch 'main'
git merge --squash 'github-bot/gh-4882'
git switch 'main'
git merge --ff-only 'github-bot/gh-4882'
git switch 'main'
git merge 'github-bot/gh-4882'
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!4883
No description provided.