Added wined3d-adapter_create_output Patchset

This commit is contained in:
Alistair Leslie-Hughes 2022-08-14 13:51:20 +10:00
parent d9e4a75d19
commit 1f218b6822
3 changed files with 78 additions and 1 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "b5becc2ee8b70753b9fc538cfdd92c2b4be5911c"
echo "a1af412482d36c4046061faa676ff7bc774f40eb"
}
# Show version information
@ -229,6 +229,7 @@ patch_enable_all ()
enable_wined3d_SWVP_shaders="$1"
enable_wined3d_Silence_FIXMEs="$1"
enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM="$1"
enable_wined3d_adapter_create_output="$1"
enable_wined3d_bindless_texture="$1"
enable_wined3d_mesa_texture_download="$1"
enable_wined3d_rotate_WINED3D_SWAP_EFFECT_DISCARD="$1"
@ -711,6 +712,9 @@ patch_enable ()
wined3d-WINED3DFMT_B8G8R8X8_UNORM)
enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM="$2"
;;
wined3d-adapter_create_output)
enable_wined3d_adapter_create_output="$2"
;;
wined3d-bindless-texture)
enable_wined3d_bindless_texture="$2"
;;
@ -3495,6 +3499,18 @@ if test "$enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM" -eq 1; then
patch_apply wined3d-WINED3DFMT_B8G8R8X8_UNORM/0001-wined3d-Implement-WINED3DFMT_B8G8R8X8_UNORM-to-WINED.patch
fi
# Patchset wined3d-adapter_create_output
# |
# | This patchset fixes the following Wine bugs:
# | * [#53497] wined3d: Use wined3d_array_reserve() in wined3d_adapter_create_output()
# |
# | Modified files:
# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_adapter_create_output" -eq 1; then
patch_apply wined3d-adapter_create_output/0001-wined3d-Use-wined3d_array_reserve-in-wined3d_adapter.patch
fi
# Patchset wined3d-bindless-texture
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,58 @@
From 58468f4759224dd9b71370a185c09ba9ee907d18 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 8 Aug 2022 17:27:47 +0000
Subject: [PATCH] wined3d: Use wined3d_array_reserve() in
wined3d_adapter_create_output().
This also has the effect of consistently zero-initializing the wined3d_output structure.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53497
---
dlls/wined3d/directx.c | 14 ++------------
dlls/wined3d/wined3d_private.h | 2 +-
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 20be9817158..1b6c44d95a5 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3410,21 +3410,11 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal,
static BOOL wined3d_adapter_create_output(struct wined3d_adapter *adapter, const WCHAR *output_name)
{
- struct wined3d_output *outputs;
HRESULT hr;
- if (!adapter->outputs && !(adapter->outputs = heap_calloc(1, sizeof(*adapter->outputs))))
- {
+ if (!wined3d_array_reserve((void **)&adapter->outputs, &adapter->outputs_size,
+ adapter->output_count + 1, sizeof(*adapter->outputs)))
return FALSE;
- }
- else
- {
- if (!(outputs = heap_realloc(adapter->outputs,
- sizeof(*adapter->outputs) * (adapter->output_count + 1))))
- return FALSE;
-
- adapter->outputs = outputs;
- }
if (FAILED(hr = wined3d_output_init(&adapter->outputs[adapter->output_count],
adapter->output_count, adapter, output_name)))
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c529cd8efa6..3256d0aa9a6 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3537,7 +3537,7 @@ struct wined3d_adapter
struct wined3d_d3d_info d3d_info;
struct wined3d_driver_info driver_info;
struct wined3d_output *outputs;
- unsigned int output_count;
+ SIZE_T output_count, outputs_size;
D3DKMT_HANDLE kmt_adapter;
UINT64 vram_bytes_used;
GUID driver_uuid;
--
2.35.1

View File

@ -0,0 +1,3 @@
Fixes: [53497] wined3d: Use wined3d_array_reserve() in wined3d_adapter_create_output()
# Fixes a regression for some applications failing to start
# Bug 52396 is an example.