GPU: mirror placed unordered texture views #1273
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!1273
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1273/head"
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-24 16:59 UTC · original
fuzeofficlal:fix/placed-texture-uav→main· +686 −26 · 4 files · 3 commits · merged 2026-11-25 21:40 UTCFixes #921
Summary
descriptor/host.rs::placed_texture()previously matched onlyView::Placed(false, ...), causing allView::Placed(true, ...)placed texture UAVs to fall back to null descriptors (silently dropping shader writes and skippingUNORDERED_ACCESSstate transitions indraw::readable()), while placed buffer UAVs (resource[0] == 1) already worked.This change mirrors placed unordered texture views and guards the newly reachable D3D12 view/format combinations:
crates/victory-gpu/src/descriptor/host.rs,draw.rs):placed_texture()to matchView::Placed(unordered, resource, desc)and emitView::Unordered(texture as usize, 0, view_desc)whenunorderedis true (View::Shaderwhen false)."placed unordered texture view not mirrored"shortcut while retaining theresource[0] != BUFFERguard inmake()whenplaced_texture()returnsNone.View::Unorderedreturned byplaced_texture(),draw::readable()automatically transitions placed texture UAVs toD3D12_RESOURCE_STATE_UNORDERED_ACCESSand subsequent placed SRV reads back toSHADER_RESOURCEwithout CPU upload clobbering (!title_written).crates/victory-gpu/src/descriptor/host.rs):supports_typed_uav(device, format)queryingD3D12_FEATURE_FORMAT_SUPPORT(D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW) and applied it infits()for bothDXGI_FORMAT_UNKNOWN(0) and concrete effective formats, preventing device removals on unsupported view formats (e.g.B8G8R8X8_TYPELESS->B8G8R8X8_UNORM(_SRGB)).fits()to rejectDEPTH_FORMATSon the requestedviewformat as well as the underlyingownresource format, and to reject(typeless && is_typeless(view)).desc.Format == DXGI_FORMAT_UNKNOWN(0) viacrate::resource::view_format(resource)inmake()forView::ShaderandView::Unorderedbeforefits(), keepingR8G8B8A8_UNORM_SRGB/B8G8R8A8_UNORM_SRGB(29/91) +ALLOW_UNORDERED_ACCESSviews working as linear UAVs (28/87).Verification
main(ffe310e): synthetic compute dispatch writing a placed texture UAV returned[0, 0, 0, 0](UNORDERED_ACCESStransition also skipped).62946e6, synthetic tests indescriptor/host.rs&draw.rscovering 16 placed UAV / 4 placed SRV descriptor cases,D3DCompilecs_5_1per-texel placed texture + placed buffer UAV readback, andUNORDERED_ACCESS->SHADER_RESOURCEstate transitions):cargo xtask policy: pass (154 files ok)cargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): 0 warningscargo test --workspace --locked(NVIDIA GeForce RTX 5090, solo): pass (victory-gpu:53 passed, 0 failed, 1 ignored; all workspace crates pass)VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked:56 passed, 0 failed, 1 ignoredVICTORY_D3D12_DEBUG=1 VICTORY_D3D12_GBV=1 cargo test -p victory-gpu --features diagnostics --locked(placed_uav&compute_dispatch_writes_placed_texture_and_buffer_uavs):2 passed+1 passedVICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked(with & withoutVICTORY_D3D12_DEBUG=1):56 passed, 0 failed, 1 ignoredmain-based checkout (upstreammaindoes not yet have an adapter-selection env var).@MichaelSmithAI on GitHub · 2026-11-24 17:14 UTC · original
Independent check on
62946e6, RTX 4090 under Wine/GE 3.2. The authored compute-write and UAV-to-SRV transition tests passed. We also ran two guest compute dispatches in one list: the first writes a 2×2 RGBA8 texture, the second reads it through a placed SRV at the same guest address with the same resource description. We kept both resources live through readback.In the second case the fixture checked that the placed SRV resolved to a different host texture from the one the first dispatch wrote. A comparison build that resolves the placed SRV to the matching live object returned [64, 0, 255, 255] in both cases. This gives the explicit-object case its own regression target. Title use and address reuse remain open.
One separate portability result: the format matrix stopped at case 7 (
B8G8R8X8_UNORM_SRGB, resource and view format 93). The mirrored slot retained a resource where the test expected none. The RGBA8 readbacks above used format 28. We did not dispatch through the format-93 view.@aycow on GitHub · 2026-11-24 17:26 UTC · original
@fuzeofficlal The original placed-Hi-Z UAV comparator independently confirmed #921 on AMD, NVIDIA and WARP. Base binds a UINT null UAV for a FLOAT write and keeps the previous Hi-Z result even after the aliased input refreshes correctly. Your exact
62946e6restores the updated Hi-Z value and reference indirect output on all three with full GPU validation. This isolates the separate placed-output defect.@Marvisak on GitHub · 2026-11-25 01:20 UTC · original · edited 2026-11-25 16:17 UTC
Automated triage for the maintainers.
Recommended for a maintainer's look (not an approval). Rebased onto current
main, it now merges cleanly.descriptor/host.rs::placed_texture()now mapsView::Placed(true, ..)texture views toView::Unorderedinstead of dropping them to null UAVs (#921),fits()rejects depth/typeless view formats and unordered views in formats the host cannot store,make()resolvesDXGI_FORMAT_UNKNOWNthroughresource::view_format, andHostHeap::mirrorre-mirrors placed slots whose memory's host texture was replaced.draw::readable()now runsalias_copyfor every SRV-kindView::Shader, not only placed ones. I checked these againstmain'sfits,view_formatandreadable. The tests include a translated guestimage_storethrough a placed UAV with host readback, which independent reports say fails onmainand passes here (hardware and WARP). CI (check): passing.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-25 05:16 UTC · original
Thanks @MichaelSmithAI for the two-dispatch empirical test and the Wine/GE report — pushed
d7ac61dcon940d32faddressing both:62946e6predated13bbd6f(one host texture per texture memory). On940d32f, bothcreate_at_addressandtexture_atresolve throughshared_texture(MEMORY). Auditing all creation-order permutations also caught two ordering edge cases when a read-only (flags = 0) view is created or mirrored before a later UAV (flags = 4) upgradesMEMORY'sHostTexture:HostHeap::mirrornow checks whetherkept[index]still points at the currenthost_copy(textureortwinplanes) and re-mirrors stale placed slots whenMEMORYupgrades the backing texture.draw::readablenow runsalias_source/alias_copyon(View::Shader(resource, _), ResourceType::Srv)beforetitle_written/upload, covering superseded explicit SRVs as well as placed SRVs.explicit_and_placed_rgba8_textures_at_one_address_share_compute_writestesting all 4 pairing/ordering cases with the two-dispatch2×2R8G8B8A8_UNORM[64, 0, 255, 255]pattern across RTX 5090, AMD Radeon Graphics, and WARP underVICTORY_D3D12_DEBUG=1.B8G8R8X8UAV capability (cases 7–10):placed_uav_textures_create_real_host_uavsnow asserts againsttyped_store(88)instead of hardcodingfalse, matching implementations likevkd3d-protonthat expose typed UAV stores onDXGI_FORMAT_B8G8R8X8_UNORM.@andrewpozdnakov7-jpg on GitHub · 2026-11-25 06:17 UTC · original
Independent WARP check of d7ac61dc73d18a46828d7f83cf16c2408e95e849 against
940d32f69b. I added the same existing guest image_store regression to both local builds. It creates the placed UAV, records and submits through VIctory, then reads back two RGBA32_FLOAT texels. Main returned two zero texels. Your updated head returned [1, 0.5, -0.25, 2] in the target and kept its neighbor zero.The full WARP GPU suite with the diagnostic fixture was 146 passed, 1 failed (that regression), 2 ignored on main and 150 passed, 0 failed, 2 ignored on your head. The four creation-order cases in explicit_and_placed_rgba8_textures_at_one_address_share_compute_writes also passed with GPU-based validation enabled.
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 06:37 UTC · original
I packaged the independent guest image_store regression as one test-only commit directly on d7ac61dc73d18a46828d7f83cf16c2408e95e849. 7d1a491
This adds guest shader translation, placed UAV creation and State::dispatch before RGBA32_FLOAT texture readback. On WARP,
940d32fleft the target texel zero. Your head wrote [1, 0.5, -0.25, 2] and kept its neighbor zero. The full GPU suite on your head plus this fixture passed 150 tests with two ignored. GPU Clippy with diagnostics and staged asset policy passed.If you take the commit, please keep andrewpozdnakov7-jpg as its author. If you fold the test into another commit, please use:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
@fuzeofficlal on GitHub · 2026-11-25 08:22 UTC · original
Thanks @andrewpozdnakov7-jpg — this is the end-to-end coverage #921 was missing: a translated guest shader writing through a placed texture UAV, read back on the host. It fails on main (the texel stays zero) and passes on this branch on hardware and WARP. Your commit 7d1a491 is on the branch unchanged with your authorship; the only follow-up (52d210c) moves the
mod placed_uav_tests;declaration next to the other pipeline submodules.