GPU: packed 16-bit colour targets the host cannot write are RGBA8 there #2626
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!2626
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2626"
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?
@moe-miau on GitHub · 2026-11-25 17:07 UTC · original
moe-miau:port/fmt→main· +494 −42 · 9 files · 2 commits · openProblem
B5G5R5A1_UNORM(86) andB4G4R4A4_UNORM(115) have no typed unordered access on NVIDIA, andB4G4R4A4is not a render-target format there.maindrops the texture the host refuses, and the next submission removes the device. This is the crash of #1952, #1781 and #2024 (RTX 3060, 3070, 4090).On an RTX 4070 SUPER,
main67e8ae1+ #1906 + #2098 dies 30 s after start with0x887A0004, 0.2 s after:Change
When the device lacks render-target or typed-UAV support for one of these two formats (
CheckFeatureSupport), their writable textures are made asR8G8B8A8_UNORM, and their views and pipeline render-target formats follow.texture::expand_row/pack_row).Ported from Zettrox/ztrx (commit
578d459), which is based on fxceless/victory-fork. Both are GPL-3.0-or-later. Compared with the fork, this adds the texel conversion on upload and readback, and per-format keys.Tested
RTX 4070 SUPER, driver 32.0.16.1742, Windows 11 26300. Title 1.0.2.1, Series X profile, diag build. Scripted Enter presses reach the intro cutscene; 6-minute runs.
67e8ae1+ #1906 + #20980x887A0004) after the format-115 target is refusedWith the fixes from review folded in (head
d1dc7ad), a second 6-minute run: no device removal,no host texture0 (the base had 1, the format-115 target), 141 compute pipelines refused (theWaveSize(64)programs #189 is about). The world stays black at about 8 s a frame on this stack because it leaves out #2178 (structured views as raw), which no longer merges withmain.cargo test -p victory-gpu --locked: 197 passed. 2 failed:dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, the same asmainon this card. New tests cover the format decision and the texel conversion of both formats, in both directions, including alpha.cargo clippy --workspace --all-targets --locked -- -D warnings, also with--all-features: clean.cargo xtask policy: ok.AI-assisted (Claude Code, with a review pass by Codex). Runs done on my machine.
🤖 Generated with Claude Code
@moe-miau on GitHub · 2026-11-25 17:15 UTC · original
Related: #2462 (no typed UAV in a format the host cannot store to). The two cover different cases and don't conflict:
B5G5R5A1no longer removes the device. The texture stays in the packed format and those writes are dropped.R8G8B8A8_UNORMwhen the host can't render or store to the packed format. That also covers the case #2462 doesn't reach: the 2560x1440B4G4R4A4(115) render target that NVIDIA refuses to create at all (no host texture ... format: 115), which is what removed the device here 30 s in. The title's writes to it are kept.With this PR applied, #2462's check no longer fires for these two formats on NVIDIA, because the textures and their views are RGBA8.
@kotekompotek on GitHub · 2026-11-25 17:49 UTC · original
Reviewed: the three pieces fit together — (1)
seen()now also treats aView::Unorderedon a packed texture (or any written shader view) as a texture needing copy-back, (2)fits()short-circuits whentarget_format(view) == ownso the RGBA8 host stand-in passes family checks, (3) copies guard withincompatible_copy/host_footprintso packed≠unpacked copies don't blit garbage. Moving the typed-UAV probe into sharedresource::format_supportalso converges with what #2442/#2462 did elsewhere — good dedup. CI green.@Machad3x on GitHub · 2026-11-25 18:26 UTC · original
Setup: RTX 3080 Ti (driver 621.24), Windows 11, a local stack of open PRs merged with main
67e8ae1.Tested on an RTX 3080 Ti (driver 621.24, Windows 11). Format support reported:
no render target for B4G4R4A4_UNORM (115), and no typed UAV store for it or for
B5G5R5A1_UNORM (86), so both take the RGBA8 path as intended.
It conflicts with a tree that carries #2332: the 115 to 86 mapping in
pc_formathas to go (and its test), or the targets never reach the RGBA8 path.With that, one 10-minute game run (together with #2601, #2598, #2576, #2611)
had no device removal.
Written with Claude Code; tested locally.
@moe-miau on GitHub · 2026-11-25 19:04 UTC · original
Thanks @Machad3x. Right: #2332 and this PR are alternatives for the format-115 target. #2332 remaps 115 to
B5G5R5A1(86) inpc_format, which still has no typed UAV store on NVIDIA. This PR keeps the guest format and makes the host texture RGBA8 wherever the device lacks render-target or typed-UAV support for 86 or 115, with texel conversion on upload and readback. If this one lands, #2332's 115-to-86 mapping (and its test) should go, as you found. Otherwise, a 115 target never reaches the RGBA8 path.@KainanP on GitHub · 2026-11-25 19:36 UTC · original
RTX 4060 Laptop (610.47), merged onto main
13f91cae: both halves fixed (R8G8B8A8 host textures; the UAVs and the RTV are real views), on Intel UHD too, and a no-op on WARP; no new failures incargo test -p victory-gpuon any of the three. This is the only one of the #1753 PRs that does this. Details and the side-by-side table with the other #1753 PRs: #1753. Tested with the help of an AI assistant (Claude Code).@regiumlepidi on GitHub · 2026-11-25 21:37 UTC · original
Run report: RTX 5070 Ti (16 GB, driver 617.42), Windows 11 26300, Ryzen 7 9800X3D. Retail Series 1.0.2.1. Release builds, default switches, full
translate --cache --pipelinesbeforehand (27,160 pipelines: 23,127 made, 3,609 found in the library).main13f91cano host texture error=0x80070057 desc=ResourceDesc { dimension: 3, width: 2560, height: 1440, ..., format: 115, flags: 1 }→0x887A0001main13f91ca+ #2626 (d1dc7ad) + #1763 (73a602b)no host textureline and no0x887A0001. Menus ran for ~2 min at 30 fps (frame 2048, 12,937 draws / 1,026 dispatches in the last log interval)So on this card #2626 removes the B4G4R4A4 start-up crash.
Merge note: #1763 conflicts with #2626 in
fits()(descriptor/host.rs). On top of #2626,typed_storeno longer exists. I resolved it with #1763'stargetlogic and atyped_store(format)that wrapscrate::resource::format_support(format).contains(D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW).cargo test -p victory-gpu --lib -- --test-threads=1gives the same 2 failures with and without the two PRs on this card (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views;frame::waits_end_on_ticks_and_count_framesfails only when run in parallel). So the merge adds no regressions.The run with the fixes then ended on a different failure:
0x887A0006(hung) after a 4,820 ms submission of 25 lists, 135 distinct compute pipelines refused with0x80070057before it (wave64 compute on a 32-lane host, cf. #2688 / #1216). I'll report that separately once I have a diagnostics run.AI use: run, merge and report by Claude Code (Claude Opus 5.5) on the reporter's machine.
@Marvisak on GitHub · 2026-11-25 22:15 UTC · original · edited 2026-11-26 03:24 UTC
Automated triage for the maintainers.
Verdict: merge candidate. Thanks for the rebase, and to @steven-seagull27 for the readback tests. At
c8cc83e,resource::target_formatmakes writable B5G5R5A1 (86) and B4G4R4A4 (115) textures R8G8B8A8_UNORM whenCheckFeatureSupportreports no render-target or no typed-UAV support. The format is applied inhost_desc,shared_texture, clear values,RtvRecord, pipeline RT formats anddescriptor::host::fits.This PR also handles the copy paths that held back #2767:
list.rsread_backrepacks throughtexture::pack_rowwith a doubled footprint (host_footprint).expand_row.Stagingdetile expands the texels.alias_copy,copy_resourceandresolveskip mixed layouts behind a one-timeshortcutwarning.The conversions round-trip all 65,536 words in
packed_colors_round_trip_with_their_alpha, and devices that support the formats are unchanged. The evidence is hardware runs on an RTX 3070 and an RTX 4070 SUPER, plus a WARP and RTX 5080 run of the new tests.For the maintainers: this overlaps #89, #2767 and #2936, which widen the same formats, and #2773, which drops the refused uses instead. Only one direction should land.
CI: passing (
check). Merges cleanly.Generated by Claude Code
@steven-seagull27 on GitHub · 2026-11-26 01:34 UTC · original · edited 2026-11-26 01:37 UTC
@moe-miau I rebased your commit onto upstream
63bcca43for the conflict reported by triage. The conflict was between adjacent tests inresource.rs. Both sides' tests are present, andgit range-diffshows only the change in surrounding context. Your commit keeps its original author. Rebased commitI also put two optional GPU readback tests in a separate commit. They upload a 7×4 packed texture from a padded guest buffer, clear one texel to transparent red, then copy a 4×3 rectangle back to an offset inside a different footprint. They check all 4,096 bytes, including untouched texels and row padding. The clear has an independent expected guest value,
0x0f00for B4G4R4A4 and0x7c00for B5G5R5A1. Regression testsBoth adapters ran with the D3D12 debug layer. The all-feature GPU library suite, excluding the new tests and one presentation test that terminated the process on both revisions, went from 243 to 247 passes on RTX and 245 to 249 passes on WARP. The same two existing descriptor/memory tests failed on RTX on both revisions. Strict GPU Clippy and the asset-policy check passed.
To try the tested combination on a fresh local branch:
The branch
codex/pr2626-packed-forwardcontains just your rebased change. This was a synthetic D3D12 check. The in-game evidence remains the runs already posted above.AI-assisted with Codex.
@moe-miau on GitHub · 2026-11-26 01:50 UTC · original
@steven-seagull27 Thanks, taken as is:
6796b74(rebased onto63bcca4) and your testsc8cc83e, now the head of this PR. On an RTX 4070 SUPER:cargo test -p victory-gpu --all-features --lib packed_copy_tests2 passed;cargo test -p victory-gpu --lib235 passed, 2 failed (the two heap-cap tests #2628 fixes, failing onmainhere too); strict clippy and the asset policy clean.@walterwallaceson on GitHub · 2026-11-26 03:02 UTC · original
RTX 3070 on Windows 10,
main63bcca4+ #463: the fix holds onc8cc83e. The format 115 target (2560x1440) is created, and theno host texturerefusal is gone. On this card the refusal never removed the device, so without the PR nothing crashes, and the target is simply missing.Setup: RTX 3070 8 GB, driver 621.14, Windows 10 22H2 (19045).
main63bcca4+ #463 (Agility SDK runtime, needed on Windows 10), then + this PR atc8cc83e(a clean merge). Diag build, scripted Enter at 17, 30 and 60 s, nothing skipped, 15-minute runs, one run each.main+ #463no host texture ... format: 115(2560x1440)A correction to what I saw earlier: in one earlier run without the PR the title stayed on its first screen, but that was a missed key press, not this bug. With the extra presses, both builds reach the world. The speed and copy differences come from one run each, so I wouldn't read much into them yet.
Not tested: a second run of each; whether the picture differs. The recordings are mostly dark on this setup either way.
No game data attached. I'm testing with Claude's help, and Claude drafted this comment.
@TheGrayOrange on GitHub · 2026-11-26 04:46 UTC · original
Tested
c8cc83eon RTX 4070 Ti SUPER, driver 621.24, with D3D12 validation enabled.Both existing
packed_copy_testspassed. Confirmed formats 115 and 86 used RGBA8 backing, with exact packed readback across all 4,096 guest bytes per test, including untouched padding. Zero D3D12 validation errors.@evan-kolberg on GitHub · 2026-11-26 08:55 UTC · original
An Apple GPU result for
c8cc83e. I adapted the production patch and the two existingpacked_copy_teststo VIctory-macOS08f76efand ran them on an M4 Pro with CrossOver 26.3.0.39832 and D3DMetal 4.0 beta 3. The guest process mapped that D3DMetal build.Support1=0x1e4d3fffor 86 and0x3ecd3fffor the selected format 28.0x7c00. All 16 in the inferred view returned0x83ff. The padded 2,048-byte buffer matched exactly.This covers the widened typed shader write as well as the existing transfer regression on a separate backend. All three test invocations used generated inputs. An in-game comparison of the patched runner is still pending. Tested and summarized with Codex.
@Dukestar69 on GitHub · 2026-11-26 05:09 UTC · original · approved these changes
Tested merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):cargo test -p victory-gpu --lib list::packed_copy_tests: 2 passed, 0 failed on RTX 5090 hardware (b5g5r5a1_partial_copy_preserves_guest_texels_and_paddingandb4g4r4a4_partial_copy_preserves_guest_texels_and_padding).VICTORY_WARP=1 cargo test -p victory-gpu --lib list::packed_copy_tests: 2 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@loren2000vlort-cmd on GitHub · 2026-11-26 10:55 UTC · original
Independent test report: RTX 3060 (Ampere, GA106), unit tests only, no game files.
The #1952 reporter has the same card model. Nothing below was run in the title.
Setup
cargo +stable, which is the pinned 1.98.1), MSVC, Windows SDK 10.0.26100.0.c8cc83e, and upstreammainat63bcca4(this PR's base) as the control. Each was in its own worktree.1. This PR's six tests (
c8cc83e)CPU only:
WARP:
Real RTX 3060:
list::packed_copy_tests::b4g4r4a4_partial_copy_preserves_guest_texels_and_paddinglist::packed_copy_tests::b5g5r5a1_partial_copy_preserves_guest_texels_and_paddingresource::tests::packed_textures_keep_the_guest_layout_until_writableresource::tests::packed_targets_require_both_writable_usesresource::tests::only_expanded_packed_texels_use_the_stand_intexture::tests::packed_colors_round_trip_with_their_alphapacked_filter also matchedcapture::tests::packed_float_classifies_special_and_finite_values, which is already onmain. That is the seventh test.--nocapture, no "skipping … (no D3D12 device)" line was printed, so the device-dependent tests did run.2. Regression check: full
victory-gpulibrary suite on the RTX 3060cargo +stable test -p victory-gpu --lib --locked -j 6 -- --test-threads=1, the same command on both trees:main63bcca4c8cc83eobject::tests::benchmark_private_data_releaseon both sides (#[ignore]).descriptor::host::tests::dynamic_slots_are_held_until_released:assertion failed: heap.heap.GetDesc().NumDescriptors >= victory_shader::emit::HEAP_VIEWS. The assertion is atdescriptor/host.rs:2226onmainand:2210here, because this PR removes lines above it in that file.memory::tests::lists_share_a_table_and_copies_keep_their_views:past the dynamic slots(memory.rs:1030on both).git diff 63bcca4 c8cc83edoes not touchmemory.rs,HostHeap::new, the dynamic-slot sizing, or these two tests. They are the capped-view-heap failures already reported on other NVIDIA cards (#1744, #747), not caused by this PR.nvlddmkm,Display,dxgkrnlor TDR events during the runs.Not measured
CheckFeatureSupportflags for formats 86 and 115 on this GPU. The tests do not print them.b4g4r4a4_partial_copy_…only asserts that the format the host ends up using supports both render-target and typed-UAV access, and that check passed.HEAP_VIEWS.AI-assisted (Claude Code). The runs are mine, on my machine.
@fuzeofficlal on GitHub · 2026-11-26 11:15 UTC · original · approved these changes
Reviewed the packed 16-bit writable colour target fallback across resource creation, footprints, staging/copy paths, views, and pipeline state at
c8cc83e2.packed_target_formatonly substitutesRGBA8_UNORMforB5G5R5A1_UNORM(86) andB4G4R4A4_UNORM(115) when the texture is writable (TARGET | UNORDERED) and the host lacks eitherRENDER_TARGETorTYPED_UNORDERED_ACCESS_VIEW, keeping read-only packed textures in their guest layout.list.rsmaterializehost_resource(...)before queryingpacked_format(...), andhost_footprint/ region copy scaling (at * 2,n * 2, doubled 256-byte-aligned row pitch) stay consistent with the expanded 4-byte texels.expand_row/pack_rowpreserve channel order and alpha rounding across all 65,536u16values,Staging::detilehandles the final unpadded row safely,Staging::maybe_changedavoids clobbering GPU-written stand-ins, andRtvRecord,fits,view_format, clear values,memory_key, andGraphicsStateall match the stand-in format.Verified locally on Windows 11 with both RTX 5090 and WARP (
VICTORY_D3D12_WARP=1+--features diagnostics) underVICTORY_D3D12_DEBUG=1:cargo xtask policy(192 files ok) andcargo clippy -p victory-gpu --tests -- -D warnings(default and--all-features): clean.list::packed_copy_tests2/2,texture::3/3,resource::21/21,draw::tests::20/20,descriptor::21/21 passed with no Debug Layer warnings.list::packed_copy_tests2/2,texture::3/3,resource::21/21,draw::tests::20/20 passed.@ChenmouXu on GitHub · 2026-11-26 12:57 UTC · original
A stacked branch for 50-series:
main+ #2626 + #1763 + #2178 + #2098The two 50-series recipes in this thread now differ by exactly one PR, and it is the one about the picture rather than the crash:
13f91ca + #2626 + #1763 + #1906 + #2098-- 3.5 min into the intro cutscene, no removal.main + #1763 + #2178, program A of #1968 skipped -- the targets move but the presented image does not (depth dumps differ by 57.9 between frames while the 2560x1440 lit target, the TAA output and the presented image differ by 10.8).So the first set gets you in, and #2178 is what makes the picture actually follow. #2178's own description is the reason: on NVIDIA,
rawBufferLoadagainst aStructuredBufferdescriptor multiplies the byte offset byStructureByteStrideand returns zeros pastwidth / stride. Zeros from a buffer read is exactly what a black or frozen frame looks like from the outside, and it would explain both reports above.#1906 is merged now, so the set is #2626 + #1763 + #2178 + #2098 on current main. Three of the four are small (#1763, #2098 one file each; #2178 six files); #2626 is the nine-file one.
Would someone with all four in front of them push one branch?
moe-miauhas #2626 and #2098,n-romanovichhas #2178, and both branches are based on main, so a linear stack should not need code decisions from me -- just order and a rebase.I will run it here on an RTX 5070 Ti Laptop (Blackwell, driver 32.0.16.1074): diag build, DRED on, full debug-layer log, and I will report frame times plus a per-frame luminance series, because the failure on this card is not only the removal but a picture that alternates black and drawn for seconds at a time. A branch name in this thread is enough.
@ChenmouXu on GitHub · 2026-11-26 14:34 UTC · original
On current main (
63bcca4) this looks like the single remaining blocker for a visible pictureMachine: RTX 5070 Ti Laptop (Blackwell, driver 32.0.16.1074), Ryzen 9 9955HX, 32 GB, Windows 11 26200. Title 1.0.2.1, Series X profile. Release build, no patches applied by hand -- the first time that is true here.
What main does now, after #2462 + #2286 + #1906:
VICTORY_KEYSneeded to get in.The log has exactly one relevant line:
So the
B4G4R4A4_UNORM2560x1440 render target is still refused, and as potatoe0100 said it is no longer fatal -- but nothing is drawn into it, so the world's output is black while 2,610 draws are submitted. That matches the geometry #841 describes from the other direction (targets that move, presented image that does not).The view heap is still capped too (
host view heap capped at 1000000 ... count=1245184), and that is not fatal either.So #2626 looks like the one that turns this from "runs, black" into "runs, visible" here: an RGBA8 stand-in for the packed target is enough for a 2560x1440 surface that is only ever rendered into and then scaled.
If there is a branch with #2626 on current main, I will run it now: diag build available, DRED on, and I can report frame times, a capture of the presented image, and whether the black frame count changes.
@ChenmouXu on GitHub · 2026-11-26 16:17 UTC · original
This one is clean and green -- is it held for a reason, or just not scheduled?
mergeable: true,mergeable_state: clean, CIsuccessonc8cc83e, nine files. No conflicts with63bcca4.On current main (
63bcca4), an RTX 5070 Ti runs the title to the world with no device removal and no flicker, 2,610 draws/frame, and the picture is pure black. The only relevant line in the log is the 2560x1440B4G4R4A4_UNORMtarget being refused. As much as anything, this PR is the difference between "runs, black" and "runs, visible" on 50-series -- the rest of the chain already merged.Happy to run it as soon as it is in
main.@andrewpozdnakov7-jpg on GitHub · 2026-11-26 17:42 UTC · original
I extended the existing partial copy and clear test to mip 1 of a synthetic 14×8 texture. It uploads the 7×4 mip, clears one texel through an RTV for mip 1, then reads a cropped region into an offset guest footprint. All 4,096 bytes matched for each of B5G5R5A1 and B4G4R4A4, including the surrounding padding. Test commit on
c8cc83eApp-local WARP 1.0.22 / Agility 1.620.2 supports both packed formats directly. The same mip-1 test passed on
63bcca4and on this branch with those capabilities. I used a temporary test-only format-support override to exercise the fallback: D3D12 created RGBA8 backing for both formats, and the four mip-0/mip-1 cases still matched every byte. The branch contains the mip test extension.All eight packed tests and the full native-capability GPU suite passed (253 passed, 1 ignored). Both Clippy configurations and the asset policy passed. If taking the test, please retain its Git author or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>when folding it into another commit. AI-assisted with Codex.@andrewpozdnakov7-jpg on GitHub · 2026-11-26 20:07 UTC · original
I checked this head with #3340’s target-format variants in
5581f9f. Its keys use the formats actually passed to D3D12. The new CPU regression compares the translated graphics-stream key and the key from the recorded RTV. They agree for formats 86 and 115 both with native support and in a synthetic capability configuration where both use RGBA8 (28). Details and the standalone fix are on #3340.If the two PRs land separately, this is a tested reference for the key handling in the second. Please preserve the Git author or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if you fold the test or resolution into another commit.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.