From 0dd34bdbe64dca12e2769af657594b4365ec55a6 Mon Sep 17 00:00:00 2001 From: uiliannn Date: Fri, 27 Nov 2026 22:44:11 +0300 Subject: [PATCH] Formats: map console texture formats 189-191 The console's 189 and 191 are 4 bytes a texel (their DXGI equivalents are block-compressed-colour and a 32-bit format), 190 one byte: they now get layouts like the rest of their DXGI family instead of no layout at all. Ported from uiliannn/VItoriaBr 0d1c4e0. (cherry picked from commit 9fd09c35f28b91a8db82b499b8999990f1cd4035) --- crates/victory-formats/src/texture.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/victory-formats/src/texture.rs b/crates/victory-formats/src/texture.rs index e52d639..538db51 100644 --- a/crates/victory-formats/src/texture.rs +++ b/crates/victory-formats/src/texture.rs @@ -826,10 +826,10 @@ pub fn format(dxgi: u32) -> Option { 1..=4 => (16, 1, false), 9..=18 => (8, 1, false), 19..=22 | 44..=47 => (4, 1, true), - 23..=43 | 67 | 87..=93 | 116 | 117 => (4, 1, false), + 23..=43 | 67 | 87..=93 | 116 | 117 | 189 | 191 => (4, 1, false), 48..=59 | 85 | 86 | 115 => (2, 1, false), 118..=120 => (2, 1, true), - 60..=65 => (1, 1, false), + 60..=65 | 190 => (1, 1, false), 70..=72 | 79..=81 => (8, 4, false), 73..=78 | 82..=84 | 94..=99 => (16, 4, false), _ => return None, @@ -968,6 +968,20 @@ mod tests { } } + #[test] + fn console_formats_have_layouts() { + for (dxgi, bytes) in [(189, 4), (190, 1), (191, 4)] { + assert_eq!( + format(dxgi), + Some(Format { + bytes, + block: 1, + stencil: false + }) + ); + } + } + /// Sizes past the hardware's 16384 texels per side are refused instead /// of overflowing the size arithmetic (found by random-input testing). #[test]