Added patches to fix multiple regressions related to GDI rendering.

This commit is contained in:
Sebastian Lackner
2017-06-15 19:43:07 +02:00
parent f254a73e66
commit 8ebf6f58e5
7 changed files with 253 additions and 9 deletions

View File

@@ -0,0 +1,48 @@
From 9dc3f3172083cf450ad72c3a8294f592c70e9114 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Jun 2017 16:01:04 +0200
Subject: wined3d: Avoid NULL pointer dereference when using GDI renderer.
Fixes a regression introduced in 62ca4f38269139ef2a8b9842ec538d9e7f7a0e76.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wined3d/context.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 0f6054226b..fbc73ca9a1 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2703,12 +2703,13 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
void *context_map_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *data, size_t size, GLenum binding, DWORD flags)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
+ const struct wined3d_gl_info *gl_info;
BYTE *memory;
if (!data->buffer_object)
return data->addr;
+ gl_info = context->gl_info;
context_bind_bo(context, binding, data->buffer_object);
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
@@ -2731,11 +2732,12 @@ void *context_map_bo_address(struct wined3d_context *context,
void context_unmap_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *data, GLenum binding)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
+ const struct wined3d_gl_info *gl_info;
if (!data->buffer_object)
return;
+ gl_info = context->gl_info;
context_bind_bo(context, binding, data->buffer_object);
GL_EXTCALL(glUnmapBuffer(binding));
context_bind_bo(context, binding, 0);
--
2.13.1

View File

@@ -0,0 +1,44 @@
From e18e871d92506bae4647566f55841db205d61475 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Jun 2017 16:01:34 +0200
Subject: wined3d: Create CPU blitter also for GDI render.
Fixes a regression introduced in cad4badbcf25992e0c61521aa15e639c2611f5d6.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wined3d/device.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ded4af6616..3d12e417a4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1164,6 +1164,15 @@ HRESULT CDECL wined3d_device_init_gdi(struct wined3d_device *device,
goto err_out;
}
device->swapchains[0] = swapchain;
+
+ if (!(device->blitter = wined3d_cpu_blitter_create()))
+ {
+ ERR("Failed to create CPU blitter.\n");
+ HeapFree(GetProcessHeap(), 0, device->swapchains);
+ device->swapchain_count = 0;
+ goto err_out;
+ }
+
return WINED3D_OK;
err_out:
@@ -1252,6 +1261,8 @@ HRESULT CDECL wined3d_device_uninit_gdi(struct wined3d_device *device)
{
unsigned int i;
+ device->blitter->ops->blitter_destroy(device->blitter, NULL);
+
for (i = 0; i < device->swapchain_count; ++i)
{
TRACE("Releasing the implicit swapchain %u.\n", i);
--
2.13.1

View File

@@ -0,0 +1,44 @@
From bb63fe5dc5aec0dc8fec304f1d7ce790f684dfce Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Jun 2017 16:01:58 +0200
Subject: wined3d: Fix memory leaks in blitter_destroy callbacks.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wined3d/surface.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index abdeb9cac0..af8b5b4cb3 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2394,6 +2394,8 @@ static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
+
+ HeapFree(GetProcessHeap(), 0, blitter);
}
static void fbo_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
@@ -2476,6 +2478,8 @@ static void ffp_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
+
+ HeapFree(GetProcessHeap(), 0, blitter);
}
static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info,
@@ -2766,6 +2770,8 @@ static void cpu_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
+
+ HeapFree(GetProcessHeap(), 0, blitter);
}
static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data,
--
2.13.1

View File

@@ -0,0 +1,84 @@
From 4bc32d1d59b90666b20523e692e9cfc724eacecd Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Jun 2017 16:03:22 +0200
Subject: wined3d: Trigger frontbuffer update in surface_cpu_blt.
Fixes a regression introduced in ee17d7ba1b72b26baae90c1d5e2ae5b3e4721654.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wined3d/surface.c | 3 +++
dlls/wined3d/texture.c | 22 +++++++++++++++++-----
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index af8b5b4cb3..88ae765e17 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3343,6 +3343,9 @@ release:
context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
if (!same_sub_resource)
context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER);
+
+ swapchain_frontbuffer_updated(dst_texture, dst_sub_resource_idx, dst_box);
+
if (converted_texture)
wined3d_texture_decref(converted_texture);
if (context)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 476295cecc..9de8b93c5a 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1979,6 +1979,22 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
return WINED3D_OK;
}
+void swapchain_frontbuffer_updated(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ const struct wined3d_box *box)
+{
+ struct wined3d_texture_sub_resource *sub_resource;
+
+ if (!texture->swapchain || texture->swapchain->front_buffer != texture)
+ return;
+ if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx)))
+ return;
+ if (sub_resource->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB))
+ return;
+
+ if (box) SetRect(&texture->swapchain->front_buffer_update, box->left, box->top, box->right, box->bottom);
+ texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(texture->swapchain);
+}
+
static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
{
struct wined3d_texture_sub_resource *sub_resource;
@@ -2010,11 +2026,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
if (context)
context_release(context);
- if (texture->swapchain && texture->swapchain->front_buffer == texture)
- {
- if (!(sub_resource->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB)))
- texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(texture->swapchain);
- }
+ swapchain_frontbuffer_updated(texture, sub_resource_idx, NULL);
--sub_resource->map_count;
if (!--resource->map_count && texture->update_map_binding)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1025c98f18..e394931573 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3686,6 +3686,8 @@ void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HI
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
+void swapchain_frontbuffer_updated(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ const struct wined3d_box *box) DECLSPEC_HIDDEN;
/*****************************************************************************
* Utility function prototypes
--
2.13.1

View File

@@ -0,0 +1 @@
Fixes: Multiple regression fixes for GDI rendering