Skip to content

Commit e5c338c

Browse files
authored
Merge pull request #85 from nickbabcock/b5g5r5a1
Support B5G5R5A1_UNORM DDS images
2 parents 368592d + b38a260 commit e5c338c

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/Pfim/dds/DdsHeaderDxt10.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ internal Dds NewDecoder(DdsHeader header, PfimConfig config)
8888
case DxgiFormat.B8G8R8X8_UNORM_SRGB:
8989
return new UncompressedDds(header, config, 32, false);
9090

91+
case DxgiFormat.B5G5R5A1_UNORM:
92+
return new UncompressedDds(header, config, 16, false);
93+
9194
case DxgiFormat.UNKNOWN:
9295
case DxgiFormat.R32G32B32A32_TYPELESS:
9396
case DxgiFormat.R32G32B32A32_FLOAT:
@@ -172,7 +175,7 @@ internal Dds NewDecoder(DdsHeader header, PfimConfig config)
172175
case DxgiFormat.V208:
173176
case DxgiFormat.V408:
174177
default:
175-
throw new ArgumentOutOfRangeException($"Unimplemented DXGI format: {DxgiFormat}");
178+
throw new ArgumentException($"Unimplemented DXGI format: {DxgiFormat}");
176179
}
177180
}
178181
}

tests/Pfim.Tests/ImageTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class ImageTests
1515
[InlineData("32-bit-uncompressed.dds", 8563937048591661181, ImageFormat.Rgba32)]
1616
[InlineData("Antenna_Metal_0_Normal.dds", 11008763962346865605, ImageFormat.Rgb24)]
1717
[InlineData("b8g8r8x8.dds", 14954708280773054506, ImageFormat.Rgba32)]
18+
[InlineData("b5g5r5a1.dds", 10104226901531980508, ImageFormat.R5g5b5a1)]
1819
[InlineData("CBW8.tga", 11906269729452326966, ImageFormat.Rgb8)]
1920
[InlineData("CCM8.tga", 11437704396291630213, ImageFormat.R5g5b5)]
2021
[InlineData("CTC16.tga", 11437704396291630213, ImageFormat.R5g5b5)]

tests/Pfim.Tests/data/b5g5r5a1.dds

683 KB
Binary file not shown.

0 commit comments

Comments
 (0)