Commit ce09d363 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Properly flip through the swap chain in ddraw_surface7_Flip().

parent 7524258a
......@@ -1209,27 +1209,44 @@ static HRESULT WINAPI ddraw_surface7_Flip(IDirectDrawSurface7 *iface, IDirectDra
return DDERR_NOTFLIPPABLE;
}
}
if (rt == dst_impl->wined3d_surface)
wined3d_device_set_render_target(dst_impl->ddraw->wined3d_device, 0, src_impl->wined3d_surface, FALSE);
wined3d_resource_set_parent(wined3d_surface_get_resource(src_impl->wined3d_surface), dst_impl);
dst_impl->wined3d_surface = src_impl->wined3d_surface;
wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture),
wined3d_texture_get_parent(dst_impl->wined3d_texture));
dst_impl->wined3d_texture = src_impl->wined3d_texture;
}
else
{
if (FAILED(hr = ddraw_surface7_GetAttachedSurface(iface, &caps, &current)))
for (current = iface;;)
{
ERR("Can't find a flip target\n");
wined3d_mutex_unlock();
return DDERR_NOTFLIPPABLE; /* Unchecked */
if (FAILED(hr = ddraw_surface7_GetAttachedSurface(current, &caps, &current)))
{
ERR("Can't find a flip target\n");
wined3d_mutex_unlock();
return DDERR_NOTFLIPPABLE; /* Unchecked */
}
ddraw_surface7_Release(current);
if (current == iface)
{
dst_impl = impl_from_IDirectDrawSurface7(iface);
break;
}
src_impl = impl_from_IDirectDrawSurface7(current);
if (rt == dst_impl->wined3d_surface)
wined3d_device_set_render_target(dst_impl->ddraw->wined3d_device, 0, src_impl->wined3d_surface, FALSE);
wined3d_resource_set_parent(wined3d_surface_get_resource(src_impl->wined3d_surface), dst_impl);
dst_impl->wined3d_surface = src_impl->wined3d_surface;
wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture),
wined3d_texture_get_parent(dst_impl->wined3d_texture));
dst_impl->wined3d_texture = src_impl->wined3d_texture;
dst_impl = src_impl;
}
src_impl = impl_from_IDirectDrawSurface7(current);
ddraw_surface7_Release(current);
}
if (rt == dst_impl->wined3d_surface)
wined3d_device_set_render_target(dst_impl->ddraw->wined3d_device, 0, src_impl->wined3d_surface, FALSE);
wined3d_resource_set_parent(wined3d_surface_get_resource(src_impl->wined3d_surface), dst_impl);
dst_impl->wined3d_surface = src_impl->wined3d_surface;
wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture),
wined3d_texture_get_parent(dst_impl->wined3d_texture));
dst_impl->wined3d_texture = src_impl->wined3d_texture;
/* We don't have to worry about potential texture bindings, since
* flippable surfaces can never be textures. */
if (rt == src_impl->wined3d_surface)
......
......@@ -3803,10 +3803,10 @@ static void test_flip(void)
color = get_surface_color(backbuffer1, 320, 240);
/* The testbot seems to just copy the contents of one surface to all the
* others, instead of properly flipping. */
todo_wine ok(compare_color(color, 0x0000ff00, 1) || broken(sysmem_primary && compare_color(color, 0x000000ff, 1)),
ok(compare_color(color, 0x0000ff00, 1) || broken(sysmem_primary && compare_color(color, 0x000000ff, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 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);
U5(fx).dwFillColor = 0xffff0000;
hr = IDirectDrawSurface_Blt(backbuffer3, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(SUCCEEDED(hr), "Failed to fill surface, hr %#x.\n", hr);
......@@ -3814,10 +3814,10 @@ static void test_flip(void)
hr = IDirectDrawSurface_Flip(primary, NULL, DDFLIP_WAIT);
ok(SUCCEEDED(hr), "Failed to flip, hr %#x.\n", hr);
color = get_surface_color(backbuffer1, 320, 240);
todo_wine ok(compare_color(color, 0x000000ff, 1) || broken(sysmem_primary && compare_color(color, 0x00ff0000, 1)),
ok(compare_color(color, 0x000000ff, 1) || broken(sysmem_primary && compare_color(color, 0x00ff0000, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 320, 240);
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
U5(fx).dwFillColor = 0xff00ff00;
hr = IDirectDrawSurface_Blt(backbuffer3, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(SUCCEEDED(hr), "Failed to fill surface, hr %#x.\n", hr);
......@@ -3825,7 +3825,7 @@ static void test_flip(void)
hr = IDirectDrawSurface_Flip(primary, NULL, DDFLIP_WAIT);
ok(SUCCEEDED(hr), "Failed to flip, hr %#x.\n", hr);
color = get_surface_color(backbuffer1, 320, 240);
todo_wine ok(compare_color(color, 0x00ff0000, 1) || broken(sysmem_primary && compare_color(color, 0x0000ff00, 1)),
ok(compare_color(color, 0x00ff0000, 1) || broken(sysmem_primary && compare_color(color, 0x0000ff00, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 320, 240);
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
......
......@@ -4484,10 +4484,10 @@ static void test_flip(void)
color = get_surface_color(backbuffer1, 320, 240);
/* The testbot seems to just copy the contents of one surface to all the
* others, instead of properly flipping. */
todo_wine ok(compare_color(color, 0x0000ff00, 1) || broken(sysmem_primary && compare_color(color, 0x000000ff, 1)),
ok(compare_color(color, 0x0000ff00, 1) || broken(sysmem_primary && compare_color(color, 0x000000ff, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 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);
U5(fx).dwFillColor = 0xffff0000;
hr = IDirectDrawSurface_Blt(backbuffer3, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(SUCCEEDED(hr), "Failed to fill surface, hr %#x.\n", hr);
......@@ -4495,10 +4495,10 @@ static void test_flip(void)
hr = IDirectDrawSurface_Flip(primary, NULL, DDFLIP_WAIT);
ok(SUCCEEDED(hr), "Failed to flip, hr %#x.\n", hr);
color = get_surface_color(backbuffer1, 320, 240);
todo_wine ok(compare_color(color, 0x000000ff, 1) || broken(sysmem_primary && compare_color(color, 0x00ff0000, 1)),
ok(compare_color(color, 0x000000ff, 1) || broken(sysmem_primary && compare_color(color, 0x00ff0000, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 320, 240);
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
U5(fx).dwFillColor = 0xff00ff00;
hr = IDirectDrawSurface_Blt(backbuffer3, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(SUCCEEDED(hr), "Failed to fill surface, hr %#x.\n", hr);
......@@ -4506,7 +4506,7 @@ static void test_flip(void)
hr = IDirectDrawSurface_Flip(primary, NULL, DDFLIP_WAIT);
ok(SUCCEEDED(hr), "Failed to flip, hr %#x.\n", hr);
color = get_surface_color(backbuffer1, 320, 240);
todo_wine ok(compare_color(color, 0x00ff0000, 1) || broken(sysmem_primary && compare_color(color, 0x0000ff00, 1)),
ok(compare_color(color, 0x00ff0000, 1) || broken(sysmem_primary && compare_color(color, 0x0000ff00, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 320, 240);
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
......
......@@ -5088,10 +5088,10 @@ static void test_flip(void)
color = get_surface_color(backbuffer1, 320, 240);
/* The testbot seems to just copy the contents of one surface to all the
* others, instead of properly flipping. */
todo_wine ok(compare_color(color, 0x0000ff00, 1) || broken(sysmem_primary && compare_color(color, 0x000000ff, 1)),
ok(compare_color(color, 0x0000ff00, 1) || broken(sysmem_primary && compare_color(color, 0x000000ff, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 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);
U5(fx).dwFillColor = 0xffff0000;
hr = IDirectDrawSurface4_Blt(backbuffer3, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(SUCCEEDED(hr), "Failed to fill surface, hr %#x.\n", hr);
......@@ -5099,10 +5099,10 @@ static void test_flip(void)
hr = IDirectDrawSurface4_Flip(primary, NULL, DDFLIP_WAIT);
ok(SUCCEEDED(hr), "Failed to flip, hr %#x.\n", hr);
color = get_surface_color(backbuffer1, 320, 240);
todo_wine ok(compare_color(color, 0x000000ff, 1) || broken(sysmem_primary && compare_color(color, 0x00ff0000, 1)),
ok(compare_color(color, 0x000000ff, 1) || broken(sysmem_primary && compare_color(color, 0x00ff0000, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 320, 240);
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
U5(fx).dwFillColor = 0xff00ff00;
hr = IDirectDrawSurface4_Blt(backbuffer3, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(SUCCEEDED(hr), "Failed to fill surface, hr %#x.\n", hr);
......@@ -5110,7 +5110,7 @@ static void test_flip(void)
hr = IDirectDrawSurface4_Flip(primary, NULL, DDFLIP_WAIT);
ok(SUCCEEDED(hr), "Failed to flip, hr %#x.\n", hr);
color = get_surface_color(backbuffer1, 320, 240);
todo_wine ok(compare_color(color, 0x00ff0000, 1) || broken(sysmem_primary && compare_color(color, 0x0000ff00, 1)),
ok(compare_color(color, 0x00ff0000, 1) || broken(sysmem_primary && compare_color(color, 0x0000ff00, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 320, 240);
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
......
......@@ -4975,10 +4975,10 @@ static void test_flip(void)
color = get_surface_color(backbuffer1, 320, 240);
/* The testbot seems to just copy the contents of one surface to all the
* others, instead of properly flipping. */
todo_wine ok(compare_color(color, 0x0000ff00, 1) || broken(sysmem_primary && compare_color(color, 0x000000ff, 1)),
ok(compare_color(color, 0x0000ff00, 1) || broken(sysmem_primary && compare_color(color, 0x000000ff, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 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);
U5(fx).dwFillColor = 0xffff0000;
hr = IDirectDrawSurface7_Blt(backbuffer3, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(SUCCEEDED(hr), "Failed to fill surface, hr %#x.\n", hr);
......@@ -4986,10 +4986,10 @@ static void test_flip(void)
hr = IDirectDrawSurface7_Flip(primary, NULL, DDFLIP_WAIT);
ok(SUCCEEDED(hr), "Failed to flip, hr %#x.\n", hr);
color = get_surface_color(backbuffer1, 320, 240);
todo_wine ok(compare_color(color, 0x000000ff, 1) || broken(sysmem_primary && compare_color(color, 0x00ff0000, 1)),
ok(compare_color(color, 0x000000ff, 1) || broken(sysmem_primary && compare_color(color, 0x00ff0000, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 320, 240);
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
U5(fx).dwFillColor = 0xff00ff00;
hr = IDirectDrawSurface7_Blt(backbuffer3, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(SUCCEEDED(hr), "Failed to fill surface, hr %#x.\n", hr);
......@@ -4997,7 +4997,7 @@ static void test_flip(void)
hr = IDirectDrawSurface7_Flip(primary, NULL, DDFLIP_WAIT);
ok(SUCCEEDED(hr), "Failed to flip, hr %#x.\n", hr);
color = get_surface_color(backbuffer1, 320, 240);
todo_wine ok(compare_color(color, 0x00ff0000, 1) || broken(sysmem_primary && compare_color(color, 0x0000ff00, 1)),
ok(compare_color(color, 0x00ff0000, 1) || broken(sysmem_primary && compare_color(color, 0x0000ff00, 1)),
"Got unexpected color 0x%08x.\n", color);
color = get_surface_color(backbuffer2, 320, 240);
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment