Updated d3d11-Deferred_Context patchset.

Fix device reference leak on command list release.
This commit is contained in:
Paul Gofman 2019-09-27 17:22:02 +03:00
parent c942f42ee5
commit 99c474f018
3 changed files with 27 additions and 26 deletions

View File

@ -1,4 +1,4 @@
From 79ef8b7836196e9215a29f8f2d9ce25f3e671f03 Mon Sep 17 00:00:00 2001
From 50dfa70735f6a0f8cf9e77c70143a91555627a5a Mon Sep 17 00:00:00 2001
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
Date: Sat, 24 Sep 2016 06:51:24 +0300
Subject: [PATCH] d3d11: Add stub deferred rendering context.
@ -9,7 +9,7 @@ Subject: [PATCH] d3d11: Add stub deferred rendering context.
2 files changed, 1132 insertions(+), 139 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 08579164bd..fbc875c6fe 100644
index 08579164bd..dca5a88caa 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -22,6 +22,16 @@
@ -1366,7 +1366,7 @@ index 08579164bd..fbc875c6fe 100644
+ return E_OUTOFMEMORY;
+
+ object->ID3D11DeviceContext_iface.lpVtbl = &d3d11_deferred_context_vtbl;
+ object->device = iface;
+ object->device = (ID3D11Device *)iface;
+ object->refcount = 1;
+
+ ID3D11Device2_AddRef(iface);

View File

