GPU: validate ResolveSubresource sample counts, dimensions, and subresource bounds #3193
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!3193
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3193"
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 11:48 UTC · original
fuzeofficlal:fix/gpu-resolve-subresource-validation→main· +164 −7 · 1 files · 1 commits · openProblem
list::resolveincrates/victory-gpu/src/list.rspreviously emittedensure_state, markedtexture::host_writes(list, dst), and recordedID3D12GraphicsCommandList::ResolveSubresource/ResolveSubresourceRegionwithout validating D3D12's resolve contract:SampleDesc.Count < 2), a multisampled destination (SampleDesc.Count != 1), a non-2D texture (such asTEXTURE3D), or an out-of-boundsdst_sub/src_subcausesID3D12GraphicsCommandList::Close()to fail withE_INVALIDARG(0x80070057) even on retail D3D12 (without the Debug Layer) on both hardware and WARP, which abortsHostList::close().(a.Width, a.Height)instead of the resolved subresource's mip dimensions produced wrong size comparisons and clip rectangles when resolving into non-zero destination mip levels.Fix
texture_subresourcesusingID3D12Device::CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, ...)to determine each format's exact D3D12PlaneCount(preserving valid multi-plane depth/stencil resolves) and total subresource countMipLevels * DepthOrArraySize * PlaneCount.ensure_stateortexture::host_writes, verify both textures areD3D12_RESOURCE_DIMENSION_TEXTURE2D,dst.SampleDesc.Count == 1,src.SampleDesc.Count >= 2, and both subresource indices are in bounds; ignore invalid resolves cleanly.(dst_w, dst_h)and(src_w, src_h)at each subresource's mip level (sub % MipLevels) when deciding betweenResolveSubresourceandResolveSubresourceRegionand when building the clipRECT.Verification
Added
list::tests::resolve_validates_sample_counts_dimensions_and_subresourcescovering 5 invalid cases (non_msaa_src,msaa_dst,oob_dst_sub,oob_src_sub,tex3d_dst) and 4 valid resolves (exact match, clipped larger source, multi-mip exact match, multi-mip clipped):origin/main): failslist.Close()withHRESULT(0x80070057)(E_INVALIDARG) on retail RTX 5090 (no Debug Layer), Debug RTX 5090, and Debug WARP.--features diagnostics+VICTORY_D3D12_DEBUG=1, and WARP--features diagnostics+VICTORY_D3D12_DEBUG=1withhost.log_messages() == None.cargo test -p victory-gpu --lib --lockedpasses on hardware default (230 passed), hardwarediagnostics + DEBUG=1(244 passed), and WARPdiagnostics + DEBUG=1(246 passed).cargo clippy --workspace --all-targets --locked -- -D warnings(default and--all-features) andxtaskpolicy checks pass cleanly.@Dukestar69 on GitHub · 2026-11-26 12:07 UTC · original · approved these changes
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib list:: -- --test-threads=1: 5/5 passed (includingresolve_validates_sample_counts_dimensions_and_subresources).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly validates
ResolveSubresourcesample counts, dimensions, and subresource bounds.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 #3193 at
ec7f2edb(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
list::tests::resolve_validates_sample_counts_dimensions_and_subresourcespasses (1 passed, 0 failed). Fullvictory-gpulib: 247 passed, 0 failed, 1 ignored.Control:
origin/main'slist.rswith only this PR's test module appended. Result: the test fails withlist.Close()E_INVALIDARG(0x80070057) at the first invalid case,non_msaa_src.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.