Added patches to revert "move mip-level dimensions fixup" (causes regressions in multiple games).

This commit is contained in:
Sebastian Lackner 2016-02-07 18:56:22 +01:00
parent 1e5b8f9940
commit 20a201f51a
5 changed files with 274 additions and 98 deletions

View File

@ -0,0 +1,90 @@
From 4227226984e3726aba1b0570db87679776842c5a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 7 Feb 2016 18:52:16 +0100
Subject: Revert "ddraw: Use wined3d_texture_get_sub_resource() in
ddraw_surface7_Flip()."
This reverts commit b1709522307a160a7c151f5293095a3c26ab998f.
---
dlls/ddraw/surface.c | 6 +++---
dlls/wined3d/surface.c | 7 +++++++
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 1 +
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index f1ba858..a6fbceb 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -1268,7 +1268,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE);
wined3d_rendertarget_view_set_parent(src_rtv, dst_impl);
dst_impl->wined3d_rtv = src_rtv;
- wined3d_resource_set_parent(wined3d_texture_get_sub_resource(src_impl->wined3d_texture, 0), dst_impl);
+ wined3d_resource_set_parent(wined3d_surface_get_resource(src_impl->wined3d_surface), dst_impl);
dst_impl->wined3d_surface = src_impl->wined3d_surface;
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);
@@ -1300,7 +1300,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE);
wined3d_rendertarget_view_set_parent(src_rtv, dst_impl);
dst_impl->wined3d_rtv = src_rtv;
- wined3d_resource_set_parent(wined3d_texture_get_sub_resource(src_impl->wined3d_texture, 0), dst_impl);
+ wined3d_resource_set_parent(wined3d_surface_get_resource(src_impl->wined3d_surface), dst_impl);
dst_impl->wined3d_surface = src_impl->wined3d_surface;
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);
@@ -1318,7 +1318,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, tmp_rtv, FALSE);
wined3d_rendertarget_view_set_parent(tmp_rtv, src_impl);
src_impl->wined3d_rtv = tmp_rtv;
- wined3d_resource_set_parent(wined3d_texture_get_sub_resource(texture, 0), src_impl);
+ wined3d_resource_set_parent(wined3d_surface_get_resource(tmp), src_impl);
src_impl->wined3d_surface = tmp;
wined3d_resource_set_parent(wined3d_texture_get_resource(texture), ddraw_texture);
src_impl->wined3d_texture = texture;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 2a36619..e6c6258 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1890,6 +1890,13 @@ void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface)
return surface->resource.parent;
}
+struct wined3d_resource * CDECL wined3d_surface_get_resource(struct wined3d_surface *surface)
+{
+ TRACE("surface %p.\n", surface);
+
+ return &surface->resource;
+}
+
DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
{
unsigned int alignment;
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 86d03f0..c07e0ca 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -225,6 +225,7 @@
@ cdecl wined3d_surface_get_overlay_position(ptr ptr ptr)
@ cdecl wined3d_surface_get_parent(ptr)
@ cdecl wined3d_surface_get_pitch(ptr)
+@ cdecl wined3d_surface_get_resource(ptr)
@ cdecl wined3d_surface_set_overlay_position(ptr long long)
@ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr)
@ cdecl wined3d_surface_update_overlay_z_order(ptr long ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 8f9d80a..1b13a20 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2477,6 +2477,7 @@ ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
HRESULT __cdecl wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y);
void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface);
DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface);
+struct wined3d_resource * __cdecl wined3d_surface_get_resource(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y);
HRESULT __cdecl wined3d_surface_update_overlay(struct wined3d_surface *surface, const RECT *src_rect,
struct wined3d_surface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx);
--
2.7.0

View File

