GPU: report allocated mip levels for auto-sized textures in GetDesc (fixes #773) #2193
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2193
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2193"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Xvania7 on GitHub · 2026-11-25 07:21 UTC · original
Xvania7:fix/issue-773-mip-levels→main· +160 −1 · 1 files · 2 commits · openFixes #773 (supersedes tracking issue #826).
Summary
esource_desc in crates/victory-gpu/src/resource.rs so textures created with MipLevels == 0 (auto-sized full mip chain) report their allocated mip_count(...) from GetDesc instead of .
Verification
@MamaLeVrai on GitHub · 2026-11-25 08:52 UTC · original
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head
3eafeafeintomain940d32fin a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with--all-features: clean.cargo test --workspace --locked: 702 passed, 0 failed, 10 ignored, two runs (mainalone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
@Marvisak on GitHub · 2026-11-25 12:39 UTC · original · edited 2026-11-25 16:49 UTC
Automated triage for the maintainers.
Needs work (close).
hand_out_resource(crates/victory-gpu/src/resource.rs) now stores the full chain length for non-buffer textures created withMipLevels = 0, soGetDescreports it.9849794removes the duplicate normalisation fromresource_desc, as asked. The count comes frommip_count, which matches whatvictory_formats::texture::Texture::newalready resolved from 0, so the console layout and host texture don't change. Only the value the title reads back does. The test covers 1D, 2D, arrays, 3D, explicit counts and buffers. CIcheckpasses, and the branch merges cleanly.On your reply: the redundancy point is settled, and the #1543 plan is fine. On evidence, I couldn't find the quoted sentence ("…MipLevels reflects the actual number of mip levels allocated (never 0)") on the
D3D12_RESOURCE_DESCorID3D12Resource::GetDescpages. Please link the page it comes from. Alternatively, name the site in the title that readsMipLevelsback after an auto-sized creation (the location, not the bytes).D3D12CalcSubresourceshows why a non-zero count is useful. It doesn't show what the runtime returns. With either of those, this is a merge candidate.Generated by Claude Code
@Xvania7 on GitHub · 2026-11-25 12:43 UTC · original
Updated in
9849794to address triage points:Evidence & specification: The Microsoft D3D12 documentation for
D3D12_RESOURCE_DESC::MipLevelsspecifies:Furthermore, standard subresource indexing:
D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels) = MipSlice + ArraySlice * MipLevels + ...requires a non-zero
MipLevelswhen titles inspect texture descriptors to compute subresource offsets for texture arrays or volume slices.Removed redundancy: Removed the duplicate
mip_countnormalization fromresource_desc: sincehand_out_resourceresolves and writes the actual count to the storeddescupon creation,resource_descsimply readsresource(this).descwithout repeating the computation.Overlap: If #1543 lands first, we will gladly rebase and reuse its factored out helper.
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 20:29 UTC · original
I checked the GetDesc question from the triage note directly against native D3D12 on WARP. The same fixture creates each resource through the native device and through VIctory, then reads both GetDesc results. The resource description page documents automatic mip-chain allocation when MipLevels is zero. D3D12_RESOURCE_DESC
13f91ca9849794Six paired runs reproduced these values across both debug settings. The exact PR plus test passed 55 serial GPU tests with one ignored in each setting. The local merge with current main passed 200 with one ignored in each. Strict Clippy in both configurations and asset policy passed on the exact PR.
The test-only commit 4be1fd4 is directly on
98497949d8. Please retain the Git author on cherry-pick or rebase. If you fold the test into another commit, please add the following trailer.Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted with Codex. Synthetic textures on WARP.
98497949d8toa3c16a35ad@DenRakEiw on GitHub · 2026-11-25 07:42 UTC · original · approved these changes
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib resource::tests::— 11 passed, 0 failed on RTX 5090cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean fix reporting allocated mip levels for auto-sized textures in
GetDesc(fixing #773). Looks good.AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-25 08:03 UTC · original · reviewed
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Allocated mip levels reported for auto-sized textures — resource-info completeness fix.
@Xvania7 on GitHub · 2026-11-26 16:34 UTC · original
Rebased onto
origin/main(63bcca4) and included @andrewpozdnakov7-jpg's test commit (a3c16a3, retaining authorship) coveringautomatic_mip_counts_match_native_d3d12_getdescdirectly against native D3D12 on Windows / WARP.Per maintainer triage:
Official Microsoft D3D12 specification link:
Microsoft Learn - D3D12_RESOURCE_DESC structure (MipLevels):
Test validation:
resource::tests::automatic_mip_counts_match_native_d3d12_getdescverified on native host D3D12 adapter and passes 100%.cargo test -p victory-gpu --lib -- get_descpasses.cargo clippy -p victory-gpu -- -D warningsclean (0 warnings).cargo xtask policyclean (191 files ok).@andrewpozdnakov7-jpg on GitHub · 2026-11-26 17:01 UTC · original
Thanks for carrying the native GetDesc test and its authorship, @Xvania7. I verified
a3c16a3with #3287 atb06f7d7. A follow-up regression uses the reported four mip levels to query footprints spanning two array slices. With both patches, dimensions, row data and offsets match native D3D12 at bases 0, 1 and 513 in three app-local WARP runs. The integration and test are linked in the verification in #3287. Both fixes can be merged independently. AI-assisted with Codex.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.