GPU: preserve the resource minimum LOD in streamed texture views #1207

Open
BradRoland wants to merge 1 commit from upstream-pr/1210 into main
BradRoland commented 2026-11-26 00:10:53 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by BradRoland on 2026-11-26T00:10:53Z.


When levels on demand hides an unbacked mip, show_from moves the start of the shader view and also lowers the title’s ResourceMinLODClamp. With mip 0 unbacked and a minimum of 3, the adjusted view consequently samples mip 2. The minimum is expressed in resource mip coordinates. This change preserves it for 2D and 2D-array views. D3D12 texture view documentation

Credit to teecil for identifying the coordinate issue in the pending resident-range change. I reproduced it independently on current main using the existing reserved-texture fixture, which exercises the path added in #747. Original report on #1031

The fixture fills each mip with a different byte and samples LOD 0 through both descriptors. Results matched on a GeForce RTX 4080 (621.14) and WARP, with the D3D12 debug layer enabled.

Resource minimum Original view Adjusted before Adjusted after
0 0 (unbacked) 32 (mip 1) 32 (mip 1)
3 64 (mip 3) 48 (mip 2) 64 (mip 3)

All three ordinary tile tests and 29 descriptor tests passed. The full opt-in tile test passed on each adapter. This was a synthetic run. In-game impact is unmeasured.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6616449857 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1210). Originally posted by [BradRoland](https://github.com/BradRoland) on 2026-11-26T00:10:53Z. --- When levels on demand hides an unbacked mip, `show_from` moves the start of the shader view and also lowers the title’s `ResourceMinLODClamp`. With mip 0 unbacked and a minimum of 3, the adjusted view consequently samples mip 2. The minimum is expressed in resource mip coordinates. This change preserves it for 2D and 2D-array views. [D3D12 texture view documentation](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_tex2d_srv) Credit to teecil for identifying the coordinate issue in the pending resident-range change. I reproduced it independently on current main using the existing reserved-texture fixture, which exercises the path added in #747. [Original report on #1031](https://github.com/fxceless/victory-fork/pull/1031#issuecomment-7171007358) The fixture fills each mip with a different byte and samples LOD 0 through both descriptors. Results matched on a GeForce RTX 4080 (621.14) and WARP, with the D3D12 debug layer enabled. | Resource minimum | Original view | Adjusted before | Adjusted after | | --- | ---: | ---: | ---: | | 0 | 0 (unbacked) | 32 (mip 1) | 32 (mip 1) | | 3 | 64 (mip 3) | 48 (mip 2) | 64 (mip 3) | All three ordinary tile tests and 29 descriptor tests passed. The full opt-in tile test passed on each adapter. This was a synthetic run. In-game impact is unmeasured.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1210:upstream-pr/1210'
git switch 'upstream-pr/1210'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1210'
git switch 'upstream-pr/1210'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1210'
git switch 'upstream-pr/1210'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1210'
git switch 'main'
git merge --squash 'upstream-pr/1210'
git switch 'main'
git merge --ff-only 'upstream-pr/1210'
git switch 'main'
git merge 'upstream-pr/1210'
git push origin 'main'
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
fxceless/victory-fork!1207
No description provided.