@ -1,14 +1,14 @@
From 4984f8e6033facccfa7b27b4b0f83e6615abc972 Mon Sep 17 00:00:00 2001
From c093321833140c3aadacae32c43d160e83483d17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 19 Jan 2017 16:56:56 +0100
Subject: [PATCH] d3d11: Initial implementation for deferred contexts.
---
dlls/d3d11/device.c | 1072 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 1041 insertions(+), 31 deletions(-)
dlls/d3d11/device.c | 1073 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 1042 insertions(+), 31 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index fbc875c6fee..74ae6f8f333 100644
index dca5a88caa..738f1d19d4 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -17,11 +17,181 @@
@ -193,7 +193,7 @@ index fbc875c6fee..74ae6f8f333 100644
/* ID3D11DeviceContext - deferred context */
struct d3d11_deferred_context
{
@@ -29,9 +199,531 @@ struct d3d11_deferred_context
@@ -29,9 +199,532 @@ struct d3d11_deferred_context
ID3D11Device *device;
LONG refcount;
@ -646,6 +646,7 @@ index fbc875c6fee..74ae6f8f333 100644
+ {
+ free_deferred_calls(&cmdlist->commands);
+ wined3d_private_store_cleanup(&cmdlist->private_store);
+ ID3D11Device_Release(cmdlist->device);
+ HeapFree(GetProcessHeap(), 0, cmdlist);
+ }
+
@ -725,7 +726,7 @@ index fbc875c6fee..74ae6f8f333 100644
static void STDMETHODCALLTYPE d3d_null_wined3d_object_destroyed(void *parent) {}
static const struct wined3d_parent_ops d3d_null_wined3d_parent_ops =
@@ -1226,7 +1918,20 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ResolveSubresource(ID3D11D
@@ -1226,7 +1919,20 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ResolveSubresource(ID3D11D
static void STDMETHODCALLTYPE d3d11_immediate_context_ExecuteCommandList(ID3D11DeviceContext1 *iface,
ID3D11CommandList *command_list, BOOL restore_state)
{
@ -747,7 +748,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_immediate_context_HSSetShaderResources(ID3D11DeviceContext1 *iface,
@@ -2938,6 +3643,7 @@ static ULONG STDMETHODCALLTYPE d3d11_deferred_context_Release(ID3D11DeviceContex
@@ -2938,6 +3644,7 @@ static ULONG STDMETHODCALLTYPE d3d11_deferred_context_Release(ID3D11DeviceContex
if (!refcount)
{
@ -755,7 +756,7 @@ index fbc875c6fee..74ae6f8f333 100644
wined3d_private_store_cleanup(&context->private_store);
ID3D11Device_Release(context->device);
HeapFree(GetProcessHeap(), 0, context);
@@ -2989,43 +3695,86 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_SetPrivateDataInterface(
@@ -2989,43 +3696,86 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_SetPrivateDataInterface(
static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetConstantBuffers(ID3D11DeviceContext *iface,
UINT start_slot, UINT buffer_count, ID3D11Buffer *const *buffers)
{
@ -848,7 +849,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *iface,
@@ -3038,53 +3787,169 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *i
@@ -3038,53 +3788,169 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *i
static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext *iface, ID3D11Resource *resource,
UINT subresource_idx, D3D11_MAP map_type, UINT map_flags, D3D11_MAPPED_SUBRESOURCE *mapped_subresource)
{
@ -1027,7 +1028,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstanced(ID3D11DeviceContext *iface,
@@ -3113,7 +3978,16 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShader(ID3D11DeviceCon
@@ -3113,7 +3979,16 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShader(ID3D11DeviceCon
static void STDMETHODCALLTYPE d3d11_deferred_context_IASetPrimitiveTopology(ID3D11DeviceContext *iface,
D3D11_PRIMITIVE_TOPOLOGY topology)
{
@ -1045,7 +1046,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetShaderResources(ID3D11DeviceContext *iface,
@@ -3173,8 +4047,28 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargets(ID3D11De
@@ -3173,8 +4048,28 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargets(ID3D11De
UINT render_target_view_count, ID3D11RenderTargetView *const *render_target_views,
ID3D11DepthStencilView *depth_stencil_view)
{
@ -1075,7 +1076,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorderedAccessViews(
@@ -3194,15 +4088,44 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorde
@@ -3194,15 +4089,44 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorde
static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetBlendState(ID3D11DeviceContext *iface,
ID3D11BlendState *blend_state, const float blend_factor[4], UINT sample_mask)
{
@ -1122,7 +1123,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_SOSetTargets(ID3D11DeviceContext *iface, UINT buffer_count,
@@ -3244,13 +4167,34 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DispatchIndirect(ID3D11Devi
@@ -3244,13 +4168,34 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DispatchIndirect(ID3D11Devi
static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetState(ID3D11DeviceContext *iface,
ID3D11RasterizerState *rasterizer_state)
{
@ -1159,7 +1160,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetScissorRects(ID3D11DeviceContext *iface,
@@ -3365,8 +4309,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShaderResources(ID3D11
@@ -3365,8 +4310,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShaderResources(ID3D11
static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShader(ID3D11DeviceContext *iface,
ID3D11HullShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count)
{
@ -1179,7 +1180,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceContext *iface,
@@ -3379,36 +4333,62 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceC
@@ -3379,36 +4334,62 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceC
static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetConstantBuffers(ID3D11DeviceContext *iface,
UINT start_slot, UINT buffer_count, ID3D11Buffer *const *buffers)
{
@ -1247,7 +1248,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetShaderResources(ID3D11DeviceContext *iface,
@@ -3709,7 +4689,15 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSGetConstantBuffers(ID3D11
@@ -3709,7 +4690,15 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSGetConstantBuffers(ID3D11
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearState(ID3D11DeviceContext *iface)
{
@ -1264,7 +1265,7 @@ index fbc875c6fee..74ae6f8f333 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_Flush(ID3D11DeviceContext *iface)
@@ -3734,9 +4722,29 @@ static UINT STDMETHODCALLTYPE d3d11_deferred_context_GetContextFlags(ID3D11Devic
@@ -3734,9 +4723,29 @@ static UINT STDMETHODCALLTYPE d3d11_deferred_context_GetContextFlags(ID3D11Devic
static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_FinishCommandList(ID3D11DeviceContext *iface,
BOOL restore, ID3D11CommandList **command_list)
{
@ -1296,8 +1297,8 @@ index fbc875c6fee..74ae6f8f333 100644
}
static const struct ID3D11DeviceContextVtbl d3d11_deferred_context_vtbl =
@@ -4351,6 +5359,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device
object->device = iface;
@@ -4351,6 +5360,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device
object->device = (ID3D11Device *)iface;
object->refcount = 1;
+ list_init(&object->commands);
@ -1306,5 +1307,5 @@ index fbc875c6fee..74ae6f8f333 100644
wined3d_private_store_init(&object->private_store);
--
2.20.1
2.21.0

View File

@ -1,4 +1,4 @@
From 20bd2911327fd59dde921b7d16e084b8f671be2b Mon Sep 17 00:00:00 2001
From 31a800096eb212cda55f6fbea955f05c650ea2c1 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Fri, 27 Sep 2019 16:26:04 +0300
Subject: [PATCH] d3d11/tests: Add a basic test for drawing with deferred
@ -9,7 +9,7 @@ Subject: [PATCH] d3d11/tests: Add a basic test for drawing with deferred
1 file changed, 81 insertions(+), 20 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index e653fb30b2..3d9766fda8 100644
index e653fb30b2..202179174b 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -1692,10 +1692,11 @@ static void release_test_context_(unsigned int line, struct d3d11_test_context *
@ -152,7 +152,7 @@ index e653fb30b2..3d9766fda8 100644
+ ID3D11CommandList_Release(command_list);
+
+ ID3D11DeviceContext_Release(deferred_context);
+ todo_wine release_test_context(&test_context);
+ release_test_context(&test_context);
+}
+
static void test_device_interfaces(const D3D_FEATURE_LEVEL feature_level)