From 3392f477c5c8f87667059864ebee58e67016794e Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 15 Nov 2025 17:48:30 +1100 Subject: [PATCH] Fixed upstream Commit b5ec5e6bcfff3dfb005e906a8002572788774b01. --- ...-D3DX11CreateTextureFromMemory-using.patch | 2215 ----------------- .../definition | 2 - 2 files changed, 2217 deletions(-) delete mode 100644 patches/d3dx11_43-D3DX11CreateTextureFromMemory/0016-d3dx11-Implement-D3DX11CreateTextureFromMemory-using.patch delete mode 100644 patches/d3dx11_43-D3DX11CreateTextureFromMemory/definition diff --git a/patches/d3dx11_43-D3DX11CreateTextureFromMemory/0016-d3dx11-Implement-D3DX11CreateTextureFromMemory-using.patch b/patches/d3dx11_43-D3DX11CreateTextureFromMemory/0016-d3dx11-Implement-D3DX11CreateTextureFromMemory-using.patch deleted file mode 100644 index 6a356d77..00000000 --- a/patches/d3dx11_43-D3DX11CreateTextureFromMemory/0016-d3dx11-Implement-D3DX11CreateTextureFromMemory-using.patch +++ /dev/null @@ -1,2215 +0,0 @@ -From a9453aa73ee6fc957e3f1e94efdb7bda3e254455 Mon Sep 17 00:00:00 2001 -From: Connor McAdams -Date: Fri, 19 Sep 2025 12:13:27 -0400 -Subject: [PATCH] d3dx11: Implement D3DX11CreateTextureFromMemory() using - shared code. - -Signed-off-by: Connor McAdams ---- - dlls/d3dx11_42/tests/Makefile.in | 2 +- - dlls/d3dx11_43/tests/Makefile.in | 2 +- - dlls/d3dx11_43/tests/d3dx11.c | 1795 +++++++++++++++++++++++++++++- - dlls/d3dx11_43/texture.c | 288 ++++- - 4 files changed, 2082 insertions(+), 5 deletions(-) - -diff --git a/dlls/d3dx11_42/tests/Makefile.in b/dlls/d3dx11_42/tests/Makefile.in -index f18be76d9d5..7eae4f26e0d 100644 ---- a/dlls/d3dx11_42/tests/Makefile.in -+++ b/dlls/d3dx11_42/tests/Makefile.in -@@ -1,5 +1,5 @@ - TESTDLL = d3dx11_42.dll --IMPORTS = d3dx11_42 -+IMPORTS = d3dx11_42 ole32 - PARENTSRC = ../../d3dx11_43/tests - - SOURCES = \ -diff --git a/dlls/d3dx11_43/tests/Makefile.in b/dlls/d3dx11_43/tests/Makefile.in -index 3283e251bdd..fc9007fc878 100644 ---- a/dlls/d3dx11_43/tests/Makefile.in -+++ b/dlls/d3dx11_43/tests/Makefile.in -@@ -1,5 +1,5 @@ - TESTDLL = d3dx11_43.dll --IMPORTS = d3dx11 -+IMPORTS = d3dx11 ole32 - - SOURCES = \ - d3dx11.c -diff --git a/dlls/d3dx11_43/tests/d3dx11.c b/dlls/d3dx11_43/tests/d3dx11.c -index 5e2d28824c3..81bffdf4395 100644 ---- a/dlls/d3dx11_43/tests/d3dx11.c -+++ b/dlls/d3dx11_43/tests/d3dx11.c -@@ -20,15 +20,43 @@ - #include "initguid.h" - #include "d3d11.h" - #include "d3dx11.h" -+#include "wine/wined3d.h" - #include "wine/test.h" - #include - -+#define D3DERR_INVALIDCALL 0x8876086c -+#define DDS_RESOURCE_MISC_TEXTURECUBE 0x04 -+ -+static bool wined3d_opengl; -+ - #ifndef MAKEFOURCC - #define MAKEFOURCC(ch0, ch1, ch2, ch3) \ - ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ - ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) - #endif - -+static DXGI_FORMAT block_compressed_formats[] = -+{ -+ DXGI_FORMAT_BC1_TYPELESS, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB, -+ DXGI_FORMAT_BC2_TYPELESS, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB, -+ DXGI_FORMAT_BC3_TYPELESS, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB, -+ DXGI_FORMAT_BC4_TYPELESS, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_SNORM, -+ DXGI_FORMAT_BC5_TYPELESS, DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_SNORM, -+ DXGI_FORMAT_BC6H_TYPELESS, DXGI_FORMAT_BC6H_UF16, DXGI_FORMAT_BC6H_SF16, -+ DXGI_FORMAT_BC7_TYPELESS, DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM_SRGB -+}; -+ -+static BOOL is_block_compressed(DXGI_FORMAT format) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(block_compressed_formats); ++i) -+ if (format == block_compressed_formats[i]) -+ return TRUE; -+ -+ return FALSE; -+} -+ - static unsigned int get_bpp_from_format(DXGI_FORMAT format) - { - switch (format) -@@ -163,6 +191,13 @@ static unsigned int get_bpp_from_format(DXGI_FORMAT format) - } - } - -+static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) -+{ -+ unsigned int diff = x > y ? x - y : y - x; -+ -+ return diff <= max_diff; -+} -+ - /* 1x1 bmp (1 bpp) */ - static const unsigned char bmp_1bpp[] = - { -@@ -384,6 +419,974 @@ static const unsigned char noimage[4] = - 0x11,0x22,0x33,0x44 - }; - -+/* 1x1 1bpp bmp image */ -+static const BYTE test_bmp_1bpp[] = -+{ -+ 0x42, 0x4d, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x28, 0x00, -+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x02, 0x00, -+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0xf2, 0xf3, 0x80, 0xf4, 0xf5, 0xf6, 0x81, 0x00, 0x00, -+ 0x00, 0x00 -+}; -+static const BYTE test_bmp_1bpp_data[] = -+{ -+ 0xf3, 0xf2, 0xf1, 0xff -+}; -+ -+/* 1x1 4bpp bmp image */ -+static const BYTE test_bmp_4bpp[] = -+{ -+ 0x42, 0x4d, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x28, 0x00, -+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x02, 0x00, -+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0xf2, 0xf3, 0x80, 0xf4, 0xf5, 0xf6, 0x81, 0x00, 0x00, -+ 0x00, 0x00 -+}; -+static const BYTE test_bmp_4bpp_data[] = -+{ -+ 0xf3, 0xf2, 0xf1, 0xff -+}; -+ -+/* 1x1 8bpp bmp image */ -+static const BYTE test_bmp_8bpp[] = -+{ -+ 0x42, 0x4d, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x28, 0x00, -+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x02, 0x00, -+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0xf2, 0xf3, 0x80, 0xf4, 0xf5, 0xf6, 0x81, 0x00, 0x00, -+ 0x00, 0x00 -+}; -+static const BYTE test_bmp_8bpp_data[] = -+{ -+ 0xf3, 0xf2, 0xf1, 0xff -+}; -+ -+/* 1x1 16bpp bmp image */ -+static const BYTE test_bmp_16bpp[] = -+{ -+ 0x42, 0x4d, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, -+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x42, 0x00, 0x00, 0x00, 0x00 -+}; -+static const BYTE test_bmp_16bpp_data[] = -+{ -+ 0x84, 0x84, 0x73, 0xff -+}; -+ -+/* 1x1 24bpp bmp image */ -+static const BYTE test_bmp_24bpp[] = -+{ -+ 0x42, 0x4d, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, -+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x84, 0x84, 0x00, 0x00, 0x00 -+}; -+static const BYTE test_bmp_24bpp_data[] = -+{ -+ 0x84, 0x84, 0x73, 0xff -+}; -+ -+/* 2x2 32bpp XRGB bmp image */ -+static const BYTE test_bmp_32bpp_xrgb[] = -+{ -+ 0x42, 0x4d, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, -+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xb0, 0xc0, 0x00, 0xa1, 0xb1, 0xc1, 0x00, 0xa2, 0xb2, -+ 0xc2, 0x00, 0xa3, 0xb3, 0xc3, 0x00 -+}; -+static const BYTE test_bmp_32bpp_xrgb_data[] = -+{ -+ 0xc2, 0xb2, 0xa2, 0xff, 0xc3, 0xb3, 0xa3, 0xff, 0xc0, 0xb0, 0xa0, 0xff, 0xc1, 0xb1, 0xa1, 0xff -+ -+}; -+ -+/* 2x2 32bpp ARGB bmp image */ -+static const BYTE test_bmp_32bpp_argb[] = -+{ -+ 0x42, 0x4d, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, -+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xb0, 0xc0, 0x00, 0xa1, 0xb1, 0xc1, 0x00, 0xa2, 0xb2, -+ 0xc2, 0x00, 0xa3, 0xb3, 0xc3, 0x01 -+}; -+static const BYTE test_bmp_32bpp_argb_data[] = -+{ -+ 0xc2, 0xb2, 0xa2, 0xff, 0xc3, 0xb3, 0xa3, 0xff, 0xc0, 0xb0, 0xa0, 0xff, 0xc1, 0xb1, 0xa1, 0xff -+ -+}; -+ -+/* 1x1 8bpp gray png image */ -+static const BYTE test_png_8bpp_gray[] = -+{ -+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, -+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x7e, 0x9b, -+ 0x55, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, 0x41, 0x54, 0x08, 0xd7, 0x63, 0xf8, 0x0f, 0x00, 0x01, -+ 0x01, 0x01, 0x00, 0x1b, 0xb6, 0xee, 0x56, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, -+ 0x42, 0x60, 0x82 -+}; -+static const BYTE test_png_8bpp_gray_data[] = -+{ -+ 0xff, 0xff, 0xff, 0xff -+}; -+ -+/* 1x1 jpg image */ -+static const BYTE test_jpg[] = -+{ -+ 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x01, 0x2c, -+ 0x01, 0x2c, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x05, 0x03, 0x04, 0x04, 0x04, 0x03, 0x05, -+ 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x07, 0x0c, 0x08, 0x07, 0x07, 0x07, 0x07, 0x0f, 0x0b, -+ 0x0b, 0x09, 0x0c, 0x11, 0x0f, 0x12, 0x12, 0x11, 0x0f, 0x11, 0x11, 0x13, 0x16, 0x1c, 0x17, 0x13, -+ 0x14, 0x1a, 0x15, 0x11, 0x11, 0x18, 0x21, 0x18, 0x1a, 0x1d, 0x1d, 0x1f, 0x1f, 0x1f, 0x13, 0x17, -+ 0x22, 0x24, 0x22, 0x1e, 0x24, 0x1c, 0x1e, 0x1f, 0x1e, 0xff, 0xdb, 0x00, 0x43, 0x01, 0x05, 0x05, -+ 0x05, 0x07, 0x06, 0x07, 0x0e, 0x08, 0x08, 0x0e, 0x1e, 0x14, 0x11, 0x14, 0x1e, 0x1e, 0x1e, 0x1e, -+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, -+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, -+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0xff, 0xc0, -+ 0x00, 0x11, 0x08, 0x00, 0x01, 0x00, 0x01, 0x03, 0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, -+ 0x01, 0xff, 0xc4, 0x00, 0x15, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xc4, 0x00, 0x14, 0x10, 0x01, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc4, -+ 0x00, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, -+ 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00, 0xb2, 0xc0, 0x07, 0xff, 0xd9 -+}; -+static const BYTE test_jpg_data[] = -+{ -+ 0xff, 0xff, 0xff, 0xff -+}; -+ -+/* 1x1 gif image */ -+static const BYTE test_gif[] = -+{ -+ 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, -+ 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x44, -+ 0x01, 0x00, 0x3b -+}; -+static const BYTE test_gif_data[] = -+{ -+ 0xff, 0xff, 0xff, 0xff -+}; -+ -+/* 1x1 tiff image */ -+static const BYTE test_tiff[] = -+{ -+ 0x49, 0x49, 0x2a, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfe, 0x00, -+ 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0x02, 0x01, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0xd2, 0x00, 0x00, 0x00, 0x03, 0x01, -+ 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x01, 0x02, 0x00, 0x1b, 0x00, 0x00, 0x00, 0xd8, 0x00, -+ 0x00, 0x00, 0x11, 0x01, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x12, 0x01, -+ 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x15, 0x01, 0x03, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x16, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, -+ 0x00, 0x00, 0x17, 0x01, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1a, 0x01, -+ 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x05, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x1c, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0x28, 0x01, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x2f, 0x68, 0x6f, 0x6d, 0x65, 0x2f, 0x6d, 0x65, -+ 0x68, 0x2f, 0x44, 0x65, 0x73, 0x6b, 0x74, 0x6f, 0x70, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, -+ 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, -+ 0x00, 0x00, 0x00, 0x01 -+}; -+static const BYTE test_tiff_data[] = -+{ -+ 0x00, 0x00, 0x00, 0xff -+}; -+ -+/* 1x1 alpha dds image */ -+static const BYTE test_dds_alpha[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xff -+}; -+static const BYTE test_dds_alpha_data[] = -+{ -+ 0xff -+}; -+ -+/* 1x1 luminance dds image */ -+static const BYTE test_dds_luminance[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x82 -+}; -+static const BYTE test_dds_luminance_data[] = -+{ -+ 0x82, 0x82, 0x82, 0xff -+}; -+ -+/* 1x1 16bpp dds image */ -+static const BYTE test_dds_16bpp[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, -+ 0xe0, 0x03, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x0e, 0x42 -+}; -+static const BYTE test_dds_16bpp_data[] = -+{ -+ 0x84, 0x84, 0x73, 0xff -+}; -+ -+/* 1x1 24bpp dds image */ -+static const BYTE test_dds_24bpp[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, -+ 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x70, 0x81, 0x83 -+}; -+static const BYTE test_dds_24bpp_data[] = -+{ -+ 0x83, 0x81, 0x70, 0xff -+}; -+ -+/* 1x1 32bpp dds image */ -+static const BYTE test_dds_32bpp[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, -+ 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x70, 0x81, 0x83, 0xff -+}; -+static const BYTE test_dds_32bpp_data[] = -+{ -+ 0x83, 0x81, 0x70, 0xff -+}; -+ -+/* 1x1 64bpp dds image */ -+static const BYTE test_dds_64bpp[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x83, 0x83, 0x81, 0x81, 0x70, 0x70, 0xff, 0xff -+}; -+static const BYTE test_dds_64bpp_data[] = -+{ -+ 0x83, 0x83, 0x81, 0x81, 0x70, 0x70, 0xff, 0xff -+}; -+ -+/* 1x1 96bpp dds image */ -+static const BYTE test_dds_96bpp[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x31, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x84, 0x83, 0x03, 0x3f, 0x82, 0x81, 0x01, 0x3f, 0xe2, 0xe0, 0xe0, 0x3e -+}; -+static const BYTE test_dds_96bpp_data[] = -+{ -+ 0x84, 0x83, 0x03, 0x3f, 0x82, 0x81, 0x01, 0x3f, 0xe2, 0xe0, 0xe0, 0x3e -+}; -+ -+/* 1x1 128bpp dds image */ -+static const BYTE test_dds_128bpp[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x84, 0x83, 0x03, 0x3f, 0x82, 0x81, 0x01, 0x3f, 0xe2, 0xe0, 0xe0, 0x3e, 0x00, 0x00, 0x80, 0x3f -+}; -+static const BYTE test_dds_128bpp_data[] = -+{ -+ 0x84, 0x83, 0x03, 0x3f, 0x82, 0x81, 0x01, 0x3f, 0xe2, 0xe0, 0xe0, 0x3e, 0x00, 0x00, 0x80, 0x3f -+ -+}; -+ -+/* 4x4 DXT1 dds image */ -+static const BYTE test_dds_dxt1[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x2a, 0x31, 0xf5, 0xbc, 0xe3, 0x6e, 0x2a, 0x3a -+}; -+static const BYTE test_dds_dxt1_data[] = -+{ -+ 0x2a, 0x31, 0xf5, 0xbc, 0xe3, 0x6e, 0x2a, 0x3a -+}; -+ -+/* 4x8 DXT1 dds image */ -+static const BYTE test_dds_dxt1_4x8[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x92, 0xce, 0x09, 0x7a, 0x5d, 0xdd, 0xa7, 0x26, 0x55, 0xde, 0xaf, 0x52, 0xbc, 0xf8, 0x6c, 0x44, -+ 0x53, 0xbd, 0x8b, 0x72, 0x55, 0x33, 0x88, 0xaa, 0xb2, 0x9c, 0x6c, 0x93, 0x55, 0x00, 0x55, 0x00, -+ 0x0f, 0x9c, 0x0f, 0x9c, 0x00, 0x00, 0x00, 0x00, -+}; -+static const BYTE test_dds_dxt1_4x8_data[] = -+{ -+ 0x92, 0xce, 0x09, 0x7a, 0x5d, 0xdd, 0xa7, 0x26, 0x55, 0xde, 0xaf, 0x52, 0xbc, 0xf8, 0x6c, 0x44, -+}; -+ -+/* 4x4 DXT2 dds image */ -+static const BYTE test_dds_dxt2[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xde, 0xc4, 0x10, 0x2f, 0xbf, 0xff, 0x7b, -+ 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x53, 0x00, 0x00, 0x52, 0x52, 0x55, 0x55, -+ 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0x59, 0x00, 0x00, 0x54, 0x55, 0x55, 0x55 -+}; -+static const BYTE test_dds_dxt2_data[] = -+{ -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xde, 0xc4, 0x10, 0x2f, 0xbf, 0xff, 0x7b -+ -+}; -+ -+/* 1x3 DXT3 dds image */ -+static const BYTE test_dds_dxt3[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0a, 0x00, 0x03, 0x00, 0x00, 0x00, -+ 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x92, 0x38, 0x84, 0x00, 0xff, 0x55, 0xff, -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x53, 0x8b, 0x53, 0x8b, 0x00, 0x00, 0x00, 0x00 -+}; -+static const BYTE test_dds_dxt3_data[] = -+{ -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4e, 0x92, 0xd6, 0x83, 0x00, 0xaa, 0x55, 0x55 -+ -+}; -+ -+/* 4x4 DXT4 dds image */ -+static const BYTE test_dds_dxt4[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xde, 0xc4, 0x10, 0x2f, 0xbf, 0xff, 0x7b, -+ 0xff, 0x00, 0x40, 0x02, 0x24, 0x49, 0x92, 0x24, 0x57, 0x53, 0x00, 0x00, 0x52, 0x52, 0x55, 0x55, -+ 0xff, 0x00, 0x48, 0x92, 0x24, 0x49, 0x92, 0x24, 0xce, 0x59, 0x00, 0x00, 0x54, 0x55, 0x55, 0x55 -+}; -+static const BYTE test_dds_dxt4_data[] = -+{ -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xde, 0xc4, 0x10, 0x2f, 0xbf, 0xff, 0x7b -+ -+}; -+ -+/* 4x2 DXT5 dds image */ -+static const BYTE test_dds_dxt5[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x87, 0x0f, 0x78, 0x05, 0x05, 0x50, 0x50 -+}; -+static const BYTE test_dds_dxt5_data[] = -+{ -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x87, 0x0f, 0x78, 0x05, 0x05, 0x05, 0x05 -+ -+}; -+ -+/* 8x8 DXT5 dds image */ -+static const BYTE test_dds_dxt5_8x8[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x00, -+ 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x8a, 0x72, 0x39, 0x5e, 0x5e, 0xfa, 0xa8, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xd7, 0xd5, 0x4a, 0x2d, 0x2d, 0xad, 0xfd, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9a, 0x73, 0x83, 0xa0, 0xf0, 0x78, 0x78, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x5b, 0x06, 0x19, 0x00, 0xe8, 0x78, 0x58, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0xbe, 0x8c, 0x49, 0x35, 0xb5, 0xff, 0x7f, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x84, 0xab, 0x59, 0x11, 0xff, 0x11, 0xff, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x6a, 0xf0, 0x6a, 0x00, 0x00, 0x00, 0x00, -+}; -+static const BYTE test_dds_dxt5_8x8_data[] = -+{ -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x8a, 0x72, 0x39, 0x5e, 0x5e, 0xfa, 0xa8, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xd7, 0xd5, 0x4a, 0x2d, 0x2d, 0xad, 0xfd, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9a, 0x73, 0x83, 0xa0, 0xf0, 0x78, 0x78, -+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x5b, 0x06, 0x19, 0x00, 0xe8, 0x78, 0x58, -+}; -+ -+/* 4x4 BC4 dds image */ -+static const BYTE test_dds_bc4[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x42, 0x43, 0x34, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xd9, 0x15, 0xbc, 0x41, 0x5b, 0xa3, 0x3d, 0x3a, 0x8f, 0x3d, 0x45, 0x81, 0x20, 0x45, 0x81, 0x20, -+ 0x6f, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -+}; -+static const BYTE test_dds_bc4_data[] = -+{ -+ 0xd9, 0x15, 0xbc, 0x41, 0x5b, 0xa3, 0x3d, 0x3a -+}; -+ -+/* 6x3 BC5 dds image */ -+static const BYTE test_dds_bc5[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0a, 0x00, 0x03, 0x00, 0x00, 0x00, -+ 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x42, 0x43, 0x35, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x9f, 0x28, 0x73, 0xac, 0xd5, 0x80, 0xaa, 0xd5, 0x70, 0x2c, 0x4e, 0xd6, 0x76, 0x1d, 0xd6, 0x76, -+ 0xd5, 0x0f, 0xc3, 0x50, 0x96, 0xcf, 0x53, 0x96, 0xdf, 0x16, 0xc3, 0x50, 0x96, 0xcf, 0x53, 0x96, -+ 0x83, 0x55, 0x08, 0x83, 0x30, 0x08, 0x83, 0x30, 0x79, 0x46, 0x31, 0x1c, 0xc3, 0x31, 0x1c, 0xc3, -+ 0x6d, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -+}; -+static const BYTE test_dds_bc5_data[] = -+{ -+ 0x95, 0x35, 0xe2, 0xa3, 0xf5, 0xd2, 0x28, 0x68, 0x65, 0x32, 0x7c, 0x4e, 0xdb, 0xe4, 0x56, 0x0a, -+ 0xb9, 0x33, 0xaf, 0xf0, 0x52, 0xbe, 0xed, 0x27, 0xb4, 0x2e, 0xa6, 0x60, 0x4e, 0xb6, 0x5d, 0x3f -+ -+}; -+ -+/* 4x4 DXT1 cube map */ -+static const BYTE test_dds_cube[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, 0x32, 0x96, 0x0b, 0x7b, 0xcc, 0x55, 0xcc, 0x55, -+ 0x0e, 0x84, 0x0e, 0x84, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, -+ 0x32, 0x96, 0x0b, 0x7b, 0xcc, 0x55, 0xcc, 0x55, 0x0e, 0x84, 0x0e, 0x84, 0x00, 0x00, 0x00, 0x00, -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, 0x32, 0x96, 0x0b, 0x7b, 0xcc, 0x55, 0xcc, 0x55, -+ 0x0e, 0x84, 0x0e, 0x84, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, -+ 0x32, 0x96, 0x0b, 0x7b, 0xcc, 0x55, 0xcc, 0x55, 0x0e, 0x84, 0x0e, 0x84, 0x00, 0x00, 0x00, 0x00, -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, 0x32, 0x96, 0x0b, 0x7b, 0xcc, 0x55, 0xcc, 0x55, -+ 0x0e, 0x84, 0x0e, 0x84, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, -+ 0x32, 0x96, 0x0b, 0x7b, 0xcc, 0x55, 0xcc, 0x55, 0x0e, 0x84, 0x0e, 0x84, 0x00, 0x00, 0x00, 0x00 -+}; -+static const BYTE test_dds_cube_data[] = -+{ -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7, -+ 0xf5, 0xa7, 0x08, 0x69, 0x74, 0xc0, 0xbf, 0xd7 -+}; -+ -+/* 4x4x2 DXT3 volume dds, 2 mipmaps */ -+static const BYTE test_dds_volume[] = -+{ -+ 0x44, 0x44, 0x53, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x07, 0x10, 0x8a, 0x00, 0x04, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, -+ 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00, -+ 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x87, 0x0f, 0x78, 0x05, 0x05, 0x50, 0x50, -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x87, 0x0f, 0x78, 0x05, 0x05, 0x50, 0x50, -+ 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x7e, 0xcf, 0x79, 0x01, 0x54, 0x5c, 0x5c, -+ 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x84, 0xef, 0x7b, 0xaa, 0xab, 0xab, 0xab -+}; -+static const BYTE test_dds_volume_data[] = -+{ -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x87, 0x0f, 0x78, 0x05, 0x05, 0x50, 0x50, -+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x87, 0x0f, 0x78, 0x05, 0x05, 0x50, 0x50, -+}; -+ -+/* -+ * 4x4x4 24-bit volume dds, 3 mipmaps. Level 0 is red, level 1 is green, level 2 is -+ * blue. -+ */ -+static const uint8_t dds_volume_24bit_4_4_4[] = -+{ -+ 0x44,0x44,0x53,0x20,0x7c,0x00,0x00,0x00,0x0f,0x10,0x82,0x00,0x04,0x00,0x00,0x00, -+ 0x04,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00, -+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00, -+ 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x40,0x00, -+ 0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0xff,0x00,0x00 -+}; -+ -+/* -+ * 8x8 24-bit dds, 4 mipmaps. Level 0 is red, level 1 is green, level 2 is -+ * blue, and level 3 is black. -+ */ -+static const uint8_t dds_24bit_8_8[] = -+{ -+ 0x44,0x44,0x53,0x20,0x7c,0x00,0x00,0x00,0x07,0x10,0x0a,0x00,0x08,0x00,0x00,0x00, -+ 0x08,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00, -+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00, -+ 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x40,0x00, -+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff, -+ 0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00, -+ 0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00 -+}; -+ -+/* 1x1 wmp image */ -+static const BYTE test_wmp[] = -+{ -+ 0x49, 0x49, 0xbc, 0x01, 0x20, 0x00, 0x00, 0x00, 0x24, 0xc3, 0xdd, 0x6f, 0x03, 0x4e, 0xfe, 0x4b, -+ 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x08, 0x00, 0x01, 0xbc, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0xbc, -+ 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbc, 0x04, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x81, 0xbc, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0x82, 0xbc, 0x0b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x06, 0xc0, 0x42, 0x83, 0xbc, -+ 0x0b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x06, 0xc0, 0x42, 0xc0, 0xbc, 0x04, 0x00, 0x01, 0x00, -+ 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0xc1, 0xbc, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x92, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x4d, 0x50, 0x48, 0x4f, 0x54, 0x4f, 0x00, 0x11, 0x45, -+ 0xc0, 0x71, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xc0, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xc0, -+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x25, 0xff, 0xff, 0x00, 0x00, 0x01, -+ 0x01, 0xc8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x10, 0x10, 0xa6, 0x18, 0x8c, 0x21, -+ 0x00, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x4e, 0x0f, 0x3a, 0x4c, 0x94, 0x9d, 0xba, 0x79, 0xe7, 0x38, -+ 0x4c, 0xcf, 0x14, 0xc3, 0x43, 0x91, 0x88, 0xfb, 0xdc, 0xe0, 0x7c, 0x34, 0x70, 0x9b, 0x28, 0xa9, -+ 0x18, 0x74, 0x62, 0x87, 0x8e, 0xe4, 0x68, 0x5f, 0xb9, 0xcc, 0x0e, 0xe1, 0x8c, 0x76, 0x3a, 0x9b, -+ 0x82, 0x76, 0x71, 0x13, 0xde, 0x50, 0xd4, 0x2d, 0xc2, 0xda, 0x1e, 0x3b, 0xa6, 0xa1, 0x62, 0x7b, -+ 0xca, 0x1a, 0x85, 0x4b, 0x6e, 0x74, 0xec, 0x60 -+}; -+static const BYTE test_wmp_data[] = -+{ -+ 0xff, 0xff, 0xff, 0xff -+}; -+ -+static const struct test_image -+{ -+ const BYTE *data; -+ unsigned int size; -+ const BYTE *expected_data; -+ D3DX11_IMAGE_INFO expected_info; -+ D3D11_SRV_DIMENSION expected_srv_dimension; -+} -+test_image[] = -+{ -+ { -+ test_bmp_1bpp, sizeof(test_bmp_1bpp), test_bmp_1bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_BMP}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_bmp_4bpp, sizeof(test_bmp_4bpp), test_bmp_4bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_BMP}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_bmp_8bpp, sizeof(test_bmp_8bpp), test_bmp_8bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_BMP}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_bmp_16bpp, sizeof(test_bmp_16bpp), test_bmp_16bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_BMP}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_bmp_24bpp, sizeof(test_bmp_24bpp), test_bmp_24bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_BMP}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_bmp_32bpp_xrgb, sizeof(test_bmp_32bpp_xrgb), test_bmp_32bpp_xrgb_data, -+ {2, 2, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_BMP}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_bmp_32bpp_argb, sizeof(test_bmp_32bpp_argb), test_bmp_32bpp_argb_data, -+ {2, 2, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_BMP}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_png_8bpp_gray, sizeof(test_png_8bpp_gray), test_png_8bpp_gray_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_PNG}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_jpg, sizeof(test_jpg), test_jpg_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_JPG}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_gif, sizeof(test_gif), test_gif_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_GIF}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_tiff, sizeof(test_tiff), test_tiff_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_TIFF}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_alpha, sizeof(test_dds_alpha), test_dds_alpha_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_luminance, sizeof(test_dds_luminance), test_dds_luminance_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_16bpp, sizeof(test_dds_16bpp), test_dds_16bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_24bpp, sizeof(test_dds_24bpp), test_dds_24bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), test_dds_32bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_64bpp, sizeof(test_dds_64bpp), test_dds_64bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R16G16B16A16_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_96bpp, sizeof(test_dds_96bpp), test_dds_96bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R32G32B32_FLOAT, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_128bpp, sizeof(test_dds_128bpp), test_dds_128bpp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R32G32B32A32_FLOAT, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_dxt1, sizeof(test_dds_dxt1), test_dds_dxt1_data, -+ {4, 4, 1, 1, 1, 0, DXGI_FORMAT_BC1_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_dxt1_4x8, sizeof(test_dds_dxt1_4x8), test_dds_dxt1_4x8_data, -+ {4, 8, 1, 1, 4, 0, DXGI_FORMAT_BC1_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_dxt2, sizeof(test_dds_dxt2), test_dds_dxt2_data, -+ {4, 4, 1, 1, 3, 0, DXGI_FORMAT_BC2_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_dxt3, sizeof(test_dds_dxt3), test_dds_dxt3_data, -+ {1, 3, 1, 1, 2, 0, DXGI_FORMAT_BC2_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_dxt4, sizeof(test_dds_dxt4), test_dds_dxt4_data, -+ {4, 4, 1, 1, 3, 0, DXGI_FORMAT_BC3_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_dxt5, sizeof(test_dds_dxt5), test_dds_dxt5_data, -+ {4, 2, 1, 1, 1, 0, DXGI_FORMAT_BC3_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_dxt5_8x8, sizeof(test_dds_dxt5_8x8), test_dds_dxt5_8x8_data, -+ {8, 8, 1, 1, 4, 0, DXGI_FORMAT_BC3_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_bc4, sizeof(test_dds_bc4), test_dds_bc4_data, -+ {4, 4, 1, 1, 3, 0, DXGI_FORMAT_BC4_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_bc5, sizeof(test_dds_bc5), test_dds_bc5_data, -+ {6, 3, 1, 1, 3, 0, DXGI_FORMAT_BC5_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+ { -+ test_dds_cube, sizeof(test_dds_cube), test_dds_cube_data, -+ {4, 4, 1, 6, 3, 0x4, DXGI_FORMAT_BC1_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURECUBE -+ }, -+ { -+ test_dds_volume, sizeof(test_dds_volume), test_dds_volume_data, -+ {4, 4, 2, 1, 3, 0, DXGI_FORMAT_BC2_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE3D, D3DX11_IFF_DDS}, -+ D3D11_SRV_DIMENSION_TEXTURE3D -+ }, -+ { -+ test_wmp, sizeof(test_wmp), test_wmp_data, -+ {1, 1, 1, 1, 1, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3DX11_IFF_WMP}, -+ D3D11_SRV_DIMENSION_TEXTURE2D -+ }, -+}; -+ -+static const struct test_image_load_info -+{ -+ const uint8_t *data; -+ uint32_t size; -+ D3DX11_IMAGE_LOAD_INFO load_info; -+ HRESULT expected_hr; -+ -+ D3D11_SRV_DIMENSION expected_srv_dimension; -+ D3D11_RESOURCE_DIMENSION expected_type; -+ union -+ { -+ D3D11_TEXTURE2D_DESC desc_2d; -+ D3D11_TEXTURE3D_DESC desc_3d; -+ } expected_resource_desc; -+ D3DX11_IMAGE_INFO expected_info; -+ BOOL todo_resource_desc; -+} -+test_image_load_info[] = -+{ -+ /* -+ * FirstMipLevel set to 1 - Does not match D3DX_SKIP_DDS_MIP_LEVELS -+ * behavior from d3dx9, image info values represent mip level 0, and -+ * texture values are pulled from this. The texture data is loaded -+ * starting from the specified mip level, however. -+ */ -+ { -+ dds_volume_24bit_4_4_4, sizeof(dds_volume_24bit_4_4_4), -+ { D3DX11_FROM_FILE, D3DX11_DEFAULT, 0, 1, D3DX11_DEFAULT, (D3D11_USAGE)D3DX11_DEFAULT, -+ D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT }, -+ S_OK, D3D11_SRV_DIMENSION_TEXTURE3D, D3D11_RESOURCE_DIMENSION_TEXTURE3D, -+ { .desc_3d = { 4, 4, 4, 3, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0 } }, -+ { 4, 4, 4, 1, 3, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE3D, D3DX11_IFF_DDS }, -+ }, -+ /* -+ * Autogen mips misc flag specified. In the case of a cube texture image, -+ * the autogen mips flag is OR'd against D3D11_RESOURCE_MISC_TEXTURECUBE, -+ * even if it isn't specified. -+ */ -+ { -+ test_dds_cube, sizeof(test_dds_cube), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, (D3D11_USAGE)D3DX11_DEFAULT, -+ (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET), D3DX11_DEFAULT, D3D11_RESOURCE_MISC_GENERATE_MIPS, -+ DXGI_FORMAT_R8G8B8A8_UNORM, D3DX11_DEFAULT, D3DX11_DEFAULT }, -+ S_OK, D3D11_SRV_DIMENSION_TEXTURECUBE, D3D11_RESOURCE_DIMENSION_TEXTURE2D, -+ { .desc_2d = { 4, 4, 3, 6, DXGI_FORMAT_R8G8B8A8_UNORM, { 1, 0 }, D3D11_USAGE_DEFAULT, -+ (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET), 0, -+ (D3D11_RESOURCE_MISC_GENERATE_MIPS | D3D11_RESOURCE_MISC_TEXTURECUBE) } }, -+ { 4, 4, 1, 6, 3, DDS_RESOURCE_MISC_TEXTURECUBE, DXGI_FORMAT_BC1_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, -+ D3DX11_IFF_DDS }, -+ }, -+ /* -+ * Even with the autogen mips misc flag specified, the mip levels argument -+ * of load info is respected. -+ */ -+ { -+ test_dds_cube, sizeof(test_dds_cube), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, 2, (D3D11_USAGE)D3DX11_DEFAULT, -+ (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET), D3DX11_DEFAULT, D3D11_RESOURCE_MISC_GENERATE_MIPS, -+ DXGI_FORMAT_R8G8B8A8_UNORM, D3DX11_DEFAULT, D3DX11_DEFAULT }, -+ S_OK, D3D11_SRV_DIMENSION_TEXTURECUBE, D3D11_RESOURCE_DIMENSION_TEXTURE2D, -+ { .desc_2d = { 4, 4, 2, 6, DXGI_FORMAT_R8G8B8A8_UNORM, { 1, 0 }, D3D11_USAGE_DEFAULT, -+ (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET), 0, -+ (D3D11_RESOURCE_MISC_GENERATE_MIPS | D3D11_RESOURCE_MISC_TEXTURECUBE) } }, -+ { 4, 4, 1, 6, 3, DDS_RESOURCE_MISC_TEXTURECUBE, DXGI_FORMAT_BC1_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, -+ D3DX11_IFF_DDS }, -+ }, -+}; -+ -+static const struct test_invalid_image_load_info -+{ -+ const uint8_t *data; -+ uint32_t size; -+ D3DX11_IMAGE_LOAD_INFO load_info; -+ HRESULT expected_hr; -+ HRESULT expected_process_hr; -+ HRESULT expected_create_device_object_hr; -+ BOOL todo_hr; -+ BOOL todo_process_hr; -+ BOOL todo_create_device_object_hr; -+} -+test_invalid_image_load_info[] = -+{ -+ /* -+ * A depth value that isn't D3DX11_FROM_FILE/D3DX11_DEFAULT/0 on a 2D -+ * texture results in failure. -+ */ -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, 2, D3DX11_DEFAULT, D3DX11_DEFAULT, (D3D11_USAGE)D3DX11_DEFAULT, -+ D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT }, -+ E_FAIL, E_FAIL, -+ }, -+ /* Invalid filter value. */ -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, (D3D11_USAGE)D3DX11_DEFAULT, -+ D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, 7, D3DX11_DEFAULT }, -+ D3DERR_INVALIDCALL, D3DERR_INVALIDCALL, -+ }, -+ /* Invalid mipfilter value, only checked if mips are generated. */ -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, (D3D11_USAGE)D3DX11_DEFAULT, -+ D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, 7 }, -+ S_OK, S_OK, S_OK -+ }, -+ /* Invalid mipfilter value. */ -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), -+ { 2, 2, D3DX11_DEFAULT, D3DX11_DEFAULT, 2, (D3D11_USAGE)D3DX11_DEFAULT, -+ D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, 7 }, -+ D3DERR_INVALIDCALL, D3DERR_INVALIDCALL, -+ }, -+ /* -+ * Usage/BindFlags/CpuAccessFlags are validated in the call to -+ * CreateDeviceObject(). -+ */ -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3D11_CPU_ACCESS_READ, D3D11_USAGE_DYNAMIC, -+ D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT }, -+ E_INVALIDARG, S_OK, E_INVALIDARG, -+ }, -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3D11_USAGE_DEFAULT, -+ D3D11_BIND_DEPTH_STENCIL, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT }, -+ E_INVALIDARG, S_OK, E_INVALIDARG, -+ }, -+ /* -+ * D3D11_RESOURCE_MISC_GENERATE_MIPS requires binding as a shader resource -+ * and a render target. -+ */ -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3D11_USAGE_DEFAULT, -+ D3DX11_DEFAULT, D3DX11_DEFAULT, D3D11_RESOURCE_MISC_GENERATE_MIPS, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT }, -+ E_INVALIDARG, S_OK, E_INVALIDARG, -+ }, -+ /* Can't set the cube texture flag if the image isn't a cube texture. */ -+ { -+ test_dds_32bpp, sizeof(test_dds_32bpp), -+ { D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3D11_USAGE_DEFAULT, -+ D3DX11_DEFAULT, D3DX11_DEFAULT, D3D11_RESOURCE_MISC_TEXTURECUBE, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT }, -+ E_INVALIDARG, S_OK, E_INVALIDARG -+ }, -+}; -+ - #define check_image_info_values(info, width, height, depth, array_size, mip_levels, misc_flags, format, resource_dimension, \ - image_file_format, wine_todo) \ - check_image_info_values_(__LINE__, info, width, height, depth, array_size, mip_levels, misc_flags, format, resource_dimension, \ -@@ -425,6 +1428,568 @@ static inline void check_image_info_values_(unsigned int line, const D3DX11_IMAG - image_file_format, info->ImageFileFormat); - } - -+#define check_texture2d_desc_values(desc, width, height, mip_levels, array_size, format, sample_count, sample_quality, \ -+ usage, bind_flags, cpu_access_flags, misc_flags, wine_todo) \ -+ check_texture2d_desc_values_(__LINE__, desc, width, height, mip_levels, array_size, format, sample_count, sample_quality, \ -+ usage, bind_flags, cpu_access_flags, misc_flags, wine_todo) -+static inline void check_texture2d_desc_values_(uint32_t line, const D3D11_TEXTURE2D_DESC *desc, uint32_t width, -+ uint32_t height, uint32_t mip_levels, uint32_t array_size, DXGI_FORMAT format, uint32_t sample_count, -+ uint32_t sample_quality, D3D11_USAGE usage, uint32_t bind_flags, uint32_t cpu_access_flags, uint32_t misc_flags, -+ BOOL wine_todo) -+{ -+ const D3D11_TEXTURE2D_DESC expected_desc = { width, height, mip_levels, array_size, format, { sample_count, sample_quality }, -+ usage, bind_flags, cpu_access_flags, misc_flags }; -+ BOOL matched; -+ -+ matched = !memcmp(&expected_desc, desc, sizeof(*desc)); -+ todo_wine_if(wine_todo) ok_(__FILE__, line)(matched, "Got unexpected 2D texture desc values.\n"); -+ if (matched) -+ return; -+ -+ todo_wine_if(wine_todo && desc->Width != width) -+ ok_(__FILE__, line)(desc->Width == width, "Expected width %u, got %u.\n", width, desc->Width); -+ todo_wine_if(wine_todo && desc->Height != height) -+ ok_(__FILE__, line)(desc->Height == height, "Expected height %u, got %u.\n", height, desc->Height); -+ todo_wine_if(wine_todo && desc->ArraySize != array_size) -+ ok_(__FILE__, line)(desc->ArraySize == array_size, "Expected array_size %u, got %u.\n", array_size, -+ desc->ArraySize); -+ todo_wine_if(wine_todo && desc->MipLevels != mip_levels) -+ ok_(__FILE__, line)(desc->MipLevels == mip_levels, "Expected mip_levels %u, got %u.\n", mip_levels, -+ desc->MipLevels); -+ ok_(__FILE__, line)(desc->Format == format, "Expected texture format %#x, got %#x.\n", format, desc->Format); -+ todo_wine_if(wine_todo && desc->SampleDesc.Count != sample_count) -+ ok_(__FILE__, line)(desc->SampleDesc.Count == sample_count, "Expected sample_count %u, got %u.\n", sample_count, -+ desc->SampleDesc.Count); -+ todo_wine_if(wine_todo && desc->SampleDesc.Quality != sample_quality) -+ ok_(__FILE__, line)(desc->SampleDesc.Quality == sample_quality, "Expected sample_quality %u, got %u.\n", sample_quality, -+ desc->SampleDesc.Quality); -+ todo_wine_if(wine_todo && desc->Usage != usage) -+ ok_(__FILE__, line)(desc->Usage == usage, "Expected usage %u, got %u.\n", usage, -+ desc->Usage); -+ todo_wine_if(wine_todo && desc->BindFlags != bind_flags) -+ ok_(__FILE__, line)(desc->BindFlags == bind_flags, "Expected bind_flags %#x, got %#x.\n", bind_flags, -+ desc->BindFlags); -+ todo_wine_if(wine_todo && desc->CPUAccessFlags != cpu_access_flags) -+ ok_(__FILE__, line)(desc->CPUAccessFlags == cpu_access_flags, "Expected cpu_access_flags %#x, got %#x.\n", -+ cpu_access_flags, desc->CPUAccessFlags); -+ todo_wine_if(wine_todo && desc->MiscFlags != misc_flags) -+ ok_(__FILE__, line)(desc->MiscFlags == misc_flags, "Expected misc_flags %#x, got %#x.\n", misc_flags, -+ desc->MiscFlags); -+} -+ -+#define check_texture3d_desc_values(desc, width, height, depth, mip_levels, format, usage, bind_flags, cpu_access_flags, \ -+ misc_flags, wine_todo) \ -+ check_texture3d_desc_values_(__LINE__, desc, width, height, depth, mip_levels, format, usage, bind_flags, \ -+ cpu_access_flags, misc_flags, wine_todo) -+static inline void check_texture3d_desc_values_(uint32_t line, const D3D11_TEXTURE3D_DESC *desc, uint32_t width, -+ uint32_t height, uint32_t depth, uint32_t mip_levels, DXGI_FORMAT format, D3D11_USAGE usage, uint32_t bind_flags, -+ uint32_t cpu_access_flags, uint32_t misc_flags, BOOL wine_todo) -+{ -+ const D3D11_TEXTURE3D_DESC expected_desc = { width, height, depth, mip_levels, format, usage, bind_flags, -+ cpu_access_flags, misc_flags }; -+ BOOL matched; -+ -+ matched = !memcmp(&expected_desc, desc, sizeof(*desc)); -+ todo_wine_if(wine_todo) ok_(__FILE__, line)(matched, "Got unexpected 3D texture desc values.\n"); -+ if (matched) -+ return; -+ -+ todo_wine_if(wine_todo && desc->Width != width) -+ ok_(__FILE__, line)(desc->Width == width, "Expected width %u, got %u.\n", width, desc->Width); -+ todo_wine_if(wine_todo && desc->Height != height) -+ ok_(__FILE__, line)(desc->Height == height, "Expected height %u, got %u.\n", height, desc->Height); -+ todo_wine_if(wine_todo && desc->Depth != depth) -+ ok_(__FILE__, line)(desc->Depth == depth, "Expected depth %u, got %u.\n", depth, desc->Depth); -+ todo_wine_if(wine_todo && desc->MipLevels != mip_levels) -+ ok_(__FILE__, line)(desc->MipLevels == mip_levels, "Expected mip_levels %u, got %u.\n", mip_levels, -+ desc->MipLevels); -+ ok_(__FILE__, line)(desc->Format == format, "Expected texture format %#x, got %#x.\n", format, desc->Format); -+ todo_wine_if(wine_todo && desc->Usage != usage) -+ ok_(__FILE__, line)(desc->Usage == usage, "Expected usage %u, got %u.\n", usage, -+ desc->Usage); -+ todo_wine_if(wine_todo && desc->BindFlags != bind_flags) -+ ok_(__FILE__, line)(desc->BindFlags == bind_flags, "Expected bind_flags %#x, got %#x.\n", bind_flags, -+ desc->BindFlags); -+ todo_wine_if(wine_todo && desc->CPUAccessFlags != cpu_access_flags) -+ ok_(__FILE__, line)(desc->CPUAccessFlags == cpu_access_flags, "Expected cpu_access_flags %#x, got %#x.\n", -+ cpu_access_flags, desc->CPUAccessFlags); -+ todo_wine_if(wine_todo && desc->MiscFlags != misc_flags) -+ ok_(__FILE__, line)(desc->MiscFlags == misc_flags, "Expected misc_flags %#x, got %#x.\n", misc_flags, -+ desc->MiscFlags); -+} -+ -+/* -+ * Taken from the d3d11 tests. If there's a missing resource type or -+ * texture format checking function, check to see if it exists there first. -+ */ -+struct resource_readback -+{ -+ ID3D11Resource *resource; -+ D3D11_MAPPED_SUBRESOURCE map_desc; -+ ID3D11DeviceContext *immediate_context; -+ uint32_t width, height, depth, sub_resource_idx; -+}; -+ -+static void init_resource_readback(ID3D11Resource *resource, ID3D11Resource *readback_resource, -+ uint32_t width, uint32_t height, uint32_t depth, uint32_t sub_resource_idx, -+ ID3D11Device *device, struct resource_readback *rb) -+{ -+ HRESULT hr; -+ -+ rb->resource = readback_resource; -+ rb->width = width; -+ rb->height = height; -+ rb->depth = depth; -+ rb->sub_resource_idx = sub_resource_idx; -+ -+ ID3D11Device_GetImmediateContext(device, &rb->immediate_context); -+ -+ ID3D11DeviceContext_CopyResource(rb->immediate_context, rb->resource, resource); -+ if (FAILED(hr = ID3D11DeviceContext_Map(rb->immediate_context, -+ rb->resource, sub_resource_idx, D3D11_MAP_READ, 0, &rb->map_desc))) -+ { -+ trace("Failed to map resource, hr %#lx.\n", hr); -+ ID3D11Resource_Release(rb->resource); -+ rb->resource = NULL; -+ ID3D11DeviceContext_Release(rb->immediate_context); -+ rb->immediate_context = NULL; -+ } -+} -+ -+static void get_texture_readback(ID3D11Texture2D *texture, uint32_t sub_resource_idx, -+ struct resource_readback *rb) -+{ -+ D3D11_TEXTURE2D_DESC texture_desc; -+ ID3D11Resource *rb_texture; -+ uint32_t miplevel; -+ ID3D11Device *device; -+ HRESULT hr; -+ -+ memset(rb, 0, sizeof(*rb)); -+ -+ ID3D11Texture2D_GetDevice(texture, &device); -+ -+ ID3D11Texture2D_GetDesc(texture, &texture_desc); -+ texture_desc.Usage = D3D11_USAGE_STAGING; -+ texture_desc.BindFlags = 0; -+ texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; -+ texture_desc.MiscFlags = 0; -+ if (FAILED(hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, (ID3D11Texture2D **)&rb_texture))) -+ { -+ trace("Failed to create texture, hr %#lx.\n", hr); -+ ID3D11Device_Release(device); -+ return; -+ } -+ -+ miplevel = sub_resource_idx % texture_desc.MipLevels; -+ init_resource_readback((ID3D11Resource *)texture, rb_texture, -+ max(1, texture_desc.Width >> miplevel), -+ max(1, texture_desc.Height >> miplevel), -+ 1, sub_resource_idx, device, rb); -+ -+ ID3D11Device_Release(device); -+} -+ -+static void get_texture3d_readback(ID3D11Texture3D *texture, unsigned int sub_resource_idx, -+ struct resource_readback *rb) -+{ -+ D3D11_TEXTURE3D_DESC texture_desc; -+ ID3D11Resource *rb_texture; -+ unsigned int miplevel; -+ ID3D11Device *device; -+ HRESULT hr; -+ -+ memset(rb, 0, sizeof(*rb)); -+ -+ ID3D11Texture3D_GetDevice(texture, &device); -+ -+ ID3D11Texture3D_GetDesc(texture, &texture_desc); -+ texture_desc.Usage = D3D11_USAGE_STAGING; -+ texture_desc.BindFlags = 0; -+ texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; -+ texture_desc.MiscFlags = 0; -+ if (FAILED(hr = ID3D11Device_CreateTexture3D(device, &texture_desc, NULL, (ID3D11Texture3D **)&rb_texture))) -+ { -+ trace("Failed to create texture, hr %#lx.\n", hr); -+ ID3D11Device_Release(device); -+ return; -+ } -+ -+ miplevel = sub_resource_idx % texture_desc.MipLevels; -+ init_resource_readback((ID3D11Resource *)texture, rb_texture, -+ max(1, texture_desc.Width >> miplevel), -+ max(1, texture_desc.Height >> miplevel), -+ max(1, texture_desc.Depth >> miplevel), -+ sub_resource_idx, device, rb); -+ -+ ID3D11Device_Release(device); -+} -+ -+static void *get_readback_data(struct resource_readback *rb, -+ uint32_t x, uint32_t y, uint32_t z, unsigned byte_width) -+{ -+ return (uint8_t *)rb->map_desc.pData + z * rb->map_desc.DepthPitch + y * rb->map_desc.RowPitch + x * byte_width; -+} -+ -+static uint32_t get_readback_u32(struct resource_readback *rb, uint32_t x, uint32_t y, uint32_t z) -+{ -+ return *(uint32_t *)get_readback_data(rb, x, y, z, sizeof(uint32_t)); -+} -+ -+static uint32_t get_readback_color(struct resource_readback *rb, uint32_t x, uint32_t y, uint32_t z) -+{ -+ return get_readback_u32(rb, x, y, z); -+} -+ -+static void release_resource_readback(struct resource_readback *rb) -+{ -+ ID3D11DeviceContext_Unmap(rb->immediate_context, rb->resource, rb->sub_resource_idx); -+ ID3D11Resource_Release(rb->resource); -+ ID3D11DeviceContext_Release(rb->immediate_context); -+} -+ -+static BOOL compare_color(uint32_t c1, uint32_t c2, uint8_t max_diff) -+{ -+ return compare_uint(c1 & 0xff, c2 & 0xff, max_diff) -+ && compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff) -+ && compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff) -+ && compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff); -+} -+ -+#define check_readback_data_color(a, b, c, d) check_readback_data_color_(__LINE__, a, b, c, d) -+static void check_readback_data_color_(uint32_t line, struct resource_readback *rb, -+ const RECT *rect, uint32_t expected_color, uint8_t max_diff) -+{ -+ uint32_t x = 0, y = 0, z = 0, color = 0; -+ BOOL all_match = FALSE; -+ RECT default_rect; -+ -+ if (!rect) -+ { -+ SetRect(&default_rect, 0, 0, rb->width, rb->height); -+ rect = &default_rect; -+ } -+ -+ for (z = 0; z < rb->depth; ++z) -+ { -+ for (y = rect->top; y < rect->bottom; ++y) -+ { -+ for (x = rect->left; x < rect->right; ++x) -+ { -+ color = get_readback_color(rb, x, y, z); -+ if (!compare_color(color, expected_color, max_diff)) -+ goto done; -+ } -+ } -+ } -+ all_match = TRUE; -+ -+done: -+ ok_(__FILE__, line)(all_match, -+ "Got 0x%08x, expected 0x%08x at (%u, %u, %u), sub-resource %u.\n", -+ color, expected_color, x, y, z, rb->sub_resource_idx); -+} -+ -+#define check_texture_sub_resource_color(a, b, c, d, e) check_texture_sub_resource_color_(__LINE__, a, b, c, d, e) -+static void check_texture_sub_resource_color_(uint32_t line, ID3D11Texture2D *texture, -+ uint32_t sub_resource_idx, const RECT *rect, uint32_t expected_color, uint8_t max_diff) -+{ -+ struct resource_readback rb; -+ -+ get_texture_readback(texture, sub_resource_idx, &rb); -+ check_readback_data_color_(line, &rb, rect, expected_color, max_diff); -+ release_resource_readback(&rb); -+} -+ -+static void set_d3dx11_image_load_info(D3DX11_IMAGE_LOAD_INFO *info, uint32_t width, uint32_t height, uint32_t depth, -+ uint32_t first_mip_level, uint32_t mip_levels, D3D11_USAGE usage, uint32_t bind_flags, uint32_t cpu_access_flags, -+ uint32_t misc_flags, DXGI_FORMAT format, uint32_t filter, uint32_t mip_filter, D3DX11_IMAGE_INFO *src_info) -+{ -+ info->Width = width; -+ info->Height = height; -+ info->Depth = depth; -+ info->FirstMipLevel = first_mip_level; -+ info->MipLevels = mip_levels; -+ info->Usage = usage; -+ info->BindFlags = bind_flags; -+ info->CpuAccessFlags = cpu_access_flags; -+ info->MiscFlags = misc_flags; -+ info->Format = format; -+ info->Filter = filter; -+ info->MipFilter = mip_filter; -+ info->pSrcInfo = src_info; -+} -+ -+#define check_test_image_load_info_resource(resource, image_load_info) \ -+ check_test_image_load_info_resource_(__LINE__, resource, image_load_info) -+static void check_test_image_load_info_resource_(uint32_t line, ID3D11Resource *resource, -+ const struct test_image_load_info *image_load_info) -+{ -+ D3D11_RESOURCE_DIMENSION resource_dimension; -+ HRESULT hr; -+ -+ ID3D11Resource_GetType(resource, &resource_dimension); -+ ok(resource_dimension == image_load_info->expected_type, "Got unexpected ResourceDimension %u, expected %u.\n", -+ resource_dimension, image_load_info->expected_type); -+ -+ switch (resource_dimension) -+ { -+ case D3D11_RESOURCE_DIMENSION_TEXTURE2D: -+ { -+ const D3D11_TEXTURE2D_DESC *expected_desc_2d = &image_load_info->expected_resource_desc.desc_2d; -+ D3D11_TEXTURE2D_DESC desc_2d; -+ ID3D11Texture2D *tex_2d; -+ -+ hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture2D, (void **)&tex_2d); -+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); -+ ID3D11Texture2D_GetDesc(tex_2d, &desc_2d); -+ check_texture2d_desc_values_(line, &desc_2d, expected_desc_2d->Width, expected_desc_2d->Height, -+ expected_desc_2d->MipLevels, expected_desc_2d->ArraySize, expected_desc_2d->Format, -+ expected_desc_2d->SampleDesc.Count, expected_desc_2d->SampleDesc.Quality, expected_desc_2d->Usage, -+ expected_desc_2d->BindFlags, expected_desc_2d->CPUAccessFlags, expected_desc_2d->MiscFlags, -+ image_load_info->todo_resource_desc); -+ ID3D11Texture2D_Release(tex_2d); -+ break; -+ } -+ -+ case D3D11_RESOURCE_DIMENSION_TEXTURE3D: -+ { -+ const D3D11_TEXTURE3D_DESC *expected_desc_3d = &image_load_info->expected_resource_desc.desc_3d; -+ D3D11_TEXTURE3D_DESC desc_3d; -+ ID3D11Texture3D *tex_3d; -+ -+ hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture3D, (void **)&tex_3d); -+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); -+ ID3D11Texture3D_GetDesc(tex_3d, &desc_3d); -+ check_texture3d_desc_values_(line, &desc_3d, expected_desc_3d->Width, expected_desc_3d->Height, -+ expected_desc_3d->Depth, expected_desc_3d->MipLevels, expected_desc_3d->Format, expected_desc_3d->Usage, -+ expected_desc_3d->BindFlags, expected_desc_3d->CPUAccessFlags, expected_desc_3d->MiscFlags, -+ image_load_info->todo_resource_desc); -+ ID3D11Texture3D_Release(tex_3d); -+ break; -+ } -+ -+ default: -+ break; -+ } -+} -+ -+static void check_resource_info(ID3D11Resource *resource, const struct test_image *image, uint32_t line) -+{ -+ unsigned int expected_mip_levels, expected_width, expected_height, max_dimension; -+ D3D11_RESOURCE_DIMENSION resource_dimension; -+ D3D11_TEXTURE2D_DESC desc_2d; -+ D3D11_TEXTURE3D_DESC desc_3d; -+ ID3D11Texture2D *texture_2d; -+ ID3D11Texture3D *texture_3d; -+ HRESULT hr; -+ -+ expected_width = image->expected_info.Width; -+ expected_height = image->expected_info.Height; -+ if (is_block_compressed(image->expected_info.Format)) -+ { -+ expected_width = (expected_width + 3) & ~3; -+ expected_height = (expected_height + 3) & ~3; -+ } -+ expected_mip_levels = 0; -+ max_dimension = max(expected_width, expected_height); -+ while (max_dimension) -+ { -+ ++expected_mip_levels; -+ max_dimension >>= 1; -+ } -+ -+ ID3D11Resource_GetType(resource, &resource_dimension); -+ ok(resource_dimension == image->expected_info.ResourceDimension, -+ "Got unexpected ResourceDimension %u, expected %u.\n", -+ resource_dimension, image->expected_info.ResourceDimension); -+ -+ switch (resource_dimension) -+ { -+ case D3D11_RESOURCE_DIMENSION_TEXTURE2D: -+ hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture2D, (void **)&texture_2d); -+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); -+ ID3D11Texture2D_GetDesc(texture_2d, &desc_2d); -+ ok_(__FILE__, line)(desc_2d.Width == expected_width, -+ "Got unexpected Width %u, expected %u.\n", -+ desc_2d.Width, expected_width); -+ ok_(__FILE__, line)(desc_2d.Height == expected_height, -+ "Got unexpected Height %u, expected %u.\n", -+ desc_2d.Height, expected_height); -+ ok_(__FILE__, line)(desc_2d.MipLevels == expected_mip_levels, -+ "Got unexpected MipLevels %u, expected %u.\n", -+ desc_2d.MipLevels, expected_mip_levels); -+ ok_(__FILE__, line)(desc_2d.ArraySize == image->expected_info.ArraySize, -+ "Got unexpected ArraySize %u, expected %u.\n", -+ desc_2d.ArraySize, image->expected_info.ArraySize); -+ ok_(__FILE__, line)(desc_2d.Format == image->expected_info.Format, -+ "Got unexpected Format %u, expected %u.\n", -+ desc_2d.Format, image->expected_info.Format); -+ ok_(__FILE__, line)(desc_2d.SampleDesc.Count == 1, -+ "Got unexpected SampleDesc.Count %u, expected %u\n", -+ desc_2d.SampleDesc.Count, 1); -+ ok_(__FILE__, line)(desc_2d.SampleDesc.Quality == 0, -+ "Got unexpected SampleDesc.Quality %u, expected %u\n", -+ desc_2d.SampleDesc.Quality, 0); -+ ok_(__FILE__, line)(desc_2d.Usage == D3D11_USAGE_DEFAULT, -+ "Got unexpected Usage %u, expected %u\n", -+ desc_2d.Usage, D3D11_USAGE_DEFAULT); -+ ok_(__FILE__, line)(desc_2d.BindFlags == D3D11_BIND_SHADER_RESOURCE, -+ "Got unexpected BindFlags %#x, expected %#x\n", -+ desc_2d.BindFlags, D3D11_BIND_SHADER_RESOURCE); -+ ok_(__FILE__, line)(desc_2d.CPUAccessFlags == 0, -+ "Got unexpected CPUAccessFlags %#x, expected %#x\n", -+ desc_2d.CPUAccessFlags, 0); -+ ok_(__FILE__, line)(desc_2d.MiscFlags == image->expected_info.MiscFlags, -+ "Got unexpected MiscFlags %#x, expected %#x.\n", -+ desc_2d.MiscFlags, image->expected_info.MiscFlags); -+ -+ ID3D11Texture2D_Release(texture_2d); -+ break; -+ -+ case D3D11_RESOURCE_DIMENSION_TEXTURE3D: -+ hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture3D, (void **)&texture_3d); -+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); -+ ID3D11Texture3D_GetDesc(texture_3d, &desc_3d); -+ ok_(__FILE__, line)(desc_3d.Width == expected_width, -+ "Got unexpected Width %u, expected %u.\n", -+ desc_3d.Width, expected_width); -+ ok_(__FILE__, line)(desc_3d.Height == expected_height, -+ "Got unexpected Height %u, expected %u.\n", -+ desc_3d.Height, expected_height); -+ ok_(__FILE__, line)(desc_3d.Depth == image->expected_info.Depth, -+ "Got unexpected Depth %u, expected %u.\n", -+ desc_3d.Depth, image->expected_info.Depth); -+ ok_(__FILE__, line)(desc_3d.MipLevels == expected_mip_levels, -+ "Got unexpected MipLevels %u, expected %u.\n", -+ desc_3d.MipLevels, expected_mip_levels); -+ ok_(__FILE__, line)(desc_3d.Format == image->expected_info.Format, -+ "Got unexpected Format %u, expected %u.\n", -+ desc_3d.Format, image->expected_info.Format); -+ ok_(__FILE__, line)(desc_3d.Usage == D3D11_USAGE_DEFAULT, -+ "Got unexpected Usage %u, expected %u\n", -+ desc_3d.Usage, D3D11_USAGE_DEFAULT); -+ ok_(__FILE__, line)(desc_3d.BindFlags == D3D11_BIND_SHADER_RESOURCE, -+ "Got unexpected BindFlags %#x, expected %#x\n", -+ desc_3d.BindFlags, D3D11_BIND_SHADER_RESOURCE); -+ ok_(__FILE__, line)(desc_3d.CPUAccessFlags == 0, -+ "Got unexpected CPUAccessFlags %#x, expected %#x\n", -+ desc_3d.CPUAccessFlags, 0); -+ ok_(__FILE__, line)(desc_3d.MiscFlags == image->expected_info.MiscFlags, -+ "Got unexpected MiscFlags %#x, expected %#x.\n", -+ desc_3d.MiscFlags, image->expected_info.MiscFlags); -+ ID3D11Texture3D_Release(texture_3d); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+static void check_texture2d_data(ID3D11Texture2D *texture, const struct test_image *image, unsigned int line) -+{ -+ unsigned int width, height, stride, i, array_slice; -+ struct resource_readback rb; -+ D3D11_TEXTURE2D_DESC desc; -+ const BYTE *expected_data; -+ BOOL line_match; -+ -+ ID3D11Texture2D_GetDesc(texture, &desc); -+ width = desc.Width; -+ height = desc.Height; -+ stride = (width * get_bpp_from_format(desc.Format) + 7) / 8; -+ if (is_block_compressed(desc.Format)) -+ { -+ stride *= 4; -+ height /= 4; -+ } -+ -+ expected_data = image->expected_data; -+ for (array_slice = 0; array_slice < desc.ArraySize; ++array_slice) -+ { -+ get_texture_readback(texture, array_slice * desc.MipLevels, &rb); -+ for (i = 0; i < height; ++i) -+ { -+ const uint8_t *rb_data = get_readback_data(&rb, 0, i, 0, 0); -+ -+ line_match = !memcmp(expected_data + stride * i, rb_data, stride); -+ todo_wine_if(is_block_compressed(image->expected_info.Format) && image->data != test_dds_dxt5 -+ && (image->expected_info.Width % 4 != 0 || image->expected_info.Height % 4 != 0)) -+ ok_(__FILE__, line)(line_match, "Data mismatch for line %u, array slice %u.\n", i, array_slice); -+ if (!line_match) -+ break; -+ } -+ expected_data += stride * height; -+ release_resource_readback(&rb); -+ } -+} -+ -+static void check_texture3d_data(ID3D11Texture3D *texture, const struct test_image *image, unsigned int line) -+{ -+ unsigned int width, height, depth, stride, i, j; -+ struct resource_readback rb; -+ D3D11_TEXTURE3D_DESC desc; -+ const BYTE *expected_data; -+ BOOL line_match; -+ -+ ID3D11Texture3D_GetDesc(texture, &desc); -+ width = desc.Width; -+ height = desc.Height; -+ depth = desc.Depth; -+ stride = (width * get_bpp_from_format(desc.Format) + 7) / 8; -+ if (is_block_compressed(desc.Format)) -+ { -+ stride *= 4; -+ height /= 4; -+ } -+ -+ expected_data = image->expected_data; -+ get_texture3d_readback(texture, 0, &rb); -+ for (j = 0; j < depth; ++j) -+ { -+ const BYTE *expected_data_slice = expected_data + ((stride * height) * j); -+ -+ for (i = 0; i < height; ++i) -+ { -+ const uint8_t *rb_data = get_readback_data(&rb, 0, i, j, 0); -+ -+ line_match = !memcmp(expected_data_slice + stride * i, rb_data, stride); -+ ok_(__FILE__, line)(line_match, "Data mismatch for line %u.\n", i); -+ if (!line_match) -+ { -+ for (unsigned int k = 0; k < stride; ++k) -+ trace("%02x\n", *((BYTE *)get_readback_data(&rb, k, i, j, 1))); -+ break; -+ } -+ } -+ } -+ release_resource_readback(&rb); -+} -+ -+static void check_resource_data(ID3D11Resource *resource, const struct test_image *image, unsigned int line) -+{ -+ ID3D11Texture3D *texture3d; -+ ID3D11Texture2D *texture2d; -+ -+ if (SUCCEEDED(ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture3D, (void **)&texture3d))) -+ { -+ if (wined3d_opengl && is_block_compressed(image->expected_info.Format)) -+ skip("Skipping compressed format 3D texture readback test.\n"); -+ else -+ check_texture3d_data(texture3d, image, line); -+ ID3D11Texture3D_Release(texture3d); -+ } -+ else if (SUCCEEDED(ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture2D, (void **)&texture2d))) -+ { -+ check_texture2d_data(texture2d, image, line); -+ ID3D11Texture2D_Release(texture2d); -+ } -+ else -+ { -+ ok(0, "Failed to get 2D or 3D texture interface.\n"); -+ } -+} -+ - static WCHAR temp_dir[MAX_PATH]; - - static BOOL create_file(const WCHAR *filename, const char *data, unsigned int size, WCHAR *out_path) -@@ -482,6 +2047,34 @@ static void delete_directory(const WCHAR *dir) - RemoveDirectoryW(path); - } - -+static ID3D11Device *create_device(void) -+{ -+ HRESULT (WINAPI *pD3D11CreateDevice)(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, const D3D_FEATURE_LEVEL *, -+ UINT, UINT, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **); -+ HMODULE d3d11_mod = LoadLibraryA("d3d11.dll"); -+ ID3D11Device *device; -+ -+ -+ if (!d3d11_mod) -+ { -+ win_skip("d3d11.dll not present\n"); -+ return NULL; -+ } -+ -+ pD3D11CreateDevice = (void *)GetProcAddress(d3d11_mod, "D3D11CreateDevice"); -+ if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, -+ NULL, 0, D3D11_SDK_VERSION, &device, NULL, NULL))) -+ return device; -+ if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_WARP, NULL, 0, -+ NULL, 0, D3D11_SDK_VERSION, &device, NULL, NULL))) -+ return device; -+ if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_REFERENCE, NULL, 0, -+ NULL, 0, D3D11_SDK_VERSION, &device, NULL, NULL))) -+ return device; -+ -+ return NULL; -+} -+ - static void test_D3DX11CreateAsyncMemoryLoader(void) - { - ID3DX11DataLoader *loader; -@@ -862,7 +2455,6 @@ struct dds_header - DWORD reserved2; - }; - --#define DDS_RESOURCE_MISC_TEXTURECUBE 0x04 - struct dds_header_dxt10 - { - DWORD dxgi_format; -@@ -1508,8 +3100,208 @@ static void test_D3DX11GetImageInfoFromMemory(void) - todo_wine check_dds_dxt10_format(DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM, FALSE); - } - -+static void test_create_texture(void) -+{ -+ static const uint32_t dds_24bit_8_8_mip_level_expected[] = { 0xff0000ff, 0xff00ff00, 0xffff0000, 0xff000000 }; -+ D3D11_TEXTURE2D_DESC tex_2d_desc; -+ D3DX11_IMAGE_LOAD_INFO load_info; -+ D3DX11_IMAGE_INFO img_info; -+ ID3D11Resource *resource; -+ ID3D11Texture2D *tex_2d; -+ ID3D11Device *device; -+ uint32_t i, mip_level; -+ HRESULT hr, hr2; -+ -+ device = create_device(); -+ if (!device) -+ { -+ skip("Failed to create device, skipping tests.\n"); -+ return; -+ } -+ -+ CoInitialize(NULL); -+ -+ /* D3DX11CreateTextureFromMemory tests */ -+ resource = (ID3D11Resource *)0xdeadbeef; -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(NULL, test_bmp_1bpp, sizeof(test_bmp_1bpp), NULL, NULL, &resource, &hr2); -+ ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); -+ ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(resource == (ID3D11Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource); -+ -+ resource = (ID3D11Resource *)0xdeadbeef; -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(device, NULL, 0, NULL, NULL, &resource, &hr2); -+ ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); -+ ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(resource == (ID3D11Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource); -+ -+ resource = (ID3D11Resource *)0xdeadbeef; -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(device, NULL, sizeof(test_bmp_1bpp), NULL, NULL, &resource, &hr2); -+ ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); -+ ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(resource == (ID3D11Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource); -+ -+ resource = (ID3D11Resource *)0xdeadbeef; -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(device, test_bmp_1bpp, 0, NULL, NULL, &resource, &hr2); -+ ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); -+ ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(resource == (ID3D11Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource); -+ -+ resource = (ID3D11Resource *)0xdeadbeef; -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(device, test_bmp_1bpp, sizeof(test_bmp_1bpp) - 1, NULL, NULL, &resource, &hr2); -+ ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); -+ ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(resource == (ID3D11Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource); -+ -+ for (i = 0; i < ARRAY_SIZE(test_image); ++i) -+ { -+ winetest_push_context("Test %u", i); -+ -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(device, test_image[i].data, test_image[i].size, NULL, NULL, &resource, &hr2); -+ ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX11_IFF_WMP), -+ "Got unexpected hr %#lx.\n", hr); -+ if (hr == S_OK) -+ { -+ check_resource_info(resource, test_image + i, __LINE__); -+ check_resource_data(resource, test_image + i, __LINE__); -+ ID3D11Resource_Release(resource); -+ } -+ -+ winetest_pop_context(); -+ } -+ -+ for (i = 0; i < ARRAY_SIZE(test_invalid_image_load_info); ++i) -+ { -+ const struct test_invalid_image_load_info *test_load_info = &test_invalid_image_load_info[i]; -+ -+ winetest_push_context("Test %u", i); -+ -+ hr2 = 0xdeadbeef; -+ load_info = test_load_info->load_info; -+ hr = D3DX11CreateTextureFromMemory(device, test_load_info->data, test_load_info->size, &load_info, NULL, &resource, &hr2); -+ ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); -+ todo_wine_if(test_load_info->todo_hr) ok(hr == test_load_info->expected_hr, "Got unexpected hr %#lx.\n", hr); -+ if (SUCCEEDED(hr)) -+ ID3D11Resource_Release(resource); -+ -+ winetest_pop_context(); -+ } -+ -+ for (i = 0; i < ARRAY_SIZE(test_image_load_info); ++i) -+ { -+ const struct test_image_load_info *test_load_info = &test_image_load_info[i]; -+ -+ winetest_push_context("Test %u", i); -+ -+ load_info = test_load_info->load_info; -+ load_info.pSrcInfo = &img_info; -+ -+ resource = NULL; -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(device, test_load_info->data, test_load_info->size, &load_info, NULL, &resource, &hr2); -+ ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(hr == test_load_info->expected_hr, "Got unexpected hr %#lx.\n", hr); -+ if (SUCCEEDED(hr)) -+ { -+ check_test_image_load_info_resource(resource, test_load_info); -+ ID3D11Resource_Release(resource); -+ } -+ -+ winetest_pop_context(); -+ } -+ -+ /* Check behavior of the FirstMipLevel argument. */ -+ for (i = 0; i < 2; ++i) -+ { -+ winetest_push_context("FirstMipLevel %u", i); -+ memset(&img_info, 0, sizeof(img_info)); -+ set_d3dx11_image_load_info(&load_info, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, i, D3DX11_FROM_FILE, -+ D3D11_USAGE_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, -+ D3DX11_DEFAULT, &img_info); -+ -+ resource = NULL; -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(device, dds_24bit_8_8, sizeof(dds_24bit_8_8), &load_info, NULL, &resource, &hr2); -+ ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); -+ check_image_info_values(&img_info, 8, 8, 1, 1, 4, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, -+ D3DX11_IFF_DDS, FALSE); -+ -+ hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture2D, (void **)&tex_2d); -+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); -+ -+ ID3D11Texture2D_GetDesc(tex_2d, &tex_2d_desc); -+ check_texture2d_desc_values(&tex_2d_desc, 8, 8, 4, 1, DXGI_FORMAT_R8G8B8A8_UNORM, 1, 0, D3D11_USAGE_DEFAULT, -+ D3D11_BIND_SHADER_RESOURCE, 0, 0, FALSE); -+ for (mip_level = 0; mip_level < 4; ++mip_level) -+ { -+ winetest_push_context("MipLevel %u", mip_level); -+ check_texture_sub_resource_color(tex_2d, mip_level, NULL, -+ dds_24bit_8_8_mip_level_expected[min(3, mip_level + i)], 0); -+ winetest_pop_context(); -+ } -+ -+ ID3D11Texture2D_Release(tex_2d); -+ ID3D11Resource_Release(resource); -+ winetest_pop_context(); -+ } -+ -+ /* -+ * If FirstMipLevel is set to a value that is larger than the total number -+ * of mip levels in the image, it falls back to 0. -+ */ -+ memset(&img_info, 0, sizeof(img_info)); -+ set_d3dx11_image_load_info(&load_info, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, 5, D3DX11_FROM_FILE, -+ D3D11_USAGE_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, D3DX11_DEFAULT, -+ D3DX11_DEFAULT, &img_info); -+ -+ resource = NULL; -+ hr2 = 0xdeadbeef; -+ hr = D3DX11CreateTextureFromMemory(device, dds_24bit_8_8, sizeof(dds_24bit_8_8), &load_info, NULL, &resource, &hr2); -+ ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); -+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); -+ check_image_info_values(&img_info, 8, 8, 1, 1, 4, 0, DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_RESOURCE_DIMENSION_TEXTURE2D, -+ D3DX11_IFF_DDS, FALSE); -+ -+ hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture2D, (void **)&tex_2d); -+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); -+ ID3D11Texture2D_GetDesc(tex_2d, &tex_2d_desc); -+ check_texture2d_desc_values(&tex_2d_desc, 8, 8, 4, 1, DXGI_FORMAT_R8G8B8A8_UNORM, 1, 0, D3D11_USAGE_DEFAULT, -+ D3D11_BIND_SHADER_RESOURCE, 0, 0, FALSE); -+ for (mip_level = 0; mip_level < 4; ++mip_level) -+ { -+ winetest_push_context("MipLevel %u", mip_level); -+ check_texture_sub_resource_color(tex_2d, mip_level, NULL, dds_24bit_8_8_mip_level_expected[mip_level], 0); -+ winetest_pop_context(); -+ } -+ -+ ID3D11Texture2D_Release(tex_2d); -+ ID3D11Resource_Release(resource); -+ -+ CoUninitialize(); -+ -+ ok(!ID3D11Device_Release(device), "Unexpected refcount.\n"); -+} -+ - START_TEST(d3dx11) - { -+ HMODULE wined3d; -+ -+ if ((wined3d = GetModuleHandleA("wined3d.dll"))) -+ { -+ enum wined3d_renderer (CDECL *p_wined3d_get_renderer)(void); -+ -+ if ((p_wined3d_get_renderer = (void *)GetProcAddress(wined3d, "wined3d_get_renderer")) -+ && p_wined3d_get_renderer() == WINED3D_RENDERER_OPENGL) -+ wined3d_opengl = true; -+ } -+ - test_D3DX11CreateAsyncMemoryLoader(); - test_D3DX11CreateAsyncFileLoader(); - test_D3DX11CreateAsyncResourceLoader(); -@@ -1517,4 +3309,5 @@ START_TEST(d3dx11) - test_D3DX11GetImageInfoFromMemory(); - test_legacy_dds_header_image_info(); - test_dxt10_dds_header_image_info(); -+ test_create_texture(); - } -diff --git a/dlls/d3dx11_43/texture.c b/dlls/d3dx11_43/texture.c -index cbf3b630f58..f8605223a4f 100644 ---- a/dlls/d3dx11_43/texture.c -+++ b/dlls/d3dx11_43/texture.c -@@ -16,6 +16,8 @@ - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -+#define COBJMACROS -+#include "d3d11.h" - #include "d3dx11.h" - #include "d3dcompiler.h" - #include "dxhelpers.h" -@@ -277,14 +279,296 @@ HRESULT WINAPI D3DX11CreateTextureFromFileW(ID3D11Device *device, const WCHAR *f - return E_NOTIMPL; - } - -+void init_load_info(const D3DX11_IMAGE_LOAD_INFO *load_info, D3DX11_IMAGE_LOAD_INFO *out) -+{ -+ if (load_info) -+ { -+ *out = *load_info; -+ return; -+ } -+ -+ out->Width = D3DX11_DEFAULT; -+ out->Height = D3DX11_DEFAULT; -+ out->Depth = D3DX11_DEFAULT; -+ out->FirstMipLevel = D3DX11_DEFAULT; -+ out->MipLevels = D3DX11_DEFAULT; -+ out->Usage = D3DX11_DEFAULT; -+ out->BindFlags = D3DX11_DEFAULT; -+ out->CpuAccessFlags = D3DX11_DEFAULT; -+ out->MiscFlags = D3DX11_DEFAULT; -+ out->Format = D3DX11_DEFAULT; -+ out->Filter = D3DX11_DEFAULT; -+ out->MipFilter = D3DX11_DEFAULT; -+ out->pSrcInfo = NULL; -+} -+ -+HRESULT load_texture_data(const void *data, SIZE_T size, D3DX11_IMAGE_LOAD_INFO *load_info, -+ D3D11_SUBRESOURCE_DATA **resource_data) -+{ -+ const struct pixel_format_desc *fmt_desc, *src_desc; -+ struct d3dx_subresource_data *sub_rsrcs = NULL; -+ uint32_t loaded_mip_levels, max_mip_levels; -+ D3DX11_IMAGE_INFO img_info; -+ struct d3dx_image image; -+ unsigned int i, j; -+ HRESULT hr = S_OK; -+ -+ if (!data || !size) -+ return E_FAIL; -+ -+ *resource_data = NULL; -+ if (!load_info->Filter || load_info->Filter == D3DX11_DEFAULT) -+ load_info->Filter = D3DX11_FILTER_TRIANGLE | D3DX11_FILTER_DITHER; -+ if (FAILED(hr = d3dx_validate_filter(load_info->Filter))) -+ { -+ ERR("Invalid filter argument %#x.\n", load_info->Filter); -+ return hr; -+ } -+ -+ hr = d3dx_image_init(data, size, &image, 0, D3DX_IMAGE_SUPPORT_DXT10); -+ if (FAILED(hr)) -+ return E_FAIL; -+ -+ hr = d3dx11_image_info_from_d3dx_image(&img_info, &image); -+ if (FAILED(hr)) -+ { -+ WARN("Invalid or unsupported image file, hr %#lx.\n", hr); -+ hr = E_FAIL; -+ goto end; -+ } -+ -+ if ((!(img_info.MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE) || img_info.ArraySize != 6) -+ && img_info.ArraySize != 1) -+ { -+ FIXME("img_info.ArraySize = %u not supported.\n", img_info.ArraySize); -+ hr = E_NOTIMPL; -+ goto end; -+ } -+ -+ if (load_info->FirstMipLevel == D3DX11_DEFAULT || (load_info->FirstMipLevel >= img_info.MipLevels)) -+ load_info->FirstMipLevel = 0; -+ -+ if (load_info->Format == D3DX11_DEFAULT || load_info->Format == DXGI_FORMAT_FROM_FILE) -+ load_info->Format = img_info.Format; -+ fmt_desc = get_d3dx_pixel_format_info(d3dx_pixel_format_id_from_dxgi_format(load_info->Format)); -+ if (fmt_desc->format == D3DX_PIXEL_FORMAT_COUNT) -+ { -+ FIXME("Unknown DXGI format supplied, %#x.\n", load_info->Format); -+ hr = E_NOTIMPL; -+ goto end; -+ } -+ -+ /* Potentially round up width/height to align with block size. */ -+ if (!load_info->Width || load_info->Width == D3DX11_FROM_FILE || load_info->Width == D3DX11_DEFAULT) -+ load_info->Width = (img_info.Width + fmt_desc->block_width - 1) & ~(fmt_desc->block_width - 1); -+ if (!load_info->Height || load_info->Height == D3DX11_FROM_FILE || load_info->Height == D3DX11_DEFAULT) -+ load_info->Height = (img_info.Height + fmt_desc->block_height - 1) & ~(fmt_desc->block_height - 1); -+ if (!load_info->Depth || load_info->Depth == D3DX11_FROM_FILE || load_info->Depth == D3DX11_DEFAULT) -+ load_info->Depth = img_info.Depth; -+ -+ if ((load_info->Depth > 1) && (img_info.ResourceDimension != D3D11_RESOURCE_DIMENSION_TEXTURE3D)) -+ { -+ ERR("Invalid depth value %u for image with dimension %d.\n", load_info->Depth, img_info.ResourceDimension); -+ hr = E_FAIL; -+ goto end; -+ } -+ -+ max_mip_levels = d3dx_get_max_mip_levels_for_size(load_info->Width, load_info->Height, load_info->Depth); -+ if (!load_info->MipLevels || load_info->MipLevels == D3DX11_DEFAULT || load_info->MipLevels == D3DX11_FROM_FILE) -+ load_info->MipLevels = (load_info->MipLevels == D3DX11_FROM_FILE) ? img_info.MipLevels : max_mip_levels; -+ load_info->MipLevels = min(max_mip_levels, load_info->MipLevels); -+ -+ hr = d3dx_create_subresource_data_for_texture(load_info->Width, load_info->Height, load_info->Depth, -+ load_info->MipLevels, img_info.ArraySize, fmt_desc, &sub_rsrcs); -+ if (FAILED(hr)) -+ goto end; -+ -+ src_desc = get_d3dx_pixel_format_info(image.format); -+ loaded_mip_levels = min((img_info.MipLevels - load_info->FirstMipLevel), load_info->MipLevels); -+ for (i = 0; i < img_info.ArraySize; ++i) -+ { -+ struct volume dst_size = { load_info->Width, load_info->Height, load_info->Depth }; -+ -+ for (j = 0; j < loaded_mip_levels; ++j) -+ { -+ struct d3dx_subresource_data *sub_rsrc = &sub_rsrcs[i * load_info->MipLevels + j]; -+ const RECT unaligned_rect = { 0, 0, dst_size.width, dst_size.height }; -+ struct d3dx_pixels src_pixels, dst_pixels; -+ -+ hr = d3dx_image_get_pixels(&image, i, j + load_info->FirstMipLevel, &src_pixels); -+ if (FAILED(hr)) -+ goto end; -+ -+ set_d3dx_pixels(&dst_pixels, sub_rsrc->data, sub_rsrc->row_pitch, sub_rsrc->slice_pitch, NULL, dst_size.width, -+ dst_size.height, dst_size.depth, &unaligned_rect); -+ -+ hr = d3dx_load_pixels_from_pixels(&dst_pixels, fmt_desc, &src_pixels, src_desc, load_info->Filter, 0); -+ if (FAILED(hr)) -+ goto end; -+ -+ d3dx_get_next_mip_level_size(&dst_size); -+ } -+ } -+ -+ if (loaded_mip_levels < load_info->MipLevels) -+ { -+ struct volume base_level_size = { load_info->Width, load_info->Height, load_info->Depth }; -+ const uint32_t base_level = loaded_mip_levels - 1; -+ -+ if (!load_info->MipFilter || load_info->MipFilter == D3DX11_DEFAULT) -+ load_info->MipFilter = D3DX11_FILTER_LINEAR; -+ if (FAILED(hr = d3dx_validate_filter(load_info->MipFilter))) -+ { -+ ERR("Invalid mip filter argument %#x.\n", load_info->MipFilter); -+ goto end; -+ } -+ -+ d3dx_get_mip_level_size(&base_level_size, base_level); -+ for (i = 0; i < img_info.ArraySize; ++i) -+ { -+ struct volume src_size, dst_size; -+ -+ src_size = dst_size = base_level_size; -+ for (j = base_level; j < (load_info->MipLevels - 1); ++j) -+ { -+ struct d3dx_subresource_data *dst_data = &sub_rsrcs[i * load_info->MipLevels + j + 1]; -+ struct d3dx_subresource_data *src_data = &sub_rsrcs[i * load_info->MipLevels + j]; -+ const RECT src_unaligned_rect = { 0, 0, src_size.width, src_size.height }; -+ struct d3dx_pixels src_pixels, dst_pixels; -+ RECT dst_unaligned_rect; -+ -+ d3dx_get_next_mip_level_size(&dst_size); -+ SetRect(&dst_unaligned_rect, 0, 0, dst_size.width, dst_size.height); -+ set_d3dx_pixels(&dst_pixels, dst_data->data, dst_data->row_pitch, dst_data->slice_pitch, NULL, -+ dst_size.width, dst_size.height, dst_size.depth, &dst_unaligned_rect); -+ set_d3dx_pixels(&src_pixels, src_data->data, src_data->row_pitch, src_data->slice_pitch, NULL, -+ src_size.width, src_size.height, src_size.depth, &src_unaligned_rect); -+ -+ hr = d3dx_load_pixels_from_pixels(&dst_pixels, fmt_desc, &src_pixels, fmt_desc, load_info->MipFilter, 0); -+ if (FAILED(hr)) -+ goto end; -+ -+ src_size = dst_size; -+ } -+ } -+ } -+ -+ *resource_data = (D3D11_SUBRESOURCE_DATA *)sub_rsrcs; -+ sub_rsrcs = NULL; -+ -+ load_info->Usage = (load_info->Usage == D3DX11_DEFAULT) ? D3D11_USAGE_DEFAULT : load_info->Usage; -+ load_info->BindFlags = (load_info->BindFlags == D3DX11_DEFAULT) ? D3D11_BIND_SHADER_RESOURCE : load_info->BindFlags; -+ load_info->CpuAccessFlags = (load_info->CpuAccessFlags == D3DX11_DEFAULT) ? 0 : load_info->CpuAccessFlags; -+ load_info->MiscFlags = (load_info->MiscFlags == D3DX11_DEFAULT) ? 0 : load_info->MiscFlags; -+ load_info->MiscFlags |= img_info.MiscFlags; -+ if (load_info->pSrcInfo) -+ *load_info->pSrcInfo = img_info; -+ -+end: -+ d3dx_image_cleanup(&image); -+ free(sub_rsrcs); -+ return hr; -+} -+ -+HRESULT create_d3d_texture(ID3D11Device *device, D3DX11_IMAGE_LOAD_INFO *load_info, -+ D3D11_SUBRESOURCE_DATA *resource_data, ID3D11Resource **texture) -+{ -+ HRESULT hr; -+ -+ *texture = NULL; -+ switch (load_info->pSrcInfo->ResourceDimension) -+ { -+ case D3D11_RESOURCE_DIMENSION_TEXTURE2D: -+ { -+ D3D11_TEXTURE2D_DESC texture_2d_desc = { 0 }; -+ ID3D11Texture2D *texture_2d; -+ -+ texture_2d_desc.Width = load_info->Width; -+ texture_2d_desc.Height = load_info->Height; -+ texture_2d_desc.MipLevels = load_info->MipLevels; -+ texture_2d_desc.ArraySize = load_info->pSrcInfo->ArraySize; -+ texture_2d_desc.Format = load_info->Format; -+ texture_2d_desc.SampleDesc.Count = 1; -+ texture_2d_desc.Usage = load_info->Usage; -+ texture_2d_desc.BindFlags = load_info->BindFlags; -+ texture_2d_desc.CPUAccessFlags = load_info->CpuAccessFlags; -+ texture_2d_desc.MiscFlags = load_info->MiscFlags; -+ -+ if (FAILED(hr = ID3D11Device_CreateTexture2D(device, &texture_2d_desc, resource_data, &texture_2d))) -+ return hr; -+ *texture = (ID3D11Resource *)texture_2d; -+ break; -+ } -+ -+ case D3D11_RESOURCE_DIMENSION_TEXTURE3D: -+ { -+ D3D11_TEXTURE3D_DESC texture_3d_desc = { 0 }; -+ ID3D11Texture3D *texture_3d; -+ -+ texture_3d_desc.Width = load_info->Width; -+ texture_3d_desc.Height = load_info->Height; -+ texture_3d_desc.Depth = load_info->Depth; -+ texture_3d_desc.MipLevels = load_info->MipLevels; -+ texture_3d_desc.Format = load_info->Format; -+ texture_3d_desc.Usage = load_info->Usage; -+ texture_3d_desc.BindFlags = load_info->BindFlags; -+ texture_3d_desc.CPUAccessFlags = load_info->CpuAccessFlags; -+ texture_3d_desc.MiscFlags = load_info->MiscFlags; -+ -+ if (FAILED(hr = ID3D11Device_CreateTexture3D(device, &texture_3d_desc, resource_data, &texture_3d))) -+ return hr; -+ *texture = (ID3D11Resource *)texture_3d; -+ break; -+ } -+ -+ default: -+ FIXME("Unhandled resource dimension %d.\n", load_info->pSrcInfo->ResourceDimension); -+ return E_NOTIMPL; -+ } -+ -+ return S_OK; -+} -+ -+static HRESULT create_texture(ID3D11Device *device, const void *data, SIZE_T size, -+ D3DX11_IMAGE_LOAD_INFO *load_info, ID3D11Resource **texture) -+{ -+ D3D11_SUBRESOURCE_DATA *resource_data; -+ D3DX11_IMAGE_LOAD_INFO load_info_copy; -+ D3DX11_IMAGE_INFO img_info; -+ HRESULT hr; -+ -+ init_load_info(load_info, &load_info_copy); -+ if (!load_info_copy.pSrcInfo) -+ load_info_copy.pSrcInfo = &img_info; -+ -+ if (FAILED((hr = load_texture_data(data, size, &load_info_copy, &resource_data)))) -+ return hr; -+ hr = create_d3d_texture(device, &load_info_copy, resource_data, texture); -+ free(resource_data); -+ return hr; -+} -+ - HRESULT WINAPI D3DX11CreateTextureFromMemory(ID3D11Device *device, const void *data, - SIZE_T data_size, D3DX11_IMAGE_LOAD_INFO *load_info, ID3DX11ThreadPump *pump, - ID3D11Resource **texture, HRESULT *hresult) - { -- FIXME("device %p, data %p, data_size %Iu, load_info %p, pump %p, texture %p, hresult %p stub.\n", -+ HRESULT hr; -+ -+ TRACE("device %p, data %p, data_size %Iu, load_info %p, pump %p, texture %p, hresult %p.\n", - device, data, data_size, load_info, pump, texture, hresult); - -- return E_NOTIMPL; -+ if (!device) -+ return E_INVALIDARG; -+ if (!data) -+ return E_FAIL; -+ -+ if (pump) -+ FIXME("D3DX11 thread pump is currently unimplemented.\n"); -+ -+ hr = create_texture(device, data, data_size, load_info, texture); -+ if (hresult) -+ *hresult = hr; -+ return hr; - } - - HRESULT WINAPI D3DX11SaveTextureToFileW(ID3D11DeviceContext *context, ID3D11Resource *texture, --- -2.51.0 - diff --git a/patches/d3dx11_43-D3DX11CreateTextureFromMemory/definition b/patches/d3dx11_43-D3DX11CreateTextureFromMemory/definition deleted file mode 100644 index ab7bdc27..00000000 --- a/patches/d3dx11_43-D3DX11CreateTextureFromMemory/definition +++ /dev/null @@ -1,2 +0,0 @@ -Fixes: [45533] - Implement D3DX11CreateTextureFromMemory -Disabled: True