GPU: a texture loses the unordered use its format cannot take, as its render target's #2834
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!2834
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2834"
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?
@kais7654 on GitHub · 2026-11-25 21:42 UTC · original
kais7654:gpu/formats-give-up-the-uses-the-device-refuses→main· +278 −11 · 5 files · 3 commits · openStacked on #2773. Fixes the resource side of #2725's steps 1/3 (and #2563):
host_descleft the unordered access use in even when the device refuses aresource of the format for it — the 16-bit packed ones on NVIDIA,
B5G5R5A1typed UAV and
B4G4R4A4alike (the comment said the creation refusescleanly and only the views remove the device). A probe on an NVIDIA host
proves that wrong:
CreateCommittedResourceof such a description failsE_INVALIDARGwithout any debug layer (GetResourceAllocationInforeportsSizeInBytes = UINT64_MAX) — the log'sno host texture … (0x80070057)—and under the debug layer
GetResourceAllocationInfo(id=599) is an errorof its own, so the device is removed before any view is made
(#2725's step 3, #2563's
B5G5R5A1typed UAV removal).The use is now left away like the render target's:
format_takes_unorderedasks
CheckFeatureSupportforTYPED_UNORDERED_ACCESS_VIEW(a typelessformat names no format itself and takes any use, its views do); the query
is shared with
format_takes_render_target's cache, keyed by the use.Where the use goes, the texture is made and its shader reads work; its
own-format unordered views are held back in
descriptor::host::fitsasbefore, and a view of a castable format the device does store reads null
(#2442's flag-drop) instead of the creation killing the device.
Tests (RTX 5090):
a_target_of_a_format_the_device_refuses_the_use_of_is_made_without_it:the description agrees with the device on both uses now — each stays when
CheckFeatureSupportreports the use, and goes when it does not, for86/115/87, with the typeless and sRGB promotions unchanged.
an_unordered_use_the_device_refuses_is_made_without_it: a textureof 86 and of 115 with
RENDER_TARGET | UNORDEREDis placed, made onfirst use (where today the whole creation fails), and its host flags
follow the device's;
R8G8B8A8keeps its use.cargo test -p victory-gpu --lib--test-threads=1: 196 passed, 0failed but the 2 pre-existing >1M heap-cap baselines.
cargo clippy --workspace --all-targets --locked, and with--all-features: 0 warnings, both.Generated with Mistral Vibe.
@kais7654 on GitHub · 2026-11-25 21:46 UTC · original
Rebased onto main (
61bfc77). The conflict wasdescriptor/host.rs: main's"mirror placed unordered texture views" already guards the view side —
fitskeeps an unordered view only in a format the device stores (named,cast, and the view-less default alike). Those hunks are taken from main
now, this branch's iteration-2 view guards are subsumed by them, and the
test they brought (
an_unordered_view_names_a_format_the_device_stores)is kept. What remains of this branch is the creation side:
host_descleaves the render target and unordered access uses a format cannot take
(B4G4R4A4's, B5G5R5A1's on NVIDIA — #2725, #2563) — the probed creation
fails
E_INVALIDARGeven without a debug layer, where with the strip itis made and reads work.
cargo test -p victory-gpu --lib(RTX 5090): 199 passed, 2 failed (thepre-existing >1M heap-cap baselines);
cargo clippy --workspace --all-targets --lockedand--all-features: 0 warnings, both.@fuzeofficlal on GitHub · 2026-11-25 22:47 UTC · original
Reviewed and tested
208080e5on Windows 11 (RTX 5090 + WARP) againstmain(f3578e3):cargo xtask policy(186 files ok),cargo clippy --locked -p victory-gpu --all-targets(default &--features diagnostics, 0 warnings); RTX 5090 (resource::tests19/19,descriptor::host::tests14/14,draw::tests13/13,host::tests27/27,list::tests4/4) and WARP (19/19,15/15,13/13,27/27,4/4) all passed.#2462's view-sidefits()by stripping unsupportedUNORDEREDat creation time), but two edge cases need fixes:clear_valueinmake_texture: whenhost_descstripsRENDER_TARGETfor an unsupported format (andDEPTH == 0),make_texturestill forwards a non-nullclear_valuetoCreateCommittedResource/CreateCommittedResource3, which D3D12 rejects withE_INVALIDARGwhen neitherALLOW_RENDER_TARGETnorALLOW_DEPTH_STENCILis set.shared_texturere-adds strippedUNORDEREDfrom siblings (resource.rs:1309-1317):shared_texturerunshost_descfirst and then mergesd.flags |= host_desc(&r.desc).map_or(0, |h| h.flags & USES)across same-MemoryKeysiblings. If the first texture is an unsupported-UAV format (e.g.B5G5R5A1_UNORM86, 2 B/px) and a sibling at the same memory has a same-bpp UAV-capable format (e.g.R8G8_UNORM61 +UNORDERED),UNORDEREDgets OR'd back onto format 86 and passed tomake_texture->E_INVALIDARG. Re-checking UAV support (while still allowing castable-list aliasing like format67+ castableR32_UINT42) closes this gap.@futurepro62 on GitHub · 2026-11-25 23:21 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
208080e(on its base61bfc77).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 789 passed, 0 failed, 10 ignored.an_unordered_view_names_a_format_the_device_stores,a_target_of_a_format_the_device_refuses_the_use_of_is_made_without_it,an_unordered_use_the_device_refuses_is_made_without_it.--skipleaves out tests that fail on main842b0cbon this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@Marvisak on GitHub · 2026-11-26 03:25 UTC · original
Automated triage for the maintainers.
Verdict: needs work. This PR is stacked on #2773, so it carries that PR's commits. On top of them,
resource::host_descdropsUNORDERED(and the render target) whenCheckFeatureSupportdoes not report the use (format_takes_unordered). CI passes, and the RTX 5070 Ti and 5090 runs are useful. Before it can be a merge candidate:make_texturestill passes the title's clear value whenhost_deschas removed the render-target use from a colour texture. D3D12 refuses an optimized clear value withoutALLOW_RENDER_TARGET/ALLOW_DEPTH_STENCIL, so creation still fails (point 1 from @fuzeofficlal).shared_textureORshost_desc(&r.desc).flags & USESfrom same-memory siblings back intod.flagsafter the strip, which can putUNORDEREDback on format 86 or 115. The format check needs to run again after that merge.format_takesstill cachestruewhenhost()is not available yet (!reported). The #2773 review asked for this to change; an answer the query did not give should not be recorded.The larger question is direction. #2626 (merge candidate) makes these same textures R8G8B8A8_UNORM so draws and clears to them still work, while this PR drops the uses. Please say whether this is meant as a fallback alongside #2626 or instead of it. Landing #2773 first would also shrink this diff to its own change.
CI: passing (
check).Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 21:49 UTC · original · reviewed
Heads-up on overlap: this is the same
host_descchange as #2442 (mine, stacked differently — #2442 is on main, CI-green, and has already been through two maintainer-review rounds on exactly this logic). Worth a look at that history before this lands:format_takes_unordered(format)here checks only the bare format. A title texture created typeless can still get a legal UAV view — the castable-formats list passed atCreateCommittedResource3includes family members that DO store typed. On fyernald's Win10/RTX 3080 (noID3D12Device10), checking only the bare format stripsALLOW_UNORDERED_ACCESSfrom the sRGB formats (29, 91) even though family member 28 stores typed and the texture's UAV view is legal — the exact regression #2442's first revision had. #2442's current version keeps the flag when a typeless family member can store typed, and drops it for standalone formats like 85/86 (no typeless base, so no legal cast path even where Device10 exists).Also note
GetResourceAllocationInfosees only the bare desc — the cast list isn't visible there — so for a standalone UAV-flagged format the flag is still lethal regardless of Device10, which is what makes the typeless gate necessary rather than merely a probe.The RTV/DSV
Optionguard on top is complementary and good — it's the view-side counterpart #2773 started.@zed6000 on GitHub · 2026-11-26 13:01 UTC · original
Merged onto current
main63bcca4(git merges it without a conflict),victory-gpu's tests don't compile:E0308 mismatched types. This PR makesHost::dsvandHost::rtvreturnOption<D3D12_CPU_DESCRIPTOR_HANDLE>, and two tests that landed onmainsince use the old form:crates/victory-gpu/src/pipeline/depth_bounds_test.rs(from #158):let dsv = host.dsv(&depth, None);crates/victory-gpu/src/queue.rs, a test'sClearRenderTargetView(host.rtv(&primary.texture, None), …)With
.expect("a depth buffer takes a depth view")and.expect("a render target takes a target view")on those two calls, it compiles, andcargo test -p victory-gpu --lib --locked -- --test-threads=1passes on an RX 7900 XTX (234 passed, 0 failed). Tested as part of a run of the GPU tests of open PRs on AMD hardware.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.