d3dx9/tests: Add a test for loading surfaces not divisible by the block size.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e371085aaf
commit
7f39c726fc
|
@ -167,6 +167,20 @@ static const unsigned char dds_volume_map[] = {
|
||||||
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x84,0xef,0x7b,0xaa,0xab,0xab,0xab
|
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x84,0xef,0x7b,0xaa,0xab,0xab,0xab
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* 4x2 dxt5 */
|
||||||
|
static const BYTE 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 HRESULT create_file(const char *filename, const unsigned char *data, const unsigned int size)
|
static HRESULT create_file(const char *filename, const unsigned char *data, const unsigned int size)
|
||||||
{
|
{
|
||||||
DWORD received;
|
DWORD received;
|
||||||
|
@ -1269,6 +1283,26 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
|
||||||
ok(SUCCEEDED(hr), "Failed to get the surface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get the surface, hr %#x.\n", hr);
|
||||||
hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
|
hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
|
||||||
todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT5 format.\n");
|
todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT5 format.\n");
|
||||||
|
|
||||||
|
SetRect(&rect, 0, 0, 4, 2);
|
||||||
|
hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, &rect, surf, NULL, &rect, D3DX_FILTER_NONE, 0);
|
||||||
|
todo_wine ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = D3DXLoadSurfaceFromMemory(newsurf, NULL, &rect, &dds_dxt5[128],
|
||||||
|
D3DFMT_DXT5, 16, NULL, &rect, D3DX_FILTER_NONE, 0);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
check_release((IUnknown *)newsurf, 1);
|
||||||
|
check_release((IUnknown *)tex, 0);
|
||||||
|
|
||||||
|
/* Test a rect larger than but not an integer multiple of the block size. */
|
||||||
|
hr = IDirect3DDevice9_CreateTexture(device, 4, 8, 1, 0, D3DFMT_DXT5, D3DPOOL_SYSTEMMEM, &tex, NULL);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DTexture9_GetSurfaceLevel(tex, 0, &newsurf);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
SetRect(&rect, 0, 0, 4, 6);
|
||||||
|
hr = D3DXLoadSurfaceFromMemory(newsurf, NULL, &rect, &dds_dxt5[112],
|
||||||
|
D3DFMT_DXT5, 16, NULL, &rect, D3DX_FILTER_POINT, 0);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
check_release((IUnknown*)newsurf, 1);
|
check_release((IUnknown*)newsurf, 1);
|
||||||
check_release((IUnknown*)tex, 0);
|
check_release((IUnknown*)tex, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue