d3d9/tests: Make use of the readback helpers in check_rect().
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
08b19c6f67
commit
4e8a5c8f70
|
@ -4706,7 +4706,7 @@ done:
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_rect(IDirect3DDevice9 *device, RECT r, const char *message)
|
static void check_rect(struct surface_readback *rb, RECT r, const char *message)
|
||||||
{
|
{
|
||||||
LONG x_coords[2][2] =
|
LONG x_coords[2][2] =
|
||||||
{
|
{
|
||||||
|
@ -4730,9 +4730,9 @@ static void check_rect(IDirect3DDevice9 *device, RECT r, const char *message)
|
||||||
{
|
{
|
||||||
unsigned int x = x_coords[i][x_side], y = y_coords[j][y_side];
|
unsigned int x = x_coords[i][x_side], y = y_coords[j][y_side];
|
||||||
DWORD color;
|
DWORD color;
|
||||||
DWORD expected = (x_side == 1 && y_side == 1) ? 0x00ffffff : 0;
|
DWORD expected = (x_side == 1 && y_side == 1) ? 0xffffffff : 0xff000000;
|
||||||
|
|
||||||
color = getPixelColor(device, x, y);
|
color = get_readback_color(rb, x, y);
|
||||||
ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n",
|
ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n",
|
||||||
message, x, y, color, expected);
|
message, x, y, color, expected);
|
||||||
}
|
}
|
||||||
|
@ -4776,6 +4776,8 @@ static void projected_textures_test(IDirect3DDevice9 *device,
|
||||||
IDirect3D9 *d3d;
|
IDirect3D9 *d3d;
|
||||||
D3DCAPS9 caps;
|
D3DCAPS9 caps;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
IDirect3DSurface9 *backbuffer;
|
||||||
|
struct surface_readback rb;
|
||||||
|
|
||||||
IDirect3DDevice9_GetDirect3D(device, &d3d);
|
IDirect3DDevice9_GetDirect3D(device, &d3d);
|
||||||
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
||||||
|
@ -4793,6 +4795,9 @@ static void projected_textures_test(IDirect3DDevice9 *device,
|
||||||
ok(SUCCEEDED(hr), "CreatePixelShader failed (%08x)\n", hr);
|
ok(SUCCEEDED(hr), "CreatePixelShader failed (%08x)\n", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff203040, 0.0f, 0);
|
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff203040, 0.0f, 0);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
|
||||||
|
|
||||||
|
@ -4872,14 +4877,14 @@ static void projected_textures_test(IDirect3DDevice9 *device,
|
||||||
if (vs) IDirect3DVertexShader9_Release(vs);
|
if (vs) IDirect3DVertexShader9_Release(vs);
|
||||||
if (ps) IDirect3DPixelShader9_Release(ps);
|
if (ps) IDirect3DPixelShader9_Release(ps);
|
||||||
|
|
||||||
|
get_rt_readback(backbuffer, &rb);
|
||||||
for (i = 0; i < 4; ++i)
|
for (i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
if ((!tests[i].vs || vs) && (!tests[i].ps || ps))
|
if ((!tests[i].vs || vs) && (!tests[i].ps || ps))
|
||||||
check_rect(device, tests[i].rect, tests[i].message);
|
check_rect(&rb, tests[i].rect, tests[i].message);
|
||||||
}
|
}
|
||||||
|
release_surface_readback(&rb);
|
||||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
IDirect3DSurface9_Release(backbuffer);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void texture_transform_flags_test(void)
|
static void texture_transform_flags_test(void)
|
||||||
|
|
Loading…
Reference in New Issue