GPU: read UAV MipSlice from offset 8 in image_words #2599
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!2599
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2599"
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?
@fuzeofficlal on GitHub · 2026-11-25 16:33 UTC · original
fuzeofficlal:fix/gpu-image-words-uav-mip-slice→main· +25 −5 · 1 files · 1 commits · openSummary
image_wordsincrates/victory-gpu/src/descriptor/host.rsreadd[4]for both SRV and UAV texture views.D3D12_SHADER_RESOURCE_VIEW_DESChasFormat(d[0]),ViewDimension(d[1]),Shader4ComponentMapping(d[2]), and 4 bytes of union alignment padding (d[3]), placingMostDetailedMipat offset 16 (d[4]).D3D12_UNORDERED_ACCESS_VIEW_DESChasFormat(d[0]) andViewDimension(d[1]), with the view union starting directly at offset 8 (d[2]), soMipSlicelives atd[2]acrossTexture1D,Texture1DArray,Texture2D,Texture2DArray, andTexture3DUAVs.Reading
d[4]for UAVs read0for a 2D UAV (PlaneSliceis atd[3],d[4]is unused/zero), and readArraySize/WSizefor 2D array and 3D UAVs, corrupting thefirst/lastmip fields encoded into the RDNA image descriptor words.Changes
crates/victory-gpu/src/descriptor/host.rs: readd[2]instead ofd[4]inimage_wordsfor unordered (unordered == true) non-MSAA texture views.a_texture_view_gives_its_image_descriptor_size_fieldsto build descriptor word arrays from actualD3D12_SHADER_RESOURCE_VIEW_DESCandD3D12_UNORDERED_ACCESS_VIEW_DESCstructs (Texture2D,Texture2DArray, andTexture3DUAVs with distinctMipSlicevsd[4]values).Verification
cargo test -p victory-gpu --lib descriptor::host::tests::a_texture_view_gives_its_image_descriptor_size_fields -- --exact— passcargo clippy -p victory-gpu --all-targets -- -D warningsand--features diagnostics— pass (0 warnings)cargo xtask policy— pass (184 files ok)@fuzeofficlal on GitHub · 2026-11-25 17:22 UTC · original
Good catch @DrDarkDK — reading inactive union bytes through
copy_nonoverlappingis indeed UB.Updated (
bf34b7a) to removeas_words/unsafecompletely: the test now verifies allD3D12_SHADER_RESOURCE_VIEW_DESCandD3D12_UNORDERED_ACCESS_VIEW_DESC(1D/1DArray/2D/2DArray/3D) field offsets with compile-timestd::mem::offset_of!assertions and passes fully initialized[u32; 10]arrays with distinctd[2]vsd[4]values. Re-verified tests, clippy (default + diagnostics), andcargo xtask policy.@Marvisak on GitHub · 2026-11-25 23:18 UTC · original
Automated triage for the maintainers.
In
crates/victory-gpu/src/descriptor/host.rs,image_wordsreadd[4]as the first mip for unordered texture views. The view words use the host D3D12 layout (uav_desccasts them directly toD3D12_UNORDERED_ACCESS_VIEW_DESC), and that union starts at byte 8, soMipSliceisd[2].d[4]holdsMipSliceonly in the SRV layout. The one-word fix is correct by the public D3D12 struct layout. The updated testa_texture_view_gives_its_image_descriptor_size_fieldspins the offsets withoffset_of!and covers 2D, 2D-array and 3D UAVs, using values that would catch the old read. The branch merges cleanly with currentmain. CI: passing (check). This is a recommendation for a maintainer to look, not an approval.Generated by Claude Code
@Kajanos on GitHub · 2026-11-26 00:07 UTC · original
Windows 11 / NVIDIA test run, head
bf34b7a1eamerged ontomain63bcca43c6.Setup: Windows 11 Home build 26300, RTX 5080, NVIDIA 621.40, rustc 1.98.1 MSVC, VS 2022 Build Tools, Windows SDK 10.0.26100 (
dxil.dllfrom the SDK).cargo test --locked -p victory-gpu: 231 passed, 0 failed, 1 ignored (same asmain).Not run: the retail title, clippy, and other crates.
AI-assisted (Claude Code)
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.