Rebase against ef267f115f76a3041e0da4a0f0dbd7ffb4a022e1.

This commit is contained in:
Sebastian Lackner 2017-05-25 01:19:21 +02:00
parent 8b1d3d07ab
commit 91f6a8ad80
7 changed files with 48 additions and 160 deletions

View File

@ -1,4 +1,4 @@
From d4c757fd049018cad57ad8d6ef304b9dd2220ae0 Mon Sep 17 00:00:00 2001
From 7d03c720e909d4b620bde26ebc78eb4d37557db5 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Fri, 13 Mar 2015 23:42:20 +0100
Subject: d3d9/tests: Avoid crash when surface and texture creation fails.
@ -8,10 +8,10 @@ Subject: d3d9/tests: Avoid crash when surface and texture creation fails.
1 file changed, 11 insertions(+)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index f1c75e4..46612f5 100644
index 89ea7721bf1..8624ac3153c 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -7779,8 +7779,14 @@ static void test_surface_blocks(void)
@@ -8583,8 +8583,14 @@ static void test_surface_blocks(void)
break;
default:
@ -26,7 +26,7 @@ index f1c75e4..46612f5 100644
if (formats[i].block_width > 1)
{
@@ -8661,6 +8667,11 @@ static void test_volume_blocks(void)
@@ -9534,6 +9540,11 @@ static void test_volume_blocks(void)
hr = IDirect3DDevice9_CreateVolumeTexture(device, 24, 8, 8, 1, 0,
formats[i].fmt, D3DPOOL_SCRATCH, &texture, NULL);
ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr);
@ -37,7 +37,7 @@ index f1c75e4..46612f5 100644
+ }
/* Test lockrect offset */
for (j = 0; j < sizeof(offset_tests) / sizeof(*offset_tests); j++)
for (j = 0; j < ARRAY_SIZE(offset_tests); j++)
--
2.3.2
2.12.2

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "b8a8e1bde9382897927945ec0b58b8a2fcfcfe59"
echo "ef267f115f76a3041e0da4a0f0dbd7ffb4a022e1"
}
# Show version information
@ -430,7 +430,6 @@ patch_enable_all ()
enable_wined3d_WINED3DFMT_R32G32_UINT="$1"
enable_wined3d_buffer_create="$1"
enable_wined3d_check_format_support="$1"
enable_wined3d_context_reacquire="$1"
enable_winedbg_Process_Arguments="$1"
enable_winedevice_Fix_Relocation="$1"
enable_winemenubuilder_Desktop_Icon_Path="$1"
@ -1524,9 +1523,6 @@ patch_enable ()
wined3d-check_format_support)
enable_wined3d_check_format_support="$2"
;;
wined3d-context_reacquire)
enable_wined3d_context_reacquire="$2"
;;
winedbg-Process_Arguments)
enable_winedbg_Process_Arguments="$2"
;;
@ -8708,7 +8704,8 @@ fi
# | * [#20776] Add stubs for QUERY_TYPE_SO_STATISTICS and QUERY_TYPE_SO_OVERFLOW
# |
# | Modified files:
# | * dlls/d3d10core/tests/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/query.c, include/wine/wined3d.h
# | * dlls/d3d10core/tests/device.c, dlls/d3d11/tests/d3d11.c, dlls/d3d9/device.c, dlls/wined3d/query.c,
# | include/wine/wined3d.h
# |
if test "$enable_wined3d_QUERY_Stubs" -eq 1; then
patch_apply wined3d-QUERY_Stubs/0001-wined3d-Add-stubs-for-QUERY_TYPE_SO_STATISTICS-and-Q.patch
@ -8842,21 +8839,6 @@ if test "$enable_wined3d_check_format_support" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-context_reacquire
# |
# | This patchset fixes the following Wine bugs:
# | * [#42873] Avoid crash if context_reacquire is called with NULL context
# |
# | Modified files:
# | * dlls/d3d11/tests/d3d11.c, dlls/wined3d/context.c
# |
if test "$enable_wined3d_context_reacquire" -eq 1; then
patch_apply wined3d-context_reacquire/0001-wined3d-Avoid-crash-if-context_reacquire-is-called-w.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "wined3d: Avoid crash if context_reacquire is called with NULL context.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset has the following (direct or indirect) dependencies:

View File

