Commit 9e9f3703 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3dx10: Map DXGI_FORMAT_R16_UNORM to DXGI_FORMAT_R16G16B16A16_UNORM in get_d3dx10_dds_format().

parent 2d9b61d0
......@@ -2929,6 +2929,7 @@ static void test_get_image_info(void)
check_dds_pixel_format(DDS_PF_RGB, 0, 24, 0xff0000, 0x00ff00, 0x0000ff, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
check_dds_pixel_format(DDS_PF_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0, 0, DXGI_FORMAT_R16G16_UNORM);
check_dds_pixel_format(DDS_PF_LUMINANCE, 0, 8, 0xff, 0, 0, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
check_dds_pixel_format(DDS_PF_LUMINANCE, 0, 16, 0xffff, 0, 0, 0, DXGI_FORMAT_R16G16B16A16_UNORM);
check_dds_pixel_format(DDS_PF_LUMINANCE | DDS_PF_ALPHA, 0, 16, 0x00ff, 0, 0, 0xff00, DXGI_FORMAT_R8G8B8A8_UNORM);
check_dds_pixel_format(DDS_PF_LUMINANCE | DDS_PF_ALPHA, 0, 8, 0x0f, 0, 0, 0xf0, DXGI_FORMAT_R8G8B8A8_UNORM);
......
......@@ -71,18 +71,6 @@ wic_pixel_formats[] =
{ &GUID_WICPixelFormat128bppRGBAFloat, DXGI_FORMAT_R32G32B32A32_FLOAT }
};
static const DXGI_FORMAT to_be_converted_format[] =
{
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_R8_UNORM,
DXGI_FORMAT_R8G8_UNORM,
DXGI_FORMAT_B5G6R5_UNORM,
DXGI_FORMAT_B4G4R4A4_UNORM,
DXGI_FORMAT_B5G5R5A1_UNORM,
DXGI_FORMAT_B8G8R8X8_UNORM,
DXGI_FORMAT_B8G8R8A8_UNORM
};
static D3DX10_IMAGE_FILE_FORMAT wic_container_guid_to_file_format(GUID *container_format)
{
unsigned int i;
......@@ -260,12 +248,30 @@ static unsigned int get_bpp_from_format(DXGI_FORMAT format)
static DXGI_FORMAT get_d3dx10_dds_format(DXGI_FORMAT format)
{
static const struct
{
DXGI_FORMAT src;
DXGI_FORMAT dst;
}
format_map[] =
{
{DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM},
{DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM},
{DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM},
{DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM},
{DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM},
{DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM},
{DXGI_FORMAT_B8G8R8X8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM},
{DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM},
{DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM},
};
unsigned int i;
for (i = 0; i < ARRAY_SIZE(to_be_converted_format); ++i)
for (i = 0; i < ARRAY_SIZE(format_map); ++i)
{
if (format == to_be_converted_format[i])
return DXGI_FORMAT_R8G8B8A8_UNORM;
if (format == format_map[i].src)
return format_map[i].dst;
}
return format;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment