1602{
1603 static const DWORD dds_dxt5_expected[] =
1604 {
1605 0xff7b207b, 0xff7b207b, 0xff84df7b, 0xff84df7b,
1606 0xff7b207b, 0xff7b207b, 0xff84df7b, 0xff84df7b,
1607 0xff7b207b, 0xff7b207b, 0xff84df7b, 0xff84df7b,
1608 0xff7b207b, 0xff7b207b, 0xff84df7b, 0xff84df7b,
1609 };
1610 static const DWORD dds_dxt5_8_8_expected[] =
1611 {
1612 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x3f00ffff, 0x3f00ffff, 0x3fff0000, 0x3fff0000,
1613 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x3f00ffff, 0x3f00ffff, 0x3fff0000, 0x3fff0000,
1614 0x000000ff, 0x000000ff, 0x0000ff00, 0x0000ff00, 0x3fff0000, 0x3fff0000, 0x3f00ffff, 0x3f00ffff,
1615 0x000000ff, 0x000000ff, 0x0000ff00, 0x0000ff00, 0x3fff0000, 0x3fff0000, 0x3f00ffff, 0x3f00ffff,
1616 0x7fffff00, 0x7fffff00, 0x7fff00ff, 0x7fff00ff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff,
1617 0x7fffff00, 0x7fffff00, 0x7fff00ff, 0x7fff00ff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff,
1618 0x7fff00ff, 0x7fff00ff, 0x7fffff00, 0x7fffff00, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000,
1619 0x7fff00ff, 0x7fff00ff, 0x7fffff00, 0x7fffff00, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000,
1620 };
1621 static const DWORD dds_dxt5_8_8_expected_misaligned_1[] =
1622 {
1623 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x3fff0000, 0x3fff0000, 0x3fff0000, 0x3fff0000,
1624 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x3fff0000, 0x3fff0000, 0x3fff0000, 0x3fff0000,
1625 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x3fff0000, 0x3fff0000, 0x3fff0000, 0x3fff0000,
1626 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x3fff0000, 0x3fff0000, 0x3fff0000, 0x3fff0000,
1627 0x7fff00ff, 0x7fff00ff, 0x7fff00ff, 0x7fff00ff, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
1628 0x7fff00ff, 0x7fff00ff, 0x7fff00ff, 0x7fff00ff, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
1629 0x7fff00ff, 0x7fff00ff, 0x7fff00ff, 0x7fff00ff, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
1630 0x7fff00ff, 0x7fff00ff, 0x7fff00ff, 0x7fff00ff, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
1631 };
1632 static const DWORD dds_dxt5_8_8_expected_misaligned_3[] =
1633 {
1634 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1635 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1636 0x00000000, 0x00000000, 0x0000ff00, 0x0000ff00, 0x3fff0000, 0x3fff0000, 0x00000000, 0x00000000,
1637 0x00000000, 0x00000000, 0x0000ff00, 0x0000ff00, 0x3fff0000, 0x3fff0000, 0x00000000, 0x00000000,
1638 0x00000000, 0x00000000, 0x7fff00ff, 0x7fff00ff, 0xff000000, 0xff000000, 0x00000000, 0x00000000,
1639 0x00000000, 0x00000000, 0x7fff00ff, 0x7fff00ff, 0xff000000, 0xff000000, 0x00000000, 0x00000000,
1640 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1641 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1642 };
1643 IDirect3DSurface9 *surface, *uncompressed_surface;
1648 unsigned int i,
x,
y;
1652
1654 ok(
hr ==
D3D_OK,
"D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n",
hr,
D3D_OK);
1656
1658 ok(
hr ==
D3D_OK,
"D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n",
hr,
D3D_OK);
1660
1663
1664
1666 ok(
hr ==
D3D_OK,
"D3DXCreateTextureFromFileInMemory returned %#x, expected %#x.\n",
hr,
D3D_OK);
1670 ok(
hr ==
D3D_OK,
"IDirect3DTexture9_GetLevelDesc returned %#x, expected %#x.\n",
hr,
D3D_OK);
1671 ok(
desc.Width == 4,
"Width is %u, expected 4.\n",
desc.Width);
1672 ok(
desc.Height == 4,
"Height is %u, expected 4.\n",
desc.Height);
1674 {
1677 ok(
hr ==
D3D_OK,
"IDirect3DTexture9_LockRect returned %#x, expected %#x\n",
hr,
D3D_OK);
1679 {
1680 for (
i = 0;
i < 16;
i++)
1682 "Byte at index %u is 0x%02x, expected 0x%02x.\n",
1685 }
1686 }
1687 else
1688 {
1690 skip(
"D3DFMT_DXT5 textures are not supported, skipping a test.\n");
1691 }
1693
1694
1698 {
1703 ok(
desc.Width == 4,
"Got unexpected width %u.\n",
desc.Width);
1704 ok(
desc.Height == 4,
"Got unexpected height %u.\n",
desc.Height);
1705
1714 for (
y = 0;
y < 4; ++
y)
1715 {
1716 for (
x = 0;
x < 4; ++
x)
1717 {
1718
1719
1720
1722 dds_dxt5_expected[
y * 4 +
x], 32),
1723 "Color at position %u, %u is 0x%08x, expected 0x%08x.\n",
1725 dds_dxt5_expected[
y * 4 +
x]);
1726 }
1727 }
1730
1733 }
1736
1737
1744 ok(
desc.Width == 8,
"Got unexpected width %u.\n",
desc.Width);
1745 ok(
desc.Height == 8,
"Got unexpected height %u.\n",
desc.Height);
1747
1754 {
1757 for (
y = 0;
y < 8; ++
y)
1758 {
1759 for (
x = 0;
x < 8; ++
x)
1760 {
1762 dds_dxt5_8_8_expected[
y * 8 +
x], 0),
1763 "Color at position %u, %u is 0x%08x, expected 0x%08x.\n",
1765 dds_dxt5_8_8_expected[
y * 8 +
x]);
1766 }
1767 }
1770 }
1771
1774 for (
y = 0;
y < 2; ++
y)
1778
1785
1788 for (
y = 0;
y < 8; ++
y)
1789 {
1790 for (
x = 0;
x < 8; ++
x)
1791 {
1793 dds_dxt5_8_8_expected_misaligned_1[
y * 8 +
x], 0),
1794 "Color at position %u, %u is 0x%08x, expected 0x%08x.\n",
1796 dds_dxt5_8_8_expected_misaligned_1[
y * 8 +
x]);
1797 }
1798 }
1801
1804 for (
y = 0;
y < 2; ++
y)
1808
1812
1818
1821 for (
y = 0;
y < 8; ++
y)
1822 {
1823 for (
x = 0;
x < 8; ++
x)
1824 {
1826 dds_dxt5_8_8_expected_misaligned_3[
y * 8 +
x], 0),
1827 "Color at position %u, %u is 0x%08x, expected 0x%08x.\n",
1829 dds_dxt5_8_8_expected_misaligned_3[
y * 8 +
x]);
1830 }
1831 }
1834
1840
1843 for (
y = 0;
y < 8; ++
y)
1844 {
1845 for (
x = 0;
x < 8; ++
x)
1846 {
1848 dds_dxt5_8_8_expected_misaligned_3[
y * 8 +
x], 0),
1849 "Color at position %u, %u is 0x%08x, expected 0x%08x.\n",
1851 dds_dxt5_8_8_expected_misaligned_3[
y * 8 +
x]);
1852 }
1853 }
1856
1860
1861
1863 ok(
hr ==
D3D_OK,
"D3DXCreateTextureFromFileInMemory returned %#x, expected %#x.\n",
hr,
D3D_OK);
1867 todo_wine ok(level_count == 3,
"Texture has %u mip levels, 3 expected.\n", level_count);
1869 ok(
hr ==
D3D_OK,
"IDirect3DTexture9_GetLevelDesc returned %#x, expected %#x.\n",
hr,
D3D_OK);
1870 ok(
desc.Width == 4,
"Width is %u, expected 4.\n",
desc.Width);
1871 ok(
desc.Height == 4,
"Height is %u, expected 4.\n",
desc.Height);
1872
1874 {
1877 ok(
hr ==
D3D_OK,
"IDirect3DTexture9_LockRect returned %#x, expected %#x.\n",
hr,
D3D_OK);
1879 {
1880 for (
i = 0;
i < 16; ++
i)
1882 "Byte at index %u is 0x%02x, expected 0x%02x.\n",
1885 }
1886 }
1887 else
1888 {
1890 skip(
"D3DFMT_DXT3 volume textures are not supported, skipping a test.\n");
1891 }
1892
1893
1895}
enum _D3DRESOURCETYPE D3DRESOURCETYPE
#define IDirect3DTexture9_GetSurfaceLevel(p, a, b)
#define IDirect3DTexture9_GetType(p)
#define IDirect3DSurface9_LockRect(p, a, b, c)
#define IDirect3DTexture9_UnlockRect(p, a)
#define IDirect3DBaseTexture9_GetLevelCount(p)
#define IDirect3DTexture9_LockRect(p, a, b, c, d)
#define IDirect3DSurface9_UnlockRect(p)
#define IDirect3DSurface9_Release(p)
#define IDirect3DDevice9_CreateOffscreenPlainSurface(p, a, b, c, d, e, f)
#define D3DX_FILTER_POINT
HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette, const RECT *dst_rect, const void *src_memory, D3DFORMAT src_format, UINT src_pitch, const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key)
HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette, const RECT *dst_rect, IDirect3DSurface9 *src_surface, const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key)
HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface, const PALETTEENTRY *pDestPalette, const RECT *pDestRect, const void *pSrcData, UINT SrcDataSize, const RECT *pSrcRect, DWORD dwFilter, D3DCOLOR Colorkey, D3DXIMAGE_INFO *pSrcInfo)
HRESULT WINAPI D3DXCreateTextureFromFileInMemory(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, struct IDirect3DTexture9 **texture)
GLuint GLuint GLsizei GLenum type
static const unsigned char dds_volume_map[]
static const BYTE dds_dxt5[]
static const unsigned char dds_16bit[]
static const BYTE dds_dxt5_8_8[]
static BOOL compare_color(DWORD c1, DWORD c2, BYTE max_diff)
static const unsigned char dds_24bit[]
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)