@ -1,4 +1,4 @@
From 6b03eab427e44e8cc3dde2b2cb5f84a515039e59 Mon Sep 17 00:00:00 2001
From e91d235aa2fe4b1145a66f93ab18e840645301a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 6 Jun 2015 06:53:34 +0200
Subject: wined3d: Use real values for memory accounting on NVIDIA cards.
@ -13,10 +13,10 @@ FIXME: Reimplement wined3d_device_get_available_texture_mem
4 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 4da1653e9b..c50ada88e4 100644
index 89ea7721bf1..2e1648171bb 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -9063,10 +9063,13 @@ static void test_vidmem_accounting(void)
@@ -9081,10 +9081,13 @@ static void test_vidmem_accounting(void)
}
vidmem_end = IDirect3DDevice9_GetAvailableTextureMem(device);
@ -32,13 +32,13 @@ index 4da1653e9b..c50ada88e4 100644
+ 2 * i, diff / 1024 / 1024);
+ }
for (i = 0; i < sizeof(textures) / sizeof(*textures); i++)
for (i = 0; i < ARRAY_SIZE(textures); i++)
{
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7e90be55c4..eb66f06307 100644
index e07d07c41e3..61ebafff0c9 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1271,8 +1271,33 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
@@ -1281,8 +1281,33 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device)
{
@ -73,10 +73,10 @@ index 7e90be55c4..eb66f06307 100644
wine_dbgstr_longlong(device->adapter->vram_bytes),
wine_dbgstr_longlong(device->adapter->vram_bytes_used),
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index b5a8e47a6a..0de69aaa84 100644
index 411545395a2..f0a2c56e322 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -258,6 +258,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
@@ -261,6 +261,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2 },
{"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION },
{"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3 },
@ -84,7 +84,7 @@ index b5a8e47a6a..0de69aaa84 100644
/* SGI */
{"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP },
@@ -1568,6 +1569,15 @@ static const struct gpu_description *query_gpu_description(const struct wined3d_
@@ -1571,6 +1572,15 @@ static const struct gpu_description *query_gpu_description(const struct wined3d_
TRACE("Card reports vendor PCI ID 0x%04x, device PCI ID 0x%04x, 0x%s bytes of video memory.\n",
vendor, device, wine_dbgstr_longlong(*vram_bytes));
}
@ -101,10 +101,10 @@ index b5a8e47a6a..0de69aaa84 100644
if (wined3d_settings.pci_vendor_id != PCI_VENDOR_NONE)
{
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 6e92552edd..ea38628c3c 100644
index 52fb5fd92c8..f60f8021c26 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -188,6 +188,7 @@ enum wined3d_gl_extension
@@ -191,6 +191,7 @@ enum wined3d_gl_extension
NV_VERTEX_PROGRAM2,
NV_VERTEX_PROGRAM2_OPTION,
NV_VERTEX_PROGRAM3,

View File

@ -622,7 +622,7 @@ diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2694,6 +2694,16 @@ struct wined3d_state
@@ -2695,6 +2695,16 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_state;
};
@ -639,7 +639,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
#define WINED3D_UNMAPPED_STAGE ~0u
/* Multithreaded flag. Removed from the public header to signal that
@@ -2805,6 +2815,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -2806,6 +2816,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
@ -652,7 +652,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2991,7 +3007,11 @@ struct wined3d_texture
@@ -2992,7 +3008,11 @@ struct wined3d_texture
unsigned int map_count;
DWORD locations;
@ -664,7 +664,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
} sub_resources[1];
};
@@ -3306,6 +3326,9 @@ struct wined3d_cs_queue
@@ -3307,6 +3327,9 @@ struct wined3d_cs_queue
struct wined3d_cs_ops
{

View File

@ -1,4 +1,4 @@
From fa278e34bc45e98c041fa3ae2a9c003efa0667bb Mon Sep 17 00:00:00 2001
From 9083e580904536e28ba4cfb3adb65bd24a94ed9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 16 Apr 2016 18:18:54 +0200
Subject: wined3d: Add stubs for QUERY_TYPE_SO_STATISTICS and
@ -7,15 +7,16 @@ Subject: wined3d: Add stubs for QUERY_TYPE_SO_STATISTICS and
---
dlls/d3d10core/tests/device.c | 4 +-
dlls/d3d11/tests/d3d11.c | 4 +-
dlls/d3d9/device.c | 3 ++
dlls/wined3d/query.c | 96 +++++++++++++++++++++++++++++++++++++++++++
include/wine/wined3d.h | 6 +++
4 files changed, 106 insertions(+), 4 deletions(-)
5 files changed, 109 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index e4ab7a4dfb..c1b74718b5 100644
index 6abc79a7a44..a68baa6d0ff 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -3869,8 +3869,8 @@ static void test_create_query(void)
@@ -3808,8 +3808,8 @@ static void test_create_query(void)
{D3D10_QUERY_TIMESTAMP_DISJOINT, FALSE, FALSE},
{D3D10_QUERY_PIPELINE_STATISTICS, FALSE, TRUE},
{D3D10_QUERY_OCCLUSION_PREDICATE, TRUE, FALSE},
@ -27,10 +28,10 @@ index e4ab7a4dfb..c1b74718b5 100644
ULONG refcount, expected_refcount;
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 6626ea2065..ee38b26e00 100644
index 91d5927acb1..d409c8beeaa 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -4588,8 +4588,8 @@ static void test_create_query(void)
@@ -4583,8 +4583,8 @@ static void test_create_query(void)
{D3D11_QUERY_TIMESTAMP_DISJOINT, D3D_FEATURE_LEVEL_10_0, FALSE, FALSE, FALSE},
{D3D11_QUERY_PIPELINE_STATISTICS, D3D_FEATURE_LEVEL_10_0, FALSE, FALSE, TRUE},
{D3D11_QUERY_OCCLUSION_PREDICATE, D3D_FEATURE_LEVEL_10_0, TRUE, TRUE, FALSE},
@ -41,8 +42,22 @@ index 6626ea2065..ee38b26e00 100644
{D3D11_QUERY_SO_STATISTICS_STREAM0, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, TRUE},
{D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE},
{D3D11_QUERY_SO_STATISTICS_STREAM1, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, TRUE},
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index b4cb25316c7..74273926ae6 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3445,6 +3445,9 @@ static HRESULT WINAPI d3d9_device_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUER
TRACE("iface %p, type %#x, query %p.\n", iface, type, query);
+ if (type < D3DQUERYTYPE_VCACHE || type > D3DQUERYTYPE_MEMORYPRESSURE)
+ return D3DERR_NOTAVAILABLE;
+
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 3cfbd8431a..2bca60e7d4 100644
index 3cfbd8431ac..2bca60e7d4c 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -294,6 +294,14 @@ static void wined3d_query_destroy_object(void *object)
@ -170,10 +185,10 @@ index 3cfbd8431a..2bca60e7d4 100644
FIXME("Unhandled query type %#x.\n", type);
return WINED3DERR_NOTAVAILABLE;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 4c0f47dc33..993797d877 100644
index 97947e44d9c..fc1a5fea56d 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -709,6 +709,12 @@ struct wined3d_query_data_timestamp_disjoint
@@ -710,6 +710,12 @@ struct wined3d_query_data_timestamp_disjoint
BOOL disjoint;
};

View File

@ -1,108 +0,0 @@
From 719070152c6e0a17b7ab6c916298c8d5b221d68e Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 25 Apr 2017 06:01:04 +0000
Subject: wined3d: Avoid crash if context_reacquire is called with NULL
context.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Test was provided by Józef Kucia.
Fixes https://bugs.winehq.org/show_bug.cgi?id=42873
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/d3d11/tests/d3d11.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/context.c | 2 +-
2 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index bdb13b9db5..33e0268c98 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -17947,6 +17947,62 @@ static void test_fractional_viewports(void)
release_test_context(&test_context);
}
+static void test_destroyed_context_query_poll(void)
+{
+ struct d3d11_test_context test_context;
+ ID3D11Asynchronous *timestamp_query;
+ ID3D11DeviceContext *context;
+ D3D11_QUERY_DESC query_desc;
+ ID3D11Device *device;
+ UINT64 timestamp;
+ unsigned int i;
+ HRESULT hr;
+
+ static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f};
+
+ if (!init_test_context(&test_context, NULL))
+ return;
+
+ device = test_context.device;
+ context = test_context.immediate_context;
+
+ query_desc.Query = D3D11_QUERY_TIMESTAMP;
+ query_desc.MiscFlags = 0;
+ hr = ID3D11Device_CreateQuery(device, &query_desc, (ID3D11Query **)&timestamp_query);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &white.x);
+ ID3D11DeviceContext_End(context, timestamp_query);
+
+ ID3D11RenderTargetView_Release(test_context.backbuffer_rtv);
+ test_context.backbuffer_rtv = NULL;
+ ID3D11Texture2D_Release(test_context.backbuffer);
+ test_context.backbuffer = NULL;
+ IDXGISwapChain_Release(test_context.swapchain);
+ test_context.swapchain = create_swapchain(device, test_context.window, NULL);
+ hr = IDXGISwapChain_GetBuffer(test_context.swapchain, 0, &IID_ID3D11Texture2D,
+ (void **)&test_context.backbuffer);
+ ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr);
+ hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)test_context.backbuffer,
+ NULL, &test_context.backbuffer_rtv);
+ ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr);
+ ID3D11DeviceContext_OMSetRenderTargets(context, 1, &test_context.backbuffer_rtv, NULL);
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &white.x);
+
+ for (i = 0; i < 500; ++i)
+ {
+ if ((hr = ID3D11DeviceContext_GetData(context, timestamp_query, NULL, 0, 0)) != S_FALSE)
+ break;
+ Sleep(10);
+ }
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ hr = ID3D11DeviceContext_GetData(context, timestamp_query, &timestamp, sizeof(timestamp), 0);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ ID3D11Asynchronous_Release(timestamp_query);
+ release_test_context(&test_context);
+}
+
START_TEST(d3d11)
{
test_create_device();
@@ -18037,4 +18093,5 @@ START_TEST(d3d11)
test_stream_output_resume();
test_gather();
test_fractional_viewports();
+ test_destroyed_context_query_poll();
}
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 5a899e56d1..76f0fdcc2b 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3968,7 +3968,7 @@ struct wined3d_context *context_reacquire(const struct wined3d_device *device,
{
struct wined3d_context *current_context;
- if (context->tid != GetCurrentThreadId())
+ if (!context || context->tid != GetCurrentThreadId())
return NULL;
current_context = context_acquire(device, context->current_rt.texture,
--
2.12.2

View File

@ -1 +0,0 @@
Fixes: [42873] Avoid crash if context_reacquire is called with NULL context