GPU: validate texture SRV and UAV dimensions, ranges, planes, and swizzles #3201
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!3201
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3201"
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-26 12:25 UTC · original
fuzeofficlal:fix/gpu-validate-texture-srv-uav→main· +653 −0 · 1 files · 1 commits · openSummary
descriptor::host::makevalidates resource permissions and format compatibility infits(), but previously forwarded explicit textureD3D12_SHADER_RESOURCE_VIEW_DESCandD3D12_UNORDERED_ACCESS_VIEW_DESCstructures directly toID3D12Device::CreateShaderResourceViewandID3D12Device::CreateUnorderedAccessViewwithout validating their view dimensions, mip/slice/plane ranges, or component mapping.Because both D3D12 view creation methods return
void, an invalid texture view description permanently removes the retail GPU device (GetDeviceRemovedReason() == DXGI_ERROR_INVALID_CALL/0x887A0001) even without the D3D12 Debug Layer enabled, causing the nextHost::execute()submission to abort the process.What Changed
In
crates/victory-gpu/src/descriptor/host.rs:plane_count(DXGI_FORMAT)viaCheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO)andvalid_plane()checkingPlaneSlice < plane_countplus depth/stencil plane-format pairing (R24_UNORM_X8_TYPELESS/R32_FLOAT_X8X24_TYPELESSon plane 0;X24_TYPELESS_G8_UINT/X32_TYPELESS_G8X24_UINTon plane 1).valid_component_mapping()validatingShader4ComponentMapping(bit 12 set, upper bits clear, each 3-bit channel selector in0..=5).range_in_bounds()with overflow-freeu64arithmetic preserving D3D12'su32::MAXremaining-range sentinel.texture_srv_fits()andtexture_uav_fits()beforeCreateShaderResourceView/CreateUnorderedAccessViewinmake()(also coveringView::Placedtexture views viaplaced_texture()), validating:ViewDimensionagainst resourceDimensionandSampleDesc.Count(rejecting mismatched 1D/2D/3D/buffer/unknown dimensions, non-MS views on multisampled textures, and cube views on textures with fewer than 6 slices, while preserving valid MS views on 1x textures).MostDetailedMip,MipLevels,MipSlice), array slice ranges (FirstArraySlice,ArraySize), cube-array face ranges (First2DArrayFace,NumCubes, includingu32::MAXrequiring at least 6 remaining faces), and mip-scaled 3D UAV W-slice ranges (FirstWSlice,WSize).Nonefrommake(), allowingHostHeap::mirrorandHostHeap::make_atto install a matching typed null view vianull_for().texture_views_with_invalid_dimensions_ranges_or_mapping_fall_back_to_nullcovering 47 cases (invalid SRVs, invalid UAVs, invalid placed texture views, and valid boundary views across 1D/2D/2DArray/2DMS/2DMSArray/Cube/CubeArray/3D and planarR24G8_TYPELESS).Verification
main(63bcca43) and GREEN with the fix on hardware D3D12 (retail +--features diagnosticswithVICTORY_D3D12_DEBUG=1) and WARP (VICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1), confirmingGetDeviceRemovedReason().is_ok()and zero view-creation debug errors across all 47 cases.cargo test -p victory-gpu --libpassed in default (231 passed), hardware diagnostics+debug (244 passed), and WARP diagnostics+debug (244 passed) modes.cargo clippy --workspace --all-targets --locked -- -D warnings(default and--all-features),rustfmt --edition 2024,git diff --check, andcargo run --locked -p xtask -- policyall passed.@Dukestar69 on GitHub · 2026-11-26 12:26 UTC · original · approved these changes
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib descriptor:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released: 22/22 passed (includingtexture_views_with_invalid_dimensions_ranges_or_mapping_fall_back_to_null).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly validates texture SRV and UAV dimensions, mip/array ranges, planes, and component mappings before host descriptor creation.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 14:24 UTC · original
WARP verification of #3201 at
cef7e1c0(base63bcca4,origin/main). Software adapter only; synthetic tests only; no GPU, game files, dumps, shader names or hashes.Environment: Windows 11 Pro 10.0.26200; WARP
d3d10warp.dll10.0.26100.9818; Windows SDKdxil.dll10.0.19041.5609 onPATH; rustc 1.98.1.VICTORY_WARP=1 VICTORY_D3D12_WARP=1. A throwaway probe (reverted) asserted the adapter description is "Microsoft Basic Render Driver" before any device was created; it held in every run.Commands (exact head,
--features diagnostics, because that is where the WARP switch lives):Head: the new test
descriptor::host::tests::texture_views_with_invalid_dimensions_ranges_or_mapping_fall_back_to_nullpasses (1 passed, 0 failed). Fullvictory-gpulib: 247 passed, 0 failed, 1 ignored.Control: the same head with only the two new
texture_srv_fits/texture_uav_fitscalls inmake()removed (the PR only adds code, so that is main's behaviour plus the new test). Result: the test fails with the host device removed (DXGI_ERROR_INVALID_CALL,0x887A0001) at the first case,srv_2d_oob_mip.Test report only; no source changes. AI use: Claude Code (Claude Sonnet 5.5).
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.