Zebediah Figura : d3d8/tests: Port test_sample_mask() from d3d9.
Alexandre Julliard
julliard at winehq.org
Mon May 3 16:37:06 CDT 2021
Module: wine
Branch: master
Commit: 30fe080965409e68cc86a04af1935e4944f4b049
URL: https://source.winehq.org/git/wine.git/?a=commit;h=30fe080965409e68cc86a04af1935e4944f4b049
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Fri Apr 30 11:08:26 2021 -0500
d3d8/tests: Port test_sample_mask() from d3d9.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d8/tests/visual.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index fc8a05a3c40..f25549388d0 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -11070,6 +11070,93 @@ static void test_desktop_window(void)
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)
{
D3DADAPTER_IDENTIFIER8 identifier;
@@ -11147,4 +11234,5 @@ START_TEST(visual)
test_sysmem_draw();
test_alphatest();
test_desktop_window();
+ test_sample_mask();
}
More information about the wine-cvs
mailing list