mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Added patches to fix error handling issues in wined3d.
This commit is contained in:
parent
079da46f96
commit
e963b417b3
@ -417,6 +417,7 @@ patch_enable_all ()
|
||||
enable_wined3d_Accounting="$1"
|
||||
enable_wined3d_CSMT_Helper="$1"
|
||||
enable_wined3d_DXTn="$1"
|
||||
enable_wined3d_Error_Handling="$1"
|
||||
enable_wined3d_GTX_560M="$1"
|
||||
enable_wined3d_Limit_Vram="$1"
|
||||
enable_wined3d_QUERY_Stubs="$1"
|
||||
@ -1480,6 +1481,9 @@ patch_enable ()
|
||||
wined3d-DXTn)
|
||||
enable_wined3d_DXTn="$2"
|
||||
;;
|
||||
wined3d-Error_Handling)
|
||||
enable_wined3d_Error_Handling="$2"
|
||||
;;
|
||||
wined3d-GTX_560M)
|
||||
enable_wined3d_GTX_560M="$2"
|
||||
;;
|
||||
@ -8660,6 +8664,20 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-Error_Handling
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/cs.c, dlls/wined3d/shader.c
|
||||
# |
|
||||
if test "$enable_wined3d_Error_Handling" -eq 1; then
|
||||
patch_apply wined3d-Error_Handling/0001-wined3d-Release-resources-on-error-in-wined3d_cs_exe.patch
|
||||
patch_apply wined3d-Error_Handling/0002-wined3d-Fix-doublefree-race-condition-in-geometry_sh.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Release resources on error in wined3d_cs_exec_blt_sub_resource.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Fix doublefree / race condition in geometry_shader_init.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-GTX_560M
|
||||
# |
|
||||
# | Modified files:
|
||||
|
@ -0,0 +1,77 @@
|
||||
From 8e21a757af350191bf35b309870f9863475c8b80 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 14 Apr 2017 17:32:13 +0200
|
||||
Subject: wined3d: Release resources on error in
|
||||
wined3d_cs_exec_blt_sub_resource.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 43352eb7cb..5ea7650d94 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -1934,14 +1934,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
|
||||
{
|
||||
FIXME("Flags %#x not implemented for %s resources.\n",
|
||||
op->flags, debug_d3dresourcetype(op->dst_resource->type));
|
||||
- return;
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
if (op->src_resource->format != op->dst_resource->format)
|
||||
{
|
||||
FIXME("Format conversion not implemented for %s resources.\n",
|
||||
debug_d3dresourcetype(op->dst_resource->type));
|
||||
- return;
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
update_w = op->dst_box.right - op->dst_box.left;
|
||||
@@ -1953,14 +1953,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
|
||||
{
|
||||
FIXME("Stretching not implemented for %s resources.\n",
|
||||
debug_d3dresourcetype(op->dst_resource->type));
|
||||
- return;
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
if (op->src_box.left || op->src_box.top || op->src_box.front)
|
||||
{
|
||||
FIXME("Source box %s not supported for %s resources.\n",
|
||||
debug_box(&op->src_box), debug_d3dresourcetype(op->dst_resource->type));
|
||||
- return;
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
dst_texture = texture_from_resource(op->dst_resource);
|
||||
@@ -1974,7 +1974,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
|
||||
ERR("Failed to load source sub-resource into %s.\n",
|
||||
wined3d_debug_location(src_texture->resource.map_binding));
|
||||
context_release(context);
|
||||
- return;
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
level = op->dst_sub_resource_idx % dst_texture->level_count;
|
||||
@@ -1989,7 +1989,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
|
||||
{
|
||||
ERR("Failed to load destination sub-resource.\n");
|
||||
context_release(context);
|
||||
- return;
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
wined3d_texture_get_memory(src_texture, op->src_sub_resource_idx, &addr, src_texture->resource.map_binding);
|
||||
@@ -2009,6 +2009,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
|
||||
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type));
|
||||
}
|
||||
|
||||
+error:
|
||||
if (op->src_resource)
|
||||
wined3d_resource_release(op->src_resource);
|
||||
wined3d_resource_release(op->dst_resource);
|
||||
--
|
||||
2.12.2
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 4b68eeba50dfdeed2472c7de8cf868bbcdb9883d Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 14 Apr 2017 17:45:19 +0200
|
||||
Subject: wined3d: Fix doublefree / race condition in geometry_shader_init.
|
||||
|
||||
---
|
||||
dlls/wined3d/shader.c | 18 ++++++++++--------
|
||||
1 file changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
|
||||
index 3681a8d621..7dc276f575 100644
|
||||
--- a/dlls/wined3d/shader.c
|
||||
+++ b/dlls/wined3d/shader.c
|
||||
@@ -3433,21 +3433,23 @@ static HRESULT geometry_shader_init(struct wined3d_shader *shader, struct wined3
|
||||
const struct wined3d_shader_desc *desc, const struct wined3d_stream_output_desc *so_desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
+ struct wined3d_stream_output_element *elements = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
+ if (so_desc && !(elements = wined3d_calloc(so_desc->element_count, sizeof(*elements))))
|
||||
+ return E_OUTOFMEMORY;
|
||||
+
|
||||
if (FAILED(hr = shader_init(shader, device, desc, 0, WINED3D_SHADER_TYPE_GEOMETRY, parent, parent_ops)))
|
||||
+ {
|
||||
+ HeapFree(GetProcessHeap(), 0, elements);
|
||||
return hr;
|
||||
+ }
|
||||
|
||||
if (so_desc)
|
||||
{
|
||||
- struct wined3d_stream_output_desc *d = &shader->u.gs.so_desc;
|
||||
- *d = *so_desc;
|
||||
- if (!(d->elements = wined3d_calloc(so_desc->element_count, sizeof(*d->elements))))
|
||||
- {
|
||||
- wined3d_cs_destroy_object(shader->device->cs, wined3d_shader_destroy_object, shader);
|
||||
- return E_OUTOFMEMORY;
|
||||
- }
|
||||
- memcpy(d->elements, so_desc->elements, so_desc->element_count * sizeof(*d->elements));
|
||||
+ shader->u.gs.so_desc = *so_desc;
|
||||
+ shader->u.gs.so_desc.elements = elements;
|
||||
+ memcpy(elements, so_desc->elements, so_desc->element_count * sizeof(*elements));
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
--
|
||||
2.12.2
|
||||
|
Loading…
Reference in New Issue
Block a user