[WINESYNC] 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>

wine commit id 7f39c726fc91d84d4b26241c3a031381ad9e59cb by Matteo Bruni <mbruni@codeweavers.com>
This commit is contained in:
winesync 2020-09-21 22:56:59 +02:00 committed by Jérôme Gardou
parent eaf1129b76
commit 7b66aec721
2 changed files with 35 additions and 1 deletions

View file

@ -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
};
/* 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)
{
DWORD received;
@ -1269,6 +1283,26 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
ok(SUCCEEDED(hr), "Failed to get the surface, hr %#x.\n", hr);
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");
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*)tex, 0);
}

View file

@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
tags: {wine: e371085aaf4424e6ef9b5b76ebf3107121d22f50}
tags: {wine: 7f39c726fc91d84d4b26241c3a031381ad9e59cb}