d3d8/tests: Port test_sample_mask() from d3d9.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cfdaa7fdaf
commit
30fe080965
|
@ -11070,6 +11070,93 @@ static void test_desktop_window(void)
|
||||||
IDirect3D8_Release(d3d);
|
IDirect3D8_Release(d3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_sample_mask(void)
|
||||||
|
{
|
||||||
|
IDirect3DSurface8 *rt, *ms_rt;
|
||||||
|
struct surface_readback rb;
|
||||||
|
IDirect3DDevice8 *device;
|
||||||
|
IDirect3D8 *d3d;
|
||||||
|
ULONG refcount;
|
||||||
|
DWORD colour;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
struct vec3 position;
|
||||||
|
DWORD diffuse;
|
||||||
|
}
|
||||||
|
quad[] =
|
||||||
|
{
|
||||||
|
{{-1.0f, -1.0f, 0.1f}, 0xffffffff},
|
||||||
|
{{-1.0f, 1.0f, 0.1f}, 0xffffffff},
|
||||||
|
{{ 1.0f, -1.0f, 0.1f}, 0xffffffff},
|
||||||
|
{{ 1.0f, 1.0f, 0.1f}, 0xffffffff},
|
||||||
|
};
|
||||||
|
|
||||||
|
window = create_window();
|
||||||
|
d3d = Direct3DCreate8(D3D_SDK_VERSION);
|
||||||
|
ok(!!d3d, "Failed to create a D3D object.\n");
|
||||||
|
|
||||||
|
if (FAILED(IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
|
||||||
|
D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES)))
|
||||||
|
{
|
||||||
|
skip("Multisampling not supported for D3DFMT_A8R8G8B8.\n");
|
||||||
|
IDirect3D8_Release(d3d);
|
||||||
|
DestroyWindow(window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(device = create_device(d3d, window, window, TRUE)))
|
||||||
|
{
|
||||||
|
skip("Failed to create a 3D device.\n");
|
||||||
|
IDirect3D8_Release(d3d);
|
||||||
|
DestroyWindow(window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_CreateRenderTarget(device, 128, 128, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, FALSE, &rt);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_CreateRenderTarget(device, 128, 128,
|
||||||
|
D3DFMT_A8R8G8B8, D3DMULTISAMPLE_2_SAMPLES, FALSE, &ms_rt);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_SetRenderTarget(device, ms_rt, NULL);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_BeginScene(device);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_MULTISAMPLEMASK, 0x5);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 0.0f, 0);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0]));
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_CopyRects(device, ms_rt, NULL, 0, rt, NULL);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
get_rt_readback(rt, &rb);
|
||||||
|
colour = get_readback_color(&rb, 64, 64);
|
||||||
|
ok(color_match(colour, 0xffff8080, 1), "Got unexpected colour %08x.\n", colour);
|
||||||
|
release_surface_readback(&rb);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_EndScene(device);
|
||||||
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirect3DSurface8_Release(ms_rt);
|
||||||
|
IDirect3DSurface8_Release(rt);
|
||||||
|
refcount = IDirect3DDevice8_Release(device);
|
||||||
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||||
|
IDirect3D8_Release(d3d);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(visual)
|
START_TEST(visual)
|
||||||
{
|
{
|
||||||
D3DADAPTER_IDENTIFIER8 identifier;
|
D3DADAPTER_IDENTIFIER8 identifier;
|
||||||
|
@ -11147,4 +11234,5 @@ START_TEST(visual)
|
||||||
test_sysmem_draw();
|
test_sysmem_draw();
|
||||||
test_alphatest();
|
test_alphatest();
|
||||||
test_desktop_window();
|
test_desktop_window();
|
||||||
|
test_sample_mask();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue