[3/3] d3dx9: Implement conversion from DDS pixel format to D3DFORMAT.
Józef Kucia
joseph.kucia at gmail.com
Thu Apr 26 04:47:53 CDT 2012
---
dlls/d3dx9_36/surface.c | 114 +++++++++++++++++++++++++++++++-
dlls/d3dx9_36/tests/surface.c | 149 +++++++++++++++++++++--------------------
2 files changed, 188 insertions(+), 75 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index c229d10..26497c1 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -95,9 +95,121 @@ struct dds_header
DWORD reserved2;
};
+static D3DFORMAT dds_fourcc_to_d3dformat(DWORD fourcc)
+{
+ int i;
+ static const DWORD known_fourcc[] = {
+ MAKEFOURCC('U','Y','V','Y'),
+ MAKEFOURCC('Y','U','Y','2'),
+ MAKEFOURCC('R','G','B','G'),
+ MAKEFOURCC('G','R','G','B'),
+ MAKEFOURCC('D','X','T','1'),
+ MAKEFOURCC('D','X','T','2'),
+ MAKEFOURCC('D','X','T','3'),
+ MAKEFOURCC('D','X','T','4'),
+ MAKEFOURCC('D','X','T','5')
+ };
+
+ for (i = 0; i < sizeof(known_fourcc) / sizeof(known_fourcc[0]); i++)
+ {
+ if (known_fourcc[i] == fourcc)
+ return fourcc;
+ }
+
+ WARN("Unknown FourCC %#x\n", fourcc);
+ return D3DFMT_UNKNOWN;
+}
+
+static D3DFORMAT dds_rgb_to_d3dformat(const struct dds_pixel_format *pixel_format)
+{
+ int i;
+ static const struct {
+ DWORD bpp;
+ DWORD rmask;
+ DWORD gmask;
+ DWORD bmask;
+ DWORD amask;
+ D3DFORMAT format;
+ } rgb_pixel_formats[] = {
+ { 8, 0xe0, 0x1c, 0x03, 0, D3DFMT_R3G3B2 },
+ { 16, 0xf800, 0x07e0, 0x001f, 0x0000, D3DFMT_R5G6B5 },
+ { 16, 0x7c00, 0x03e0, 0x001f, 0x8000, D3DFMT_A1R5G5B5 },
+ { 16, 0x7c00, 0x03e0, 0x001f, 0x0000, D3DFMT_X1R5G5B5 },
+ { 16, 0x0f00, 0x00f0, 0x000f, 0xf000, D3DFMT_A4R4G4B4 },
+ { 16, 0x0f00, 0x00f0, 0x000f, 0x0000, D3DFMT_X4R4G4B4 },
+ { 16, 0x00e0, 0x001c, 0x0003, 0xff00, D3DFMT_A8R3G3B2 },
+ { 24, 0xff0000, 0x00ff00, 0x0000ff, 0x000000, D3DFMT_R8G8B8 },
+ { 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, D3DFMT_A8R8G8B8 },
+ { 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, D3DFMT_X8R8G8B8 },
+ { 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000, D3DFMT_A2B10G10R10 },
+ { 32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000, D3DFMT_A2R10G10B10 },
+ { 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000, D3DFMT_G16R16 },
+ };
+
+ for (i = 0; i < sizeof(rgb_pixel_formats) / sizeof(rgb_pixel_formats[0]); i++)
+ {
+ if (rgb_pixel_formats[i].bpp == pixel_format->bpp
+ && rgb_pixel_formats[i].rmask == pixel_format->rmask
+ && rgb_pixel_formats[i].gmask == pixel_format->gmask
+ && rgb_pixel_formats[i].bmask == pixel_format->bmask)
+ {
+ if ((pixel_format->flags & DDS_PF_ALPHA) && rgb_pixel_formats[i].amask == pixel_format->amask)
+ return rgb_pixel_formats[i].format;
+ else if (rgb_pixel_formats[i].amask == 0)
+ return rgb_pixel_formats[i].format;
+ }
+ }
+
+ WARN("Unknown RGB pixel format (%#x, %#x, %#x, %#x)\n",
+ pixel_format->rmask, pixel_format->gmask, pixel_format->bmask, pixel_format->amask);
+ return D3DFMT_UNKNOWN;
+}
+
+static D3DFORMAT dds_luminance_to_d3dformat(const struct dds_pixel_format *pixel_format)
+{
+ if (pixel_format->bpp == 8)
+ {
+ if (pixel_format->rmask == 0xff)
+ return D3DFMT_L8;
+ else if ((pixel_format->flags & DDS_PF_ALPHA)
+ && pixel_format->rmask == 0x0f && pixel_format->amask == 0xf0)
+ return D3DFMT_A4L4;
+ }
+ else if (pixel_format->bpp == 16)
+ {
+ if ((pixel_format->flags & DDS_PF_ALPHA)
+ && pixel_format->rmask == 0x00ff && pixel_format->amask == 0xff00)
+ return D3DFMT_A8L8;
+ }
+
+ WARN("Unknown luminance pixel format (bpp %#x, l %#x, a %#x)\n",
+ pixel_format->bpp, pixel_format->rmask, pixel_format->amask);
+ return D3DFMT_UNKNOWN;
+}
+
+static D3DFORMAT dds_alpha_to_d3dformat(const struct dds_pixel_format *pixel_format)
+{
+ if (pixel_format->bpp == 8 && pixel_format->amask == 0xff)
+ return D3DFMT_A8;
+
+ WARN("Unknown Alpha pixel format (%#x, %#x)\n", pixel_format->bpp, pixel_format->rmask);
+ return D3DFMT_UNKNOWN;
+}
+
static D3DFORMAT dds_pixel_format_to_d3dformat(const struct dds_pixel_format *pixel_format)
{
- FIXME("Pixel format conversion not implemented.\n");
+ if (pixel_format->flags & DDS_PF_FOURCC)
+ return dds_fourcc_to_d3dformat(pixel_format->fourcc);
+ else if (pixel_format->flags & DDS_PF_RGB)
+ return dds_rgb_to_d3dformat(pixel_format);
+ else if (pixel_format->flags & DDS_PF_LUMINANCE)
+ return dds_luminance_to_d3dformat(pixel_format);
+ else if (pixel_format->flags & DDS_PF_ALPHA_ONLY)
+ return dds_alpha_to_d3dformat(pixel_format);
+
+ WARN("Unknown pixel format (fourcc %#x, bpp %#x, r %#x, g %#x, b %#x, a %#x)\n",
+ pixel_format->fourcc, pixel_format->bpp, pixel_format->rmask, pixel_format->gmask,
+ pixel_format->bmask, pixel_format->amask);
return D3DFMT_UNKNOWN;
}
diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c
index 996dcf5..79d4bc3 100644
--- a/dlls/d3dx9_36/tests/surface.c
+++ b/dlls/d3dx9_36/tests/surface.c
@@ -327,83 +327,84 @@ static void test_D3DXGetImageInfo(void)
/* test DDS support */
+ hr = D3DXGetImageInfoFromFileInMemory(dds_24bit, sizeof(dds_24bit), &info);
+ ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
+ if (hr == D3D_OK) {
+ ok(info.Width == 2, "Got width %u, expected 2\n", info.Width);
+ ok(info.Height == 2, "Got height %u, expected 2\n", info.Height);
+ ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
+ ok(info.MipLevels == 2, "Got miplevels %u, expected 2\n", info.MipLevels);
+ ok(info.Format == D3DFMT_R8G8B8, "Got format %#x, expected %#x\n", info.Format, D3DFMT_R8G8B8);
+ ok(info.ResourceType == D3DRTYPE_TEXTURE, "Got resource type %#x, expected %#x\n", info.ResourceType, D3DRTYPE_TEXTURE);
+ ok(info.ImageFileFormat == D3DXIFF_DDS, "Got image file format %#x, expected %#x\n", info.ImageFileFormat, D3DXIFF_DDS);
+ } else skip("Couldn't get image info from 24-bit DDS file in memory\n");
+
+ hr = D3DXGetImageInfoFromFileInMemory(dds_16bit, sizeof(dds_16bit), &info);
+ ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
+ if (hr == D3D_OK) {
+ ok(info.Width == 2, "Got width %u, expected 2\n", info.Width);
+ ok(info.Height == 2, "Got height %u, expected 2\n", info.Height);
+ ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
+ ok(info.MipLevels == 1, "Got miplevels %u, expected 1\n", info.MipLevels);
+ ok(info.Format == D3DFMT_X1R5G5B5, "Got format %#x, expected %#x\n", info.Format, D3DFMT_X1R5G5B5);
+ ok(info.ResourceType == D3DRTYPE_TEXTURE, "Got resource type %#x, expected %#x\n", info.ResourceType, D3DRTYPE_TEXTURE);
+ ok(info.ImageFileFormat == D3DXIFF_DDS, "Got image file format %#x, expected %#x\n", info.ImageFileFormat, D3DXIFF_DDS);
+ } else skip("Couldn't get image info from 16-bit DDS file in memory\n");
+
+ hr = D3DXGetImageInfoFromFileInMemory(dds_cube_map, sizeof(dds_cube_map), &info);
+ ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
+ if (hr == D3D_OK) {
+ ok(info.Width == 4, "Got width %u, expected 4\n", info.Width);
+ ok(info.Height == 4, "Got height %u, expected 4\n", info.Height);
+ ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
+ ok(info.MipLevels == 1, "Got miplevels %u, expected 1\n", info.MipLevels);
+ ok(info.Format == D3DFMT_DXT5, "Got format %#x, expected %#x\n", info.Format, D3DFMT_DXT5);
+ ok(info.ResourceType == D3DRTYPE_CUBETEXTURE, "Got resource type %#x, expected %#x\n", info.ResourceType, D3DRTYPE_CUBETEXTURE);
+ ok(info.ImageFileFormat == D3DXIFF_DDS, "Got image file format %#x, expected %#x\n", info.ImageFileFormat, D3DXIFF_DDS);
+ } else skip("Couldn't get image info from cube map in memory\n");
+
+ hr = D3DXGetImageInfoFromFileInMemory(dds_volume_map, sizeof(dds_volume_map), &info);
+ ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
+ if (hr == D3D_OK) {
+ ok(info.Width == 4, "Got width %u, expected 4\n", info.Width);
+ ok(info.Height == 4, "Got height %u, expected 4\n", info.Height);
+ ok(info.Depth == 2, "Got depth %u, expected 2\n", info.Depth);
+ ok(info.MipLevels == 3, "Got miplevels %u, expected 3\n", info.MipLevels);
+ ok(info.Format == D3DFMT_DXT3, "Got format %#x, expected %#x\n", info.Format, D3DFMT_DXT3);
+ ok(info.ResourceType == D3DRTYPE_VOLUMETEXTURE, "Got resource type %#x, expected %#x\n", info.ResourceType, D3DRTYPE_VOLUMETEXTURE);
+ ok(info.ImageFileFormat == D3DXIFF_DDS, "Got image file format %#x, expected %#x\n", info.ImageFileFormat, D3DXIFF_DDS);
+ } else skip("Couldn't get image info from volume map in memory\n");
+
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','1'), 0, 0, 0, 0, 0, D3DFMT_DXT1);
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','2'), 0, 0, 0, 0, 0, D3DFMT_DXT2);
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','3'), 0, 0, 0, 0, 0, D3DFMT_DXT3);
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','4'), 0, 0, 0, 0, 0, D3DFMT_DXT4);
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','5'), 0, 0, 0, 0, 0, D3DFMT_DXT5);
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0, D3DFMT_R8G8_B8G8);
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0, D3DFMT_G8R8_G8B8);
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('U','Y','V','Y'), 0, 0, 0, 0, 0, D3DFMT_UYVY);
+ check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0, D3DFMT_YUY2);
+ check_dds_pixel_format(DDSPF_RGB, 0, 16, 0xf800, 0x07e0, 0x001f, 0, D3DFMT_R5G6B5);
+ check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 16, 0x7c00, 0x03e0, 0x001f, 0x8000, D3DFMT_A1R5G5B5);
+ check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 16, 0x0f00, 0x00f0, 0x000f, 0xf000, D3DFMT_A4R4G4B4);
+ check_dds_pixel_format(DDSPF_RGB, 0, 8, 0xe0, 0x1c, 0x03, 0, D3DFMT_R3G3B2);
+ check_dds_pixel_format(DDSPF_ALPHA, 0, 8, 0, 0, 0, 0xff, D3DFMT_A8);
+ check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 16, 0x00e0, 0x001c, 0x0003, 0xff00, D3DFMT_A8R3G3B2);
+ check_dds_pixel_format(DDSPF_RGB, 0, 16, 0xf00, 0x0f0, 0x00f, 0, D3DFMT_X4R4G4B4);
+ check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000, D3DFMT_A2B10G10R10);
+ check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000, D3DFMT_A2R10G10B10);
+ check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, D3DFMT_A8R8G8B8);
+ check_dds_pixel_format(DDSPF_RGB, 0, 32, 0xff0000, 0x00ff00, 0x0000ff, 0, D3DFMT_X8R8G8B8);
+ check_dds_pixel_format(DDSPF_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0, 0, D3DFMT_G16R16);
+ check_dds_pixel_format(DDSPF_LUMINANCE, 0, 8, 0xff, 0, 0, 0, D3DFMT_L8);
+ check_dds_pixel_format(DDSPF_LUMINANCE | DDSPF_ALPHAPIXELS, 0, 16, 0x00ff, 0, 0, 0xff00, D3DFMT_A8L8);
+ check_dds_pixel_format(DDSPF_LUMINANCE | DDSPF_ALPHAPIXELS, 0, 8, 0x0f, 0, 0, 0xf0, D3DFMT_A4L4);
+
todo_wine {
- hr = D3DXGetImageInfoFromFileInMemory(dds_24bit, sizeof(dds_24bit), &info);
- ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
- if (hr == D3D_OK) {
- ok(info.Width == 2, "Got width %u, expected 2\n", info.Width);
- ok(info.Height == 2, "Got height %u, expected 2\n", info.Height);
- ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
- ok(info.MipLevels == 2, "Got miplevels %u, expected 2\n", info.MipLevels);
- ok(info.Format == D3DFMT_R8G8B8, "Got format is %#x, expected %#x\n", info.Format, D3DFMT_R8G8B8);
- ok(info.ResourceType == D3DRTYPE_TEXTURE, "Got resource type %#x, expected %#x\n", info.ResourceType, D3DRTYPE_TEXTURE);
- ok(info.ImageFileFormat == D3DXIFF_DDS, "Got image file format %#x, expected %#x\n", info.ImageFileFormat, D3DXIFF_DDS);
- } else skip("Couldn't get image info from 24-bit DDS file in memory\n");
-
- hr = D3DXGetImageInfoFromFileInMemory(dds_16bit, sizeof(dds_16bit), &info);
- ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
- if (hr == D3D_OK) {
- ok(info.Width == 2, "Got width %u, expected 2\n", info.Width);
- ok(info.Height == 2, "Got height %u, expected 2\n", info.Height);
- ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
- ok(info.MipLevels == 1, "Got miplevels %u, expected 1\n", info.MipLevels);
- ok(info.Format == D3DFMT_X1R5G5B5, "Got format is %#x, expected %#x\n", info.Format, D3DFMT_X1R5G5B5);
- ok(info.ResourceType == D3DRTYPE_TEXTURE, "Got resource type %#x, expected %#x\n", info.ResourceType, D3DRTYPE_TEXTURE);
- ok(info.ImageFileFormat == D3DXIFF_DDS, "Got image file format %#x, expected %#x\n", info.ImageFileFormat, D3DXIFF_DDS);
- } else skip("Couldn't get image info from 16-bit DDS file in memory\n");
-
- hr = D3DXGetImageInfoFromFileInMemory(dds_cube_map, sizeof(dds_cube_map), &info);
- ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
- if (hr == D3D_OK) {
- ok(info.Width == 4, "Got width %u, expected 4\n", info.Width);
- ok(info.Height == 4, "Got height %u, expected 4\n", info.Height);
- ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
- ok(info.MipLevels == 1, "Got miplevels %u, expected 1\n", info.MipLevels);
- ok(info.Format == D3DFMT_DXT5, "Got format is %#x, expected %#x\n", info.Format, D3DFMT_DXT5);
- ok(info.ResourceType == D3DRTYPE_CUBETEXTURE, "Got resource type %#x, expected %#x\n", info.ResourceType, D3DRTYPE_CUBETEXTURE);
- ok(info.ImageFileFormat == D3DXIFF_DDS, "Got image file format %#x, expected %#x\n", info.ImageFileFormat, D3DXIFF_DDS);
- } else skip("Couldn't get image info from cube map in memory\n");
-
- hr = D3DXGetImageInfoFromFileInMemory(dds_volume_map, sizeof(dds_volume_map), &info);
- ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
- if (hr == D3D_OK) {
- ok(info.Width == 4, "Got width %u, expected 4\n", info.Width);
- ok(info.Height == 4, "Got height %u, expected 4\n", info.Height);
- ok(info.Depth == 2, "Got depth %u, expected 2\n", info.Depth);
- ok(info.MipLevels == 3, "Got miplevels %u, expected 3\n", info.MipLevels);
- ok(info.Format == D3DFMT_DXT3, "Got format is %#x, expected %#x\n", info.Format, D3DFMT_DXT3);
- ok(info.ResourceType == D3DRTYPE_VOLUMETEXTURE, "Got resource type %#x, expected %#x\n", info.ResourceType, D3DRTYPE_VOLUMETEXTURE);
- ok(info.ImageFileFormat == D3DXIFF_DDS, "Got image file format %#x, expected %#x\n", info.ImageFileFormat, D3DXIFF_DDS);
- } else skip("Couldn't get image info from volume map in memory\n");
-
- check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','1'), 0, 0, 0, 0, 0, D3DFMT_DXT1);
- check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','2'), 0, 0, 0, 0, 0, D3DFMT_DXT2);
- check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','3'), 0, 0, 0, 0, 0, D3DFMT_DXT3);
- check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','4'), 0, 0, 0, 0, 0, D3DFMT_DXT4);
- check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('D','X','T','5'), 0, 0, 0, 0, 0, D3DFMT_DXT5);
- check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0, D3DFMT_R8G8_B8G8);
- check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0, D3DFMT_G8R8_G8B8);
- check_dds_pixel_format(DDSPF_FOURCC, MAKEFOURCC('U','Y','V','Y'), 0, 0, 0, 0, 0, D3DFMT_UYVY);
- check_dds_pixel_format(DDSPF_RGB, 0, 16, 0xf800, 0x07e0, 0x001f, 0, D3DFMT_R5G6B5);
- check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 16, 0x7c00, 0x03e0, 0x001f, 0x8000, D3DFMT_A1R5G5B5);
- check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 16, 0x0f00, 0x00f0, 0x000f, 0xf000, D3DFMT_A4R4G4B4);
- check_dds_pixel_format(DDSPF_RGB, 0, 8, 0xe0, 0x1c, 0x03, 0, D3DFMT_R3G3B2);
- check_dds_pixel_format(DDSPF_ALPHA, 0, 8, 0, 0, 0, 0xff, D3DFMT_A8);
- check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 16, 0x00e0, 0x001c, 0x0003, 0xff00, D3DFMT_A8R3G3B2);
- check_dds_pixel_format(DDSPF_RGB, 0, 16, 0xf00, 0x0f0, 0x00f, 0, D3DFMT_X4R4G4B4);
- check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000, D3DFMT_A2B10G10R10);
- check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000, D3DFMT_A2R10G10B10);
- check_dds_pixel_format(DDSPF_RGB | DDSPF_ALPHAPIXELS, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, D3DFMT_A8R8G8B8);
- check_dds_pixel_format(DDSPF_RGB, 0, 32, 0xff0000, 0x00ff00, 0x0000ff, 0, D3DFMT_X8R8G8B8);
- check_dds_pixel_format(DDSPF_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0, 0, D3DFMT_G16R16);
- check_dds_pixel_format(DDSPF_LUMINANCE, 0, 8, 0xff, 0, 0, 0, D3DFMT_L8);
- check_dds_pixel_format(DDSPF_LUMINANCE | DDSPF_ALPHAPIXELS, 0, 16, 0x00ff, 0, 0, 0xff00, D3DFMT_A8L8);
- check_dds_pixel_format(DDSPF_LUMINANCE | DDSPF_ALPHAPIXELS, 0, 8, 0x0f, 0, 0, 0xf0, D3DFMT_A4L4);
+ hr = D3DXGetImageInfoFromFileInMemory(dds_16bit, sizeof(dds_16bit) - 1, &info);
+ ok(hr == D3DXERR_INVALIDDATA, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3DXERR_INVALIDDATA);
}
- hr = D3DXGetImageInfoFromFileInMemory(dds_16bit, sizeof(dds_16bit) - 1, &info);
- ok(hr == D3DXERR_INVALIDDATA, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3DXERR_INVALIDDATA);
-
/* cleanup */
if(testdummy_ok) DeleteFileA("testdummy.bmp");
--
1.7.8.5
More information about the wine-patches
mailing list