d3d12: give narrow textures room for their 4 KiB swizzle #198
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/198"
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?
Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-25T21:08:55Z.
Summary
ProjectScarlett asks
GetResourceAllocationInfohow big a small texture is (undefined layout, 4 KiB alignment), allocates that much guest memory, reads the texture from its archive into it and then creates it with the 4 KiB swizzle. TuxBox passed on the host driver's answer. RADV gives narrow images 256-byte tiles, so a 256x2 RGBA16F table was 0x2000 bytes instead of 0x8000.The compressed stream then did not fit the destination and the whole read failed, which left the texture zero. In the prologue that was 46 to 69 textures a run, among them the table hair lighting divides by: hair and cloth sparkled with NaN pixels and the picture had a white haze.
Such a texture is now at least as large as its 4 KiB swizzle, which the XG layout code already computes. The host's answer stays when it is larger or when the host does not place the texture at 4 KiB, so textures placed in a host heap still fit.
GetResourceAllocationInfo1answers the same way.With this change no read fails on that path, 110 of the 111 narrow textures loaded at the window shot hold data (the other one is written by the game at run time), and the sparkle and the haze are gone.
Verified on Lanes
python tuxbox.py checkpassed on this branchGPU, driver and backend: RX 9060 XT, RADV (Mesa 26.1.8), Proton Experimental
The same seven cases fail on plain main on this machine (last compared at
7b22d71), where I run the check in a private Xwayland inside a container.Not a Lanes scenario because it is about one query's answer.
d3d12-featuresnow asks for six narrow textures (two of them with unordered access), alone and as a batch, through both queries. It fails on the old runtime, fails without the second query's part and passes on this branch. The full check above ran before the second commit. After it I rerand3d12-featuresand the typecheck.Only measured on RADV. A host driver that already returns the larger size sees no change.
Checks
cargo checkof tuxbox-d3d12 for x86_64-pc-windows-msvc🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by tsunderejay on 2026-11-25T21:23:33Z.
Review found no blocking issue in the GTA slot-25 path, but two coverage gaps before treating this as API-wide: (1) needs_packed(desc) is evaluated before small_texture, so narrow R9G9B9E5/B5G5R5A1 UAVs can still be undersized on fallback hosts; (2) GetResourceAllocationInfo2 (slot 108) still returns the native host size for UNKNOWN-layout small textures. Please reuse small_texture in both paths and add parity/fallback tests.
Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-26T01:42:30Z.
Ai
Thanks, both fixed in
e87627e.small_texturenow runs beforeneeds_packed, andGetResourceAllocationInfo2(slot 108) gives the same answer.d3d12-featurescovers six narrow textures through both queries, including RGBA16F and R9G9B9E5 UAVs. B5G5R5A1 isn't covered because the XG plane code doesn't know format 86 yet, so that format keeps the host's answer.