GPU: make shared sRGB textures typeless for unordered access #2679
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!2679
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2679"
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 18:01 UTC · original
fuzeofficlal:fix/gpu-shared-texture-srgb-uav→main· +189 −3 · 2 files · 1 commits · openSummary
typeless_if_unordered_srgbincrates/victory-gpu/src/resource.rsand call it again inshared_textureafter merging siblingUSESflags fromTEXTURES_AT, so an sRGB render target sharing memory with an unordered-access texture is promoted to its typeless family beforemake_texture.typed_storevalidation incrates/victory-gpu/src/descriptor/host.rs::fitsto cover default (view == 0) and same-family unordered views in addition to cross-family casts (pairing with #2462 so promotingB8G8R8X8_UNORM_SRGB->B8G8R8X8_TYPELESSnever lets an unsupportedB8G8R8X8_UNORMUAV reachCreateUnorderedAccessViewif this PR lands ahead of #2462).resource::tests::shared_srgb_render_targets_with_unordered_access_are_typeless(covering RGBA8, BGRA8, and BGRX8 shared RT + UAV creation, verifying RGBA8/BGRA8 UAVs succeed, unsupported BGRX8 linear/sRGB UAVs stay null without device removal, and castableR32_UINTUAVs still succeed) anddescriptor::host::tests::unsupported_same_family_and_default_uavs_are_refused.Verification
cargo clippy --locked -p victory-gpu --all-targets -- -D warningsand--features diagnostics: 0 warnings.rustc 1.98.1MSVC):shared_srgb_render_targets_with_unordered_access_are_typelessandunsupported_same_family_and_default_uavs_are_refusedpass (GetDeviceRemovedReason() == S_OK).VICTORY_D3D12_WARP=1):cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1-> 200 passed, 0 failed, 1 ignored.cargo xtask policy: 184 files ok.@DrDarkDK on GitHub · 2026-11-25 18:12 UTC · original
The BGRX family still needs a UAV capability check after typeless promotion. I ran a standalone D3D12 probe on an RTX 4070 Ti (driver 621.01, Windows 11 build 26300), using 64×64 textures with both render-target and unordered-access flags.
R8G8B8A8_TYPELESSS_OKB8G8R8A8_TYPELESSS_OKB8G8R8X8_TYPELESSS_OKThe same-family view path bypasses
typed_store, so successful BGRX resource creation can still lead to an unsupportedB8G8R8X8_UNORMUAV. Could we pair this with the check in #2462 and test that the unsupported view stays null?The probe checked resource creation and reported format support. I didn’t create the unsupported view or run VIctory.
AI-assisted with Codex.
@fuzeofficlal on GitHub · 2026-11-25 18:29 UTC · original
Thanks for the hardware probe and catch, @DrDarkDK! You're completely right — without the same-family
typed_storecheck from #2462, promoting a sharedB8G8R8X8_UNORM_SRGB+UNORDEREDtexture toB8G8R8X8_TYPELESSwould allow resource creation to succeed and then pass an unsupportedB8G8R8X8_UNORMUAV toCreateUnorderedAccessViewif this PR merged ahead of #2462.Updated in
b5c7f9d:descriptor::host::fitssotyped_storechecks the effective view format for default (view == 0), same-family, and castable unordered views alike (matching #2462's safeguard so this PR is safe standalone; happy to rebase cleanly if #2462 lands first).resource::tests::shared_srgb_render_targets_with_unordered_access_are_typelessto cover all threeSRGBfamilies (RGBA8,BGRA8, andBGRX8), creating actual UAV descriptors viaHostHeap::make_atand asserting that:R8G8B8A8_UNORM/B8G8R8A8_UNORMUAVs succeed,B8G8R8X8_UNORM(andB8G8R8X8_UNORM_SRGBrewritten to linear) UAVs stay null withGetDeviceRemovedReason() == S_OK,R32_UINTUAVs on the promotedB8G8R8X8_TYPELESStexture still succeed.descriptor::host::tests::unsupported_same_family_and_default_uavs_are_refusedcoveringfitsdirectly for typeless same-family and typed default/same-family unsupported UAVs.Re-verified on NVIDIA GeForce RTX 5090 (both new tests pass,
B8G8R8X8_UNORMtyped UAV confirmed unsupported and kept null) and WARP (200 passed, 0 failed, 1 ignored,clippy0 warnings,xtask policyok).@kotekompotek on GitHub · 2026-11-25 18:37 UTC · original
Correct on both sides: the shared-texture merge now re-runs the sRGB->typeless promotion after sibling USES flags are merged (the case host_desc can't see alone), and fits() covers the two holes the promotion opens - a default view (view==0) on a typed texture, and a same-family view on a typeless one - both checking typed_store on the effective format. The test matrix (RGBA8/BGRA8 succeed, BGRX8 refused without device removal, R32_UINT cast still works) covers exactly the promotion's edge cases.
@Marvisak on GitHub · 2026-11-25 22:16 UTC · original · edited 2026-11-26 03:22 UTC
Automated triage for the maintainers.
Verdict: merge candidate. I reviewed the rebased head
e59bde5. The functional change is one call:shared_texture(crates/victory-gpu/src/resource.rs) runs the sRGB-to-typeless promotion (nowtypeless_if_unordered_srgb) again after merging siblingUSESflags. Before, an sRGB render target that shared memory with an unordered-access texture was created as a typed sRGB resource with UAV access, which the host does not support. The view-side guard the description talks about (fitscheckingtyped_storefor default and same-family views) is already onmainvia #2462, so thedescriptor/host.rshunk here is now a test of that code only.Small point:
unsupported_same_family_and_default_uavs_are_refusedasserts!typed_store(B8G8R8X8_UNORM)outright. The other test checks support at runtime, and this one should too, in case some adapter reports support.CI:
checkpassing.Generated by 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.