I don't expect d3d7 to work. But I don't have real hardware that exposes
D3DPRASTERCAPS_ROP2 to verify that.
Signed-off-by: Chip Davis <cdavis5x(a)gmail.com>
---
dlls/ddraw/tests/ddraw1.c | 139 ++++++++++++++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw2.c | 117 ++++++++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw4.c | 112 ++++++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw7.c | 102 ++++++++++++++++++++++++++++
4 files changed, 470 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index b87b7903289..1e528b79380 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -15091,6 +15091,144 @@ static void test_filling_convention(void)
DestroyWindow(window);
}
+static void test_rop2(const GUID *device_guid)
+{
+ static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
+ static D3DTLVERTEX tquad[] =
+ {
+ {{ 0.0f}, {480.0f}, {-0.5f}, {1.0f}, {0xffccff00}, {0x00000000}, {0.0f}, {0.0f}},
+ {{ 0.0f}, { 0.0f}, {-0.5f}, {1.0f}, {0xffccff00}, {0x00000000}, {0.0f}, {0.0f}},
+ {{640.0f}, {480.0f}, { 1.5f}, {1.0f}, {0xffccff00}, {0x00000000}, {0.0f}, {0.0f}},
+ {{640.0f}, { 0.0f}, { 1.5f}, {1.0f}, {0xffccff00}, {0x00000000}, {0.0f}, {0.0f}},
+ };
+ static struct
+ {
+ unsigned int rop2;
+ D3DCOLOR expected;
+ }
+ tests[] =
+ {
+ {R2_BLACK, 0x00000000},
+ {R2_NOTMERGEPEN, 0x001100ff},
+ {R2_MASKNOTPEN, 0x00220000},
+ {R2_NOTCOPYPEN, 0x003300ff},
+ {R2_MASKPENNOT, 0x0044ff00},
+ {R2_NOT, 0x0055ffff},
+ {R2_XORPEN, 0x0066ff00},
+ {R2_NOTMASKPEN, 0x0077ffff},
+ {R2_MASKPEN, 0x00880000},
+ {R2_NOTXORPEN, 0x009900ff},
+ {R2_NOP, 0x00aa0000},
+ {R2_MERGENOTPEN, 0x00bb00ff},
+ {R2_COPYPEN, 0x00ccff00},
+ {R2_MERGEPENNOT, 0x00ddffff},
+ {R2_MERGEPEN, 0x00eeff00},
+ {R2_WHITE, 0x00ffffff}
+ };
+ D3DDEVICEDESC hal_caps, hel_caps;
+ IDirect3DExecuteBuffer *execute_buffer;
+ D3DEXECUTEBUFFERDESC exec_desc;
+ IDirect3DMaterial *background;
+ IDirect3DViewport *viewport;
+ IDirect3DDevice *device;
+ IDirectDrawSurface *rt;
+ IDirectDraw *ddraw;
+ UINT inst_length;
+ D3DCOLOR color;
+ HWND window;
+ HRESULT hr;
+ UINT x, y;
+ UINT i, j, k;
+ void *ptr;
+
+ window = create_window();
+ ddraw = create_ddraw();
+ ok(!!ddraw, "Failed to create a ddraw object.\n");
+ if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ IDirectDraw_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
+
+ hal_caps.dwSize = sizeof(hal_caps);
+ hel_caps.dwSize = sizeof(hel_caps);
+ hr = IDirect3DDevice_GetCaps(device, &hal_caps, &hel_caps);
+ ok(hr == D3D_OK, "Failed to get device caps, hr %#x\n", hr);
+ if (!(hal_caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ROP2) &&
+ !(hel_caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ROP2))
+ {
+ skip("Device does not support D3DRENDERSTATE_ROP2.\n");
+ IDirect3DDevice_Release(device);
+ IDirectDraw_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
+
+ background = create_diffuse_material(device, 0.667f, 0.0f, 0.0f, 1.0f);
+ viewport = create_viewport(device, 0, 0, 640, 480);
+ viewport_set_background(device, viewport, background);
+
+ memset(&exec_desc, 0, sizeof(exec_desc));
+ exec_desc.dwSize = sizeof(exec_desc);
+ exec_desc.dwFlags = D3DDEB_BUFSIZE | D3DDEB_CAPS;
+ exec_desc.dwBufferSize = 1024;
+ exec_desc.dwCaps = D3DDEBCAPS_SYSTEMMEMORY;
+
+ hr = IDirect3DDevice_CreateExecuteBuffer(device, &exec_desc, &execute_buffer, NULL);
+ ok(SUCCEEDED(hr), "Failed to create execute buffer, hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DExecuteBuffer_Lock(execute_buffer, &exec_desc);
+ ok(SUCCEEDED(hr), "Failed to lock execute buffer, hr %#x.\n", hr);
+ memcpy(exec_desc.lpData, tquad, sizeof(tquad));
+ ptr = ((BYTE *)exec_desc.lpData) + sizeof(tquad);
+ emit_process_vertices(&ptr, D3DPROCESSVERTICES_COPY, 0, 4);
+ emit_set_rs(&ptr, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
+ emit_set_rs(&ptr, D3DRENDERSTATE_ROP2, tests[i].rop2);
+ emit_tquad(&ptr, 0);
+ emit_end(&ptr);
+ inst_length = (BYTE *)ptr - (BYTE *)exec_desc.lpData;
+ inst_length -= sizeof(tquad);
+ hr = IDirect3DExecuteBuffer_Unlock(execute_buffer);
+ ok(SUCCEEDED(hr), "Failed to unlock execute buffer, hr %#x.\n", hr);
+
+ hr = IDirect3DViewport_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
+ ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
+ hr = IDirect3DDevice_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ set_execute_data(execute_buffer, 4, sizeof(tquad), inst_length);
+ hr = IDirect3DDevice_Execute(device, execute_buffer, viewport, D3DEXECUTE_CLIPPED);
+ ok(SUCCEEDED(hr), "Failed to execute exec buffer, hr %#x.\n", hr);
+ hr = IDirect3DDevice_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
+ for (j = 0; j < 4; ++j)
+ {
+ for (k = 0; k < 4; ++k)
+ {
+ x = 80 * ((2 * k) + 1);
+ y = 60 * ((2 * j) + 1);
+ color = get_surface_color(rt, x, y);
+ ok(compare_color(color, tests[i].expected, 1),
+ "Expected color 0x%08x at %u, %u, got 0x%08x.\n", tests[i].expected, x, y, color);
+ }
+ }
+ IDirectDrawSurface_Release(rt);
+ }
+
+ destroy_viewport(device, viewport);
+ IDirect3DExecuteBuffer_Release(execute_buffer);
+ destroy_material(background);
+ IDirect3DDevice_Release(device);
+ IDirectDraw_Release(ddraw);
+ DestroyWindow(window);
+}
+
START_TEST(ddraw1)
{
DDDEVICEIDENTIFIER identifier;
@@ -15209,4 +15347,5 @@ START_TEST(ddraw1)
test_get_display_mode();
run_for_each_device_type(test_texture_wrong_caps);
test_filling_convention();
+ run_for_each_device_type(test_rop2);
}
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index eea87f4bac2..5f5008799fe 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -16031,6 +16031,122 @@ static void test_filling_convention(void)
DestroyWindow(window);
}
+static void test_rop2(const GUID *device_guid)
+{
+ static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
+ static D3DTLVERTEX tquad[] =
+ {
+ {{ 0.0f}, {480.0f}, {-0.5f}, {1.0f}, {0xffccff00}, {0x00000000}, {0.0f}, {0.0f}},
+ {{ 0.0f}, { 0.0f}, {-0.5f}, {1.0f}, {0xffccff00}, {0x00000000}, {0.0f}, {0.0f}},
+ {{640.0f}, {480.0f}, { 1.5f}, {1.0f}, {0xffccff00}, {0x00000000}, {0.0f}, {0.0f}},
+ {{640.0f}, { 0.0f}, { 1.5f}, {1.0f}, {0xffccff00}, {0x00000000}, {0.0f}, {0.0f}},
+ };
+ static struct
+ {
+ unsigned int rop2;
+ D3DCOLOR expected;
+ }
+ tests[] =
+ {
+ {R2_BLACK, 0x00000000},
+ {R2_NOTMERGEPEN, 0x001100ff},
+ {R2_MASKNOTPEN, 0x00220000},
+ {R2_NOTCOPYPEN, 0x003300ff},
+ {R2_MASKPENNOT, 0x0044ff00},
+ {R2_NOT, 0x0055ffff},
+ {R2_XORPEN, 0x0066ff00},
+ {R2_NOTMASKPEN, 0x0077ffff},
+ {R2_MASKPEN, 0x00880000},
+ {R2_NOTXORPEN, 0x009900ff},
+ {R2_NOP, 0x00aa0000},
+ {R2_MERGENOTPEN, 0x00bb00ff},
+ {R2_COPYPEN, 0x00ccff00},
+ {R2_MERGEPENNOT, 0x00ddffff},
+ {R2_MERGEPEN, 0x00eeff00},
+ {R2_WHITE, 0x00ffffff}
+ };
+ D3DDEVICEDESC hal_caps, hel_caps;
+ IDirect3DMaterial2 *background;
+ IDirect3DViewport2 *viewport;
+ IDirect3DDevice2 *device;
+ IDirectDrawSurface *rt;
+ IDirectDraw2 *ddraw;
+ D3DCOLOR color;
+ HWND window;
+ HRESULT hr;
+ UINT x, y;
+ UINT i, j, k;
+
+ window = create_window();
+ ddraw = create_ddraw();
+ ok(!!ddraw, "Failed to create a ddraw object.\n");
+ if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ IDirectDraw_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
+
+ hal_caps.dwSize = sizeof(hal_caps);
+ hel_caps.dwSize = sizeof(hel_caps);
+ IDirect3DDevice2_GetCaps(device, &hal_caps, &hel_caps);
+ if (!(hal_caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ROP2) &&
+ !(hel_caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ROP2))
+ {
+ skip("Device does not support D3DRENDERSTATE_ROP2.\n");
+ IDirect3DDevice2_Release(device);
+ IDirectDraw_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
+
+ background = create_diffuse_material(device, 0.667f, 0.0f, 0.0f, 1.0f);
+ viewport = create_viewport(device, 0, 0, 640, 480);
+ viewport_set_background(device, viewport, background);
+ hr = IDirect3DDevice2_SetCurrentViewport(device, viewport);
+ ok(SUCCEEDED(hr), "Failed to set current viewport, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
+ ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ROP2, tests[i].rop2);
+ ok(SUCCEEDED(hr), "Failed to set raster op, hr %#x.\n", hr);
+
+ hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
+ ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
+ hr = IDirect3DDevice2_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_TLVERTEX, tquad, 4, 0);
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice2_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice2_GetRenderTarget(device, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
+ for (j = 0; j < 4; ++j)
+ {
+ for (k = 0; k < 4; ++k)
+ {
+ x = 80 * ((2 * k) + 1);
+ y = 60 * ((2 * j) + 1);
+ color = get_surface_color(rt, x, y);
+ ok(compare_color(color, tests[i].expected, 1),
+ "Expected color 0x%08x at %u, %u, got 0x%08x.\n", tests[i].expected, x, y, color);
+ }
+ }
+ IDirectDrawSurface_Release(rt);
+ }
+
+ destroy_viewport(device, viewport);
+ destroy_material(background);
+ IDirect3DDevice2_Release(device);
+ IDirectDraw2_Release(ddraw);
+ DestroyWindow(window);
+}
+
static void run_for_each_device_type(void (*test_func)(const GUID *))
{
test_func(&IID_IDirect3DHALDevice);
@@ -16161,4 +16277,5 @@ START_TEST(ddraw2)
test_get_display_mode();
run_for_each_device_type(test_texture_wrong_caps);
test_filling_convention();
+ run_for_each_device_type(test_rop2);
}
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 136cf90fa60..7b3216001cd 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -19089,6 +19089,117 @@ static void test_filling_convention(void)
DestroyWindow(window);
}
+static void test_rop2(const GUID *device_guid)
+{
+ static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
+ static struct
+ {
+ struct vec4 position;
+ D3DCOLOR diffuse;
+ }
+ tquad[] =
+ {
+ {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffccff00},
+ {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffccff00},
+ {{640.0f, 480.0f, 1.5f, 1.0f}, 0xffccff00},
+ {{640.0f, 0.0f, 1.5f, 1.0f}, 0xffccff00}
+ };
+ static struct
+ {
+ unsigned int rop2;
+ D3DCOLOR expected;
+ }
+ tests[] =
+ {
+ {R2_BLACK, 0x00000000},
+ {R2_NOTMERGEPEN, 0x001100ff},
+ {R2_MASKNOTPEN, 0x00220000},
+ {R2_NOTCOPYPEN, 0x003300ff},
+ {R2_MASKPENNOT, 0x0044ff00},
+ {R2_NOT, 0x0055ffff},
+ {R2_XORPEN, 0x0066ff00},
+ {R2_NOTMASKPEN, 0x0077ffff},
+ {R2_MASKPEN, 0x00880000},
+ {R2_NOTXORPEN, 0x009900ff},
+ {R2_NOP, 0x00aa0000},
+ {R2_MERGENOTPEN, 0x00bb00ff},
+ {R2_COPYPEN, 0x00ccff00},
+ {R2_MERGEPENNOT, 0x00ddffff},
+ {R2_MERGEPEN, 0x00eeff00},
+ {R2_WHITE, 0x00ffffff}
+ };
+ D3DDEVICEDESC hal_caps, hel_caps;
+ IDirect3DViewport3 *viewport;
+ IDirect3DDevice3 *device;
+ IDirectDrawSurface4 *rt;
+ D3DCOLOR color;
+ HWND window;
+ HRESULT hr;
+ UINT x, y;
+ UINT i, j, k;
+
+ window = create_window();
+ if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+
+ hal_caps.dwSize = sizeof(hal_caps);
+ hel_caps.dwSize = sizeof(hel_caps);
+ IDirect3DDevice3_GetCaps(device, &hal_caps, &hel_caps);
+ if (!(hal_caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ROP2) &&
+ !(hel_caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ROP2))
+ {
+ skip("Device does not support D3DRENDERSTATE_ROP2.\n");
+ IDirect3DDevice3_Release(device);
+ DestroyWindow(window);
+ return;
+ }
+
+ viewport = create_viewport(device, 0, 0, 640, 480);
+ hr = IDirect3DDevice3_SetCurrentViewport(device, viewport);
+ ok(SUCCEEDED(hr), "Failed to set current viewport, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
+ ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ROP2, tests[i].rop2);
+ ok(SUCCEEDED(hr), "Failed to set raster op, hr %#x.\n", hr);
+
+ hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffaa0000, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
+ hr = IDirect3DDevice3_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE, tquad, 4, 0);
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice3_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice3_GetRenderTarget(device, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
+ for (j = 0; j < 4; ++j)
+ {
+ for (k = 0; k < 4; ++k)
+ {
+ x = 80 * ((2 * k) + 1);
+ y = 60 * ((2 * j) + 1);
+ color = get_surface_color(rt, x, y);
+ ok(compare_color(color, tests[i].expected, 1),
+ "Expected color 0x%08x at %u, %u, got 0x%08x.\n", tests[i].expected, x, y, color);
+ }
+ }
+ IDirectDrawSurface4_Release(rt);
+ }
+
+ destroy_viewport(device, viewport);
+ IDirect3DDevice3_Release(device);
+ DestroyWindow(window);
+}
+
START_TEST(ddraw4)
{
DDDEVICEIDENTIFIER identifier;
@@ -19229,4 +19340,5 @@ START_TEST(ddraw4)
test_get_display_mode();
run_for_each_device_type(test_texture_wrong_caps);
test_filling_convention();
+ run_for_each_device_type(test_rop2);
}
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 711eac2a6d6..a22e3942f39 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -19324,6 +19324,107 @@ static void test_filling_convention(void)
DestroyWindow(window);
}
+static void test_rop2(const GUID *device_guid)
+{
+ static struct
+ {
+ struct vec4 position;
+ D3DCOLOR diffuse;
+ }
+ tquad[] =
+ {
+ {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffccff00},
+ {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffccff00},
+ {{640.0f, 480.0f, 1.5f, 1.0f}, 0xffccff00},
+ {{640.0f, 0.0f, 1.5f, 1.0f}, 0xffccff00}
+ };
+ static struct
+ {
+ unsigned int rop2;
+ D3DCOLOR expected;
+ }
+ tests[] =
+ {
+ {R2_BLACK, 0x00000000},
+ {R2_NOTMERGEPEN, 0x001100ff},
+ {R2_MASKNOTPEN, 0x00220000},
+ {R2_NOTCOPYPEN, 0x003300ff},
+ {R2_MASKPENNOT, 0x0044ff00},
+ {R2_NOT, 0x0055ffff},
+ {R2_XORPEN, 0x0066ff00},
+ {R2_NOTMASKPEN, 0x0077ffff},
+ {R2_MASKPEN, 0x00880000},
+ {R2_NOTXORPEN, 0x009900ff},
+ {R2_NOP, 0x00aa0000},
+ {R2_MERGENOTPEN, 0x00bb00ff},
+ {R2_COPYPEN, 0x00ccff00},
+ {R2_MERGEPENNOT, 0x00ddffff},
+ {R2_MERGEPEN, 0x00eeff00},
+ {R2_WHITE, 0x00ffffff}
+ };
+ D3DDEVICEDESC7 caps;
+ IDirect3DDevice7 *device;
+ IDirectDrawSurface7 *rt;
+ D3DCOLOR color;
+ HWND window;
+ HRESULT hr;
+ UINT x, y;
+ UINT i, j, k;
+
+ window = create_window();
+ if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+
+ IDirect3DDevice7_GetCaps(device, &caps);
+ if (!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ROP2))
+ {
+ skip("Device does not support D3DRENDERSTATE_ROP2.\n");
+ IDirect3DDevice7_Release(device);
+ DestroyWindow(window);
+ return;
+ }
+
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
+ ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ROP2, tests[i].rop2);
+ ok(SUCCEEDED(hr), "Failed to set raster op, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffaa0000, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE, tquad, 4, 0);
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_GetRenderTarget(device, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
+ for (j = 0; j < 4; ++j)
+ {
+ for (k = 0; k < 4; ++k)
+ {
+ x = 80 * ((2 * k) + 1);
+ y = 60 * ((2 * j) + 1);
+ color = get_surface_color(rt, x, y);
+ ok(compare_color(color, tests[i].expected, 1),
+ "Expected color 0x%08x at %u, %u, got 0x%08x.\n", tests[i].expected, x, y, color);
+ }
+ }
+ IDirectDrawSurface7_Release(rt);
+ }
+
+ IDirect3DDevice7_Release(device);
+ DestroyWindow(window);
+}
+
static void run_for_each_device_type(void (*test_func)(const GUID *))
{
test_func(hw_device_guid);
@@ -19502,4 +19603,5 @@ START_TEST(ddraw7)
test_get_display_mode();
run_for_each_device_type(test_texture_wrong_caps);
test_filling_convention();
+ run_for_each_device_type(test_rop2);
}
--
2.34.1