gpu: promote unsupported RT/UAV texture carrier formats and filter uncastable DXGI formats #3495
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!3495
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3495"
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?
@danielibabet on GitHub · 2026-11-27 09:56 UTC · original
danielibabet:pr/carrier-texture-format→main· +160 −4 · 1 files · 1 commits · openFixes two D3D12 texture creation failures (\
@oni-swr on GitHub · 2026-11-27 10:48 UTC · original
Independent WARP verification of #3495 (claim: #1633 comment 7216187558). No GPU used; no game files, dumps or shaders.
Setup
295dfd51c0273fa33d58251e164bbe7ae6f95f8a, basemain63bcca43c6a00a758510398fa43096ce7e4f7df0(head's diff against base touches onlycrates/victory-gpu/src/resource.rs).d3d10warp.dll10.0.26100.9818),dxil.dll10.0.19041.5609 from the Windows SDK.VICTORY_WARP=1 VICTORY_D3D12_WARP=1, separate detached worktrees for base and head, one cargo target dir.Commands
cargo test -p victory-gpu -j 4 -- --test-threads=1on base and on headcargo clippy -p victory-gpu --all-targets -j 4 -- -D warningson headResults
63bcca43295dfd51The only difference is the added
resource::tests::sharedexp_and_b4g4r4a4_rt_uav_textures_promote_to_supported_carrier(passes). The ignored test is the same on both (object::tests::benchmark_private_data_release). Clippy-D warningson head: clean.Findings (WARP only; hardware not checked)
The new test does not reach the promotion branch on WARP. WARP reports RT and typed-UAV support for formats 67 and 115 (
host_supports_textureis true for both), somake_texturedoes not promote. The creation half of the test (with thecastableasserts removed) also passes on base. Only the threecastable(..)asserts fail on base, so the test shows the filter but not the promotion. The assertFormat == 67 || castable.contains(&67)is also true for any texture that is not promoted. A test that forces the branch would help, for example by splitting the format choice into a function that takes the support query as an argument.When the carrier is promoted, the original format is not always kept in the castable list, which the code comment says it is.
castable(carrier)leaves out 68, 69 and 89 (the newUNCASTABLE), so for those source formats the carrier's list does not contain them. I forced the branch on WARP, which rejects RT for 89 and 68/69, with a 64x64 2D RT texture:takes()for the original description is false (base: texture stays 89,takestrue)takes()is false (base:takestrue)A title texture in 89/68/69 that needs RT/UAV on an adapter without it would no longer share that host texture, and its views in the original format would not match. This is probably acceptable, since such views are not creatable anyway, but the comment and test do not say so.
Not reproduced: WARP accepts 68, 69 and 89 in a castable list. On base,
CreateCommittedResource3succeeded with those formats in the list, so the claim in the new comment (D3D12 rejects them) is not visible on WARP. It may be adapter-specific, so it needs hardware to confirm.Minor: the carrier check ignores
sample_count(no MSAA-RT bit is tested), and the clear-value hint is dropped for promoted textures (fine). The castable filter checks only the dimension bit, so it does not drop formats that are valid view targets.The format-promotion rules otherwise look right: carriers come from
castable(), so they share the element size (bytes per texel and block shape). Typeless and depth formats are skipped. The RT/UAV bits are checked against the carrier. Thehost_descsRGB-UAV-to-typeless step runs before promotion.Build note: with one shared cargo target dir, two worktrees of the same workspace can reuse each other's artifacts when file mtimes are older. I touched the head sources and re-ran so the head counts are from a real rebuild.
AI use: this check was run by Claude Sonnet 5.5 (Claude Code), for oni-swr.
@AurumCarlos on GitHub · 2026-11-27 10:53 UTC · original · reviewed
Two things beyond oni-swr's points:
view_format, which is the title's format whenever the host's differs (descriptor.rs:373).set_targets(draw.rs:430) and the clear atlist.rs:1025then create an RTV in a format the host can't render to, which D3D12 does not allow. That is the very case the promotion is for on NVIDIA (#2626), so the failure only moves from the texture to its first RTV. The same applies to an RTV in 67 on a host without RT support for it.Suggested fix: leave 115 to #2626 (merge candidate: RGBA8 carrier, translated RTV and pipeline formats, repacked copies). Then refuse RTVs the host can't render, as
fitsalready does for typed UAVs (typed_store,descriptor/host.rs:1433). For example, inset_targetsbeforeself.targets.push, and the same before the clear:renderswould betyped_storetestingD3D12_FORMAT_SUPPORT1_RENDER_TARGET.host_supports_textureasks the driver again for every candidate on everymake_texture: 21CheckFeatureSupportcalls per RGBA8-family texture (its own format plus 20 castable ones).Suggested fix: drop
UNCASTABLEand thecastable_formatsfilter here, rebase on #2101, and cacheSupport1per format the same way ([AtomicU32; 192]) for the promotion check.@passerbyyhx on GitHub · 2026-11-27 19:01 UTC · original
I tested the resource and its first RTV separately on
295dfd51c0273fa33d58251e164bbe7ae6f95f8a, using synthetic 4×2 textures. On RTX 4090 Laptop (621.14), the native RT support bit was clear for both 115 and 67. With the optimized clear value the parent had no host texture in either case. The head created carriers 49 and 28. Binding a supported carrier view and clearing the background plus a subrectangle produced the expected bytes.The original guest view remains a separate issue. In four fresh processes (guest format 115 or 67, explicit or default view), the resolved RTV still used the original format. The active D3D12 debug layer rejected all four at RTV creation (message 36), before any pixel readback. On WARP the same four original views worked and returned the expected packed pixels. For this Nvidia configuration the change fixes resource creation, but a title using its original explicit or default RTV still cannot render to that resource.
Supported-view pixel fixture. GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.
@passerbyyhx on GitHub · 2026-11-27 19:14 UTC · original
Follow-up to the original RTV vs carrier comparison, on
295dfd51c0273fa33d58251e164bbe7ae6f95f8a. The original magenta/green colors had equal R and B. This time both clears have unequal R and B. Each case checks all eight raw pixels of a 4×2 texture after the GPU fence (six background pixels, two in the subrectangle). A separate CPU decoder checks their channel values.(3,6,12,15)/(12,3,6,9), little-endian bytes6c f3/36 9c. Both views matched.33 66/cc 33. This checks R/G only; this view has no blue or alpha channel.0x8880c100/0x89820020decoded to RGB(2,0.75,0.25)/(0.25,2,0.75). Both views preserved the values above 1.ff bf 40 ff/40 ff bf ff. The over-one channel saturated as expected for this view.WARP matched 56/56 pixels, including 32/32 through the four original-format views. The 4090 (driver 621.14) matched 24/24 through the two supported carrier views and the RGBA8 control. On the 4090 both original explicit/default paths again resolved to the unsupported original format; this round stopped before binding those four views, so there is no original-format Nvidia color readback. The measured bind/clear/readback paths had zero debug errors on both adapters. Each logged a separate pre-test initialization message 1419.
A pilot RGBA8 control rounded input 0.5 to 127 on this Nvidia device and 128 on WARP. The final run used 0.75 so the red/blue comparison does not depend on that midpoint.
Fixture and independent decoder. AU-20261127-08X. AI-assisted with Codex.
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.