From 4905773bafc63b748d2e780c7c331f46f39ecd44 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 24 May 2012 18:27:40 +0200 Subject: [PATCH] ddraw: Only initially enable color keying for version 1 devices. --- dlls/ddraw/device.c | 2 ++ dlls/ddraw/executebuffer.c | 6 +----- dlls/ddraw/tests/ddraw1.c | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 37775acabe8..c79c6aaa9b1 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -6646,6 +6646,8 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, wined3d_device_set_render_state(ddraw->wined3d_device, WINED3D_RS_ZENABLE, d3d_device_update_depth_stencil(device)); + if (version == 1) /* Color keying is initially enabled for version 1 devices. */ + wined3d_device_set_render_state(ddraw->wined3d_device, WINED3D_RS_COLORKEYENABLE, TRUE); return D3D_OK; } diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c index a217d9a5c80..85625c1beb9 100644 --- a/dlls/ddraw/executebuffer.c +++ b/dlls/ddraw/executebuffer.c @@ -131,11 +131,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, buffer->indices[(i * 3) + 1] = ci->u2.v2; buffer->indices[(i * 3) + 2] = ci->u3.v3; instr += size; - } - /* IDirect3DDevices have color keying always enabled - - * enable it before drawing. This overwrites any ALPHA* - * render state. */ - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_COLORKEYENABLE, 1); + } IDirect3DDevice7_DrawIndexedPrimitive(&device->IDirect3DDevice7_iface, D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, buffer->indices, count * 3, 0); } break; diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 6063220ac99..132cc93e2a6 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -1244,7 +1244,7 @@ static void test_ck_rgba(void) ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = get_surface_color(rt, 320, 240); - if (i == 2 || i == 3) + if (i == 2) todo_wine ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n", tests[i].result1, i, color); else @@ -1266,7 +1266,7 @@ static void test_ck_rgba(void) /* This tests that fragments that are masked out by the color key are * discarded, instead of just fully transparent. */ color = get_surface_color(rt, 320, 240); - if (i == 2 || i == 3) + if (i == 2) todo_wine ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n", tests[i].result2, i, color); else @@ -1427,7 +1427,7 @@ static void test_ck_default(void) hr = IDirect3DDevice_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = get_surface_color(rt, 320, 240); - todo_wine ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); + ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); hr = IDirect3DViewport_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET); ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr); @@ -1439,7 +1439,7 @@ static void test_ck_default(void) hr = IDirect3DDevice_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = get_surface_color(rt, 320, 240); - todo_wine ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); + ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); hr = IDirect3DViewport_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET); ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);