ddraw: Require exclusive mode only for primary surface flips.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-04-21 17:05:09 +02:00 committed by Alexandre Julliard
parent 1736431c68
commit 7cabef1457
5 changed files with 66 additions and 9 deletions

View File

@ -1235,7 +1235,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
wined3d_mutex_lock();
if (!(dst_impl->ddraw->cooperative_level & DDSCL_EXCLUSIVE))
if ((dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
&& !(dst_impl->ddraw->cooperative_level & DDSCL_EXCLUSIVE))
{
WARN("Not in exclusive mode.\n");
wined3d_mutex_unlock();

View File

@ -4197,8 +4197,6 @@ static void test_flip(void)
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
@ -4233,6 +4231,22 @@ static void test_flip(void)
if (FAILED(hr))
continue;
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "%s: Failed to set cooperative level, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface_IsLost(frontbuffer);
ok(hr == DD_OK, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface_Flip(frontbuffer, NULL, DDFLIP_WAIT);
if (test_data[i].caps & DDSCAPS_PRIMARYSURFACE)
ok(hr == DDERR_NOEXCLUSIVEMODE, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
else
ok(SUCCEEDED(hr), "%s: Failed to flip, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "%s: Failed to set cooperative level, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface_IsLost(frontbuffer);
todo_wine ok(hr == DDERR_SURFACELOST, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
hr = restore_surfaces(ddraw);
ok(SUCCEEDED(hr), "%s: Failed to restore surfaces, hr %#x.\n", test_data[i].name, hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(frontbuffer, &surface_desc);

View File

@ -4830,8 +4830,6 @@ static void test_flip(void)
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
@ -4866,6 +4864,22 @@ static void test_flip(void)
if (FAILED(hr))
continue;
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "%s: Failed to set cooperative level, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface_IsLost(frontbuffer);
ok(hr == DD_OK, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface_Flip(frontbuffer, NULL, DDFLIP_WAIT);
if (test_data[i].caps & DDSCAPS_PRIMARYSURFACE)
ok(hr == DDERR_NOEXCLUSIVEMODE, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
else
ok(SUCCEEDED(hr), "%s: Failed to flip, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "%s: Failed to set cooperative level, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface_IsLost(frontbuffer);
todo_wine ok(hr == DDERR_SURFACELOST, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
hr = restore_surfaces(ddraw);
ok(SUCCEEDED(hr), "%s: Failed to restore surfaces, hr %#x.\n", test_data[i].name, hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(frontbuffer, &surface_desc);

View File

@ -6150,8 +6150,6 @@ static void test_flip(void)
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
@ -6239,6 +6237,22 @@ static void test_flip(void)
test_data[i].name, surface, frontbuffer);
IDirectDrawSurface4_Release(surface);
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "%s: Failed to set cooperative level, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface4_IsLost(frontbuffer);
ok(hr == DD_OK, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface4_Flip(frontbuffer, NULL, DDFLIP_WAIT);
if (test_data[i].caps & DDSCAPS_PRIMARYSURFACE)
ok(hr == DDERR_NOEXCLUSIVEMODE, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
else
ok(SUCCEEDED(hr), "%s: Failed to flip, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "%s: Failed to set cooperative level, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface4_IsLost(frontbuffer);
todo_wine ok(hr == DDERR_SURFACELOST, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
hr = IDirectDraw4_RestoreAllSurfaces(ddraw);
ok(SUCCEEDED(hr), "%s: Failed to restore surfaces, hr %#x.\n", test_data[i].name, hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;

View File

@ -6018,8 +6018,6 @@ static void test_flip(void)
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = set_display_mode(ddraw, 640, 480);
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
@ -6109,6 +6107,22 @@ static void test_flip(void)
test_data[i].name, surface, frontbuffer);
IDirectDrawSurface7_Release(surface);
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "%s: Failed to set cooperative level, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface7_IsLost(frontbuffer);
ok(hr == DD_OK, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface7_Flip(frontbuffer, NULL, DDFLIP_WAIT);
if (test_data[i].caps & DDSCAPS_PRIMARYSURFACE)
ok(hr == DDERR_NOEXCLUSIVEMODE, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
else
ok(SUCCEEDED(hr), "%s: Failed to flip, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "%s: Failed to set cooperative level, hr %#x.\n", test_data[i].name, hr);
hr = IDirectDrawSurface7_IsLost(frontbuffer);
todo_wine ok(hr == DDERR_SURFACELOST, "%s: Got unexpected hr %#x.\n", test_data[i].name, hr);
hr = IDirectDraw7_RestoreAllSurfaces(ddraw);
ok(SUCCEEDED(hr), "%s: Failed to restore surfaces, hr %#x.\n", test_data[i].name, hr);
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;