Add Xbox texture layouts for formats 189–190 #7
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!7
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-7"
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?
@Lkxex on GitHub · 2026-11-25 11:25 UTC · original
Lkxex:fix/console-texture-layouts→main· +23 −2 · 1 files · 3 commits · openChange
Support Xbox texture formats 189 and 190 in
victory_formats::texture::formatsoTexture::newcan compute their layouts. Format 189 uses four bytes per texel, and format 190 uses one byte per texel.Format 191 was removed from this PR after @adrianmjim's Windows/RX 7900 XT review confirmed the host creates format 191 as
DXGI_FORMAT_A4B4G4R4_UNORM(2 bytes per texel) with no host remap inpc_format(), so keeping 191 at 4 bytes caused a host/console layout mismatch.The regression test compares mipmapped array textures in formats 189 and 190 with reference formats of the same texel size, using both linear and 64 KiB swizzled layouts.
Validation
cargo test --locked -p victory-formats --lib(25 passed, 0 failed)cargo check --workspace --all-targets --lockedgit diff --checkValidation used synthetic texture descriptions. In-game rendering and frame rate were not measured. This backport was prepared with AI assistance.
Backported from VItoriaBr #11, with the original commit authors preserved.
@Ekabusto on GitHub · 2026-11-25 12:47 UTC · original
Checked locally:
cargo test -p victory-formats --libpasses (25 passed, 4 ignored), clippy clean, no conflicts.The sizes agree with the GPU side's own table,
victory-gpu/src/resource.rs:118-128(189 and 191 at 4 bytes, 190 at 1), so the two tables now match. One limit of the test, not a blocker: it compares each format with a reference of the same texel size, so it checks that the layout follows from the size, not that the size is right;resource.rsis the evidence for that. Looks good to me.Reviewed on Windows 11 (build 26300), Rust 1.98.1, each PR in its own worktree; no game data, not run in the game. AI-assisted (Claude Code).
@adrianmjim on GitHub · 2026-11-25 17:23 UTC · original
Tested on an RX 7900 XT (Windows 11 26300, driver's D3D12) with this PR applied to
71652a2.Format 191 is 4 bytes per texel in the new layout, but the host texture made for it has 2.
pc_format()(resource.rs:231) remaps only 118-120, so a console format-191 texture is created on the host asDXGI_FORMAT(191), which in the Windows headers isDXGI_FORMAT_A4B4G4R4_UNORM(16 bpp). A local check that compares the two for a 256-texel-wide 2D texture:(
GetCopyableFootprintson the host description vstexture_layout(..).planes[0].layout.desc.element_bytes.)On
main,texture_layout()returnsNonefor 191, sotexture::staging()logs "texture contents without a console layout not uploaded" and leaves it alone. With this PR the upload goes ahead with the wrong texel size:Layout::detile'srow_pitch < bytescheck passes (host pitch 256 >= 64 * 4), so each host row is filled with 64 four-byte texels into a 128-byte row: scrambled contents;The same applies to XG:
XGCreateTextureComputernow succeeds for 191 with a 4-byte layout, where it returnedE_INVALIDARGbefore.189 (R10G10B10_SNORM_A2_UNORM, 4 bytes) and 190 (R4G4_UNORM, 1 byte) look right. For 191, either the console format really is 4 bytes and then it needs a host remap in
pc_format()(like 118-120), or it is A4B4G4R4 and belongs in the 2-byte arm. The "191 (24/8 color)" note onelement()(resource.rs:119), which the PR follows, gives no source; and the new test cannot tell, because it compares 191 with RGBA8 (28), picked to have the assumed size.Unless someone has a source for 191, I would keep 189 and 190 and leave 191 out of this PR.
@lcg007xd-c on GitHub · 2026-11-25 21:23 UTC · original · reviewed
Verified on Linux (Rust 1.98.1)
cargo test -p victory-formats --libon821d31c: 25 passed, 0 failed, 4 ignored. The same with the PR merged into current main (--no-commit).189and190removed from theformat()arms,console_formats_use_the_expected_color_layoutsfails withformat 189, Swizzle(0),left: Err(Invalid).cargo clippy -p victory-formats --target x86_64-pc-windows-msvc: 0 warnings, same as main.git merge --no-commit --no-ffinto main: merges cleanly.Finding: 189 and 190 have the same host-side gap as 191
@adrianmjim's point about 191 seems to apply to 189 and 190 as well, in a different way:
pc_format()(crates/victory-gpu/src/resource.rs:231-238) remaps only 118-120. Every other format number reaches the host D3D12 resource unchanged, throughresource.rs:295/346/1233,descriptor/host.rs:2006/2017andlist.rs:778.windows0.62.2 (the version inCargo.lock),Win32/Graphics/Dxgi/Common/mod.rs:157-158definesDXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189andDXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190. These are opaque sampler-feedback formats with no texel layout an upload could write.So on the host side, this PR changes
texture_layout()fromNone(contents left alone, with the existing log line) to a 4- or 1-byte layout. The host texture it uploads into is either refused at creation or is an opaque feedback map. The new test can't show this, because it compares each format with a reference of the assumed size, as @Ekabusto noted.A suggestion, depending on what the PR is for:
XGCreateTextureComputer) only, the console-side layout is all that's needed and this is fine. A note in the description would help, plus perhaps apc_formatfollow-up issue.pc_format(), the way 118-120 have them. 189 has no exact PC equivalent (signed 10-bit RGB with unsigned A2), and 190 (R4G4) has no 8-bit PC format, so both would probably need a stand-in plus a conversion. Until then, leaving them out of the host path may be safer than uploading with a layout the host resource doesn't share.I have not run this on Windows, so I can't say which of the two failure modes happens there: creation refused, or an opaque resource.
Not verified
Reviewed with 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.