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)
This commit is contained in:
1 parent
5732b3df3c
commit
0dd34bdbe6
1 file changed
+16
-2
@@ -826,10 +826,10 @@ pub fn format(dxgi: u32) -> Option<Format> {
|
|||||||
1..=4 => (16, 1, false),
|
1..=4 => (16, 1, false),
|
||||||
9..=18 => (8, 1, false),
|
9..=18 => (8, 1, false),
|
||||||
19..=22 | 44..=47 => (4, 1, true),
|
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),
|
48..=59 | 85 | 86 | 115 => (2, 1, false),
|
||||||
118..=120 => (2, 1, true),
|
118..=120 => (2, 1, true),
|
||||||
60..=65 => (1, 1, false),
|
60..=65 | 190 => (1, 1, false),
|
||||||
70..=72 | 79..=81 => (8, 4, false),
|
70..=72 | 79..=81 => (8, 4, false),
|
||||||
73..=78 | 82..=84 | 94..=99 => (16, 4, false),
|
73..=78 | 82..=84 | 94..=99 => (16, 4, false),
|
||||||
_ => return None,
|
_ => 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
|
/// Sizes past the hardware's 16384 texels per side are refused instead
|
||||||
/// of overflowing the size arithmetic (found by random-input testing).
|
/// of overflowing the size arithmetic (found by random-input testing).
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in new issue
Block a user