@ -0,0 +1,64 @@
From e70e6047539d266d0b7101e92ba789eed5cf9928 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 7 Feb 2016 18:52:49 +0100
Subject: Revert "ddraw: Move the mip-level dimensions fix-up from
ddraw_surface_init() to ddraw_surface_create()."
This reverts commit 7d45318aeac41e2efabb9ddfbf95ecbea103e67d.
---
dlls/ddraw/surface.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index a6fbceb..923a935 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -5643,8 +5643,8 @@ static HRESULT CDECL ddraw_reset_enum_callback(struct wined3d_resource *resource
HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc,
struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version)
{
- struct wined3d_resource_desc wined3d_desc, wined3d_mip_desc;
struct ddraw_surface *root, *mip, **attach;
+ struct wined3d_resource_desc wined3d_desc;
struct wined3d_texture *wined3d_texture;
struct wined3d_resource *resource;
struct wined3d_display_mode mode;
@@ -6103,17 +6103,9 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
mip_desc = &mip->surface_desc;
if (j)
- {
- wined3d_resource_get_desc(resource, &wined3d_mip_desc);
- mip_desc->dwWidth = wined3d_mip_desc.width;
- mip_desc->dwHeight = wined3d_mip_desc.height;
-
mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL;
- }
else
- {
mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL;
- }
if (mip_desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
{
@@ -6241,6 +6233,7 @@ void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
{
struct ddraw_texture *texture = wined3d_texture_get_parent(wined3d_texture);
DDSURFACEDESC2 *desc = &surface->surface_desc;
+ struct wined3d_resource_desc wined3d_desc;
unsigned int version = texture->version;
surface->IDirectDrawSurface7_iface.lpVtbl = &ddraw_surface7_vtbl;
@@ -6272,6 +6265,9 @@ void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
}
*desc = texture->surface_desc;
+ wined3d_resource_get_desc(wined3d_surface_get_resource(wined3d_surface), &wined3d_desc);
+ desc->dwWidth = wined3d_desc.width;
+ desc->dwHeight = wined3d_desc.height;
surface->first_attached = surface;
if (format_is_compressed(&desc->u4.ddpfPixelFormat))
--
2.7.0

View File

@ -0,0 +1 @@
Fixes: [40094] Revert patches to move mip-level dimensions fixup (causes regressions in multiple games)

View File

@ -126,6 +126,7 @@ patch_enable_all ()
enable_ddraw_EnumSurfaces="$1"
enable_ddraw_IDirect3DTexture2_Load="$1"
enable_ddraw_Rendering_Targets="$1"
enable_ddraw_Revert_Surface_Init="$1"
enable_ddraw_Write_Vtable="$1"
enable_ddraw_ZBufferBitDepths="$1"
enable_ddraw_d3d_execute_buffer="$1"
@ -525,6 +526,9 @@ patch_enable ()
ddraw-Rendering_Targets)
enable_ddraw_Rendering_Targets="$2"
;;
ddraw-Revert_Surface_Init)
enable_ddraw_Revert_Surface_Init="$2"
;;
ddraw-Write_Vtable)
enable_ddraw_Write_Vtable="$2"
;;
@ -3304,6 +3308,23 @@ if test "$enable_ddraw_Rendering_Targets" -eq 1; then
) >> "$patchlist"
fi
# Patchset ddraw-Revert_Surface_Init
# |
# | This patchset fixes the following Wine bugs:
# | * [#40094] Revert patches to move mip-level dimensions fixup (causes regressions in multiple games)
# |
# | Modified files:
# | * dlls/ddraw/surface.c, dlls/wined3d/surface.c, dlls/wined3d/wined3d.spec, include/wine/wined3d.h
# |
if test "$enable_ddraw_Revert_Surface_Init" -eq 1; then
patch_apply ddraw-Revert_Surface_Init/0001-Revert-ddraw-Use-wined3d_texture_get_sub_resource-in.patch
patch_apply ddraw-Revert_Surface_Init/0002-Revert-ddraw-Move-the-mip-level-dimensions-fix-up-fr.patch
(
echo '+ { "Sebastian Lackner", "Revert \"ddraw: Use wined3d_texture_get_sub_resource() in ddraw_surface7_Flip().\".", 1 },';
echo '+ { "Sebastian Lackner", "Revert \"ddraw: Move the mip-level dimensions fix-up from ddraw_surface_init() to ddraw_surface_create().\".", 1 },';
) >> "$patchlist"
fi
# Patchset ddraw-Write_Vtable
# |
# | This patchset fixes the following Wine bugs:

File diff suppressed because it is too large Load Diff