gpu(native): give B8G8R8A8_UNORM_SRGB a host texture #65
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/65"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by ShadyUnderLight on 2026-11-26T12:49:45Z.
Summary
A windowed run that got past the menus named one more texture format the host could not make: DXGI 91,
B8G8R8A8_UNORM_SRGB, a 1024x512 sampled texture. Views of it got no host texture, so every draw that sampled it read nothing. This maps it to Metal'sBGRA8Unorm_sRGB.Problem
descriptors::formatmapped 87 (B8G8R8A8_UNORM) but not 91, its_SRGBsibling, soTextureInfo::descreturnedNone,Textures::realizerefused the texture, and draws that sampled it read nothing.a title texture format the host does not represent (first of this format) format=91 w=1024 h=512 flags=3145728.0x300000has none of bits 0, 1 and 2 set.Fix
Format::Bgra8UnormSrgbwith a 1x4 block; it is not an integer format.MTLPixelFormat::BGRA8Unorm_sRGB(the linear-view map already turns that intoBGRA8Unorm).docs/native-host.md.Tests
bgra8_srgb_has_a_host_formatfails on main (format(91)isNone) and asserts the exact variant and that it is not an integer format. DXGI 91 is added tohost_formats_have_the_title_formats_element_size, which compares the host format's block againstresource::element.Verification
cargo test -p victory-gpu bgra8_srgb_has_a_host_format— ok.cargo test -p victory-gpu(native arm64) — 146 passed, 0 failed, 1 ignored.cargo test -p victory-metal— 12 passed, 0 failed.cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings— clean.cargo clippy -p victory-gpu -p victory-backend --all-targets -- -D warnings— the only errors are the two pre-existingunnecessary_castfindings incrates/victory-metal/src/present.rs:126,144; the same two appear on unmodifiedorigin/main.cargo xtask policy—asset policy: 365 files ok.Windowed 200 s runs, same game and machine, one on
origin/mainand one with this change:format=91warningorigin/main(594aa04)0xc0000005 at image+0x1d75a90xc0000005 at image+0x55e56f8Both runs reach the world load (about 1900 pipeline binds, 700 compute) and then fault inside title code, at different addresses. A third run, on the same unmodified main, ended in a different failure:
kIOGPUCommandBufferCallbackErrorHang. The world load is unstable independently of this change; the mapping removes the missing-format warning and nothing else. No claim is made about the black world: about 200 of the 698 compute pipelines the world load binds are refused (65 of them for an FSPX root type the translator does not handle), so their dispatches are dropped.Risk
Notes
All English. Found by reading the log of the first windowed run that got past the menus; headless runs never reach this content. No game data in the repo.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T13:26:46Z.
Review: APPROVED
Clean mapping for DXGI 91 (
B8G8R8A8_UNORM_SRGB) ->Format::Bgra8UnormSrgb->MTLPixelFormat::BGRA8Unorm_sRGB(withview_without_srgbalready mappingBGRA8Unorm_sRGB->BGRA8Unorm), matching 1x4 block size, unit tests, anddocs/native-host.mdupdate. CI is green; merging.