Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49391 Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/ddraw/surface.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 899bc77d1b9..cbcfc16546a 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1293,6 +1293,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7 DDSCAPS2 caps = {DDSCAPS_FLIP, 0, 0, {0}}; struct wined3d_texture *texture; IDirectDrawSurface7 *current; + void *texture_memory; HRESULT hr;
TRACE("iface %p, src %p, flags %#x.\n", iface, src, flags); @@ -1347,6 +1348,10 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7 wined3d_texture_set_sub_resource_parent(src_impl->wined3d_texture, 0, dst_impl); prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture); wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture), ddraw_texture); + texture_memory = ddraw_texture->texture_memory; + ddraw_texture->texture_memory = prev_ddraw_texture->texture_memory; + prev_ddraw_texture->texture_memory = texture_memory; + if (src_impl->sub_resource_idx) ERR("Invalid sub-resource index %u on surface %p.\n", src_impl->sub_resource_idx, src_impl); dst_impl->wined3d_texture = src_impl->wined3d_texture; @@ -1378,6 +1383,10 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7 wined3d_texture_set_sub_resource_parent(src_impl->wined3d_texture, 0, dst_impl); prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture); wined3d_resource_set_parent(wined3d_texture_get_resource(src_impl->wined3d_texture), ddraw_texture); + texture_memory = ddraw_texture->texture_memory; + ddraw_texture->texture_memory = prev_ddraw_texture->texture_memory; + prev_ddraw_texture->texture_memory = texture_memory; + ddraw_texture = prev_ddraw_texture; if (src_impl->sub_resource_idx) ERR("Invalid sub-resource index %u on surface %p.\n", src_impl->sub_resource_idx, src_impl);