d3d11-Deferred_Context: Merge two patches.

This commit is contained in:
Sebastian Lackner 2017-05-09 19:55:51 +02:00
parent c542f2432d
commit bb180d38cc
3 changed files with 21 additions and 63 deletions

View File

@ -1,14 +1,14 @@
From 38079a15e97192b7f0f80b9317a47530d6430a5f Mon Sep 17 00:00:00 2001
From d5ce074cce2ab4d5e4808898562555ecb92b388a 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: d3d11: Initial implementation for deferred contexts.
---
dlls/d3d11/device.c | 1075 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 1043 insertions(+), 32 deletions(-)
dlls/d3d11/device.c | 1073 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 1041 insertions(+), 32 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 366f330bf0..7aac903b54 100644
index 8fd48eff4c..ab833468a2 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -19,12 +19,181 @@
@ -747,7 +747,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_immediate_context_HSSetShaderResources(ID3D11DeviceContext *iface,
@@ -2260,7 +2964,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSGetConstantBuffers(ID3D1
@@ -2408,7 +3112,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSGetConstantBuffers(ID3D1
static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceContext *iface)
{
@ -756,7 +756,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_immediate_context_Flush(ID3D11DeviceContext *iface)
@@ -2472,6 +3176,7 @@ static ULONG STDMETHODCALLTYPE d3d11_deferred_context_Release(ID3D11DeviceContex
@@ -2620,6 +3324,7 @@ static ULONG STDMETHODCALLTYPE d3d11_deferred_context_Release(ID3D11DeviceContex
if (!refcount)
{
@ -764,7 +764,7 @@ index 366f330bf0..7aac903b54 100644
wined3d_private_store_cleanup(&context->private_store);
ID3D11Device_Release(context->device);
HeapFree(GetProcessHeap(), 0, context);
@@ -2523,43 +3228,86 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_SetPrivateDataInterface(
@@ -2671,43 +3376,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)
{
@ -857,7 +857,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *iface,
@@ -2572,53 +3320,171 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *i
@@ -2720,53 +3468,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)
{
@ -979,17 +979,15 @@ index 366f330bf0..7aac903b54 100644
+ call->vbuffer_info.num_buffers = buffer_count;
+
+ call->vbuffer_info.buffers = (void *)(call + 1);
+ call->vbuffer_info.strides = (void *)&call->vbuffer_info.buffers[buffer_count];
+ call->vbuffer_info.offsets = (void *)&call->vbuffer_info.strides[buffer_count];
+ for (i = 0; i < buffer_count; i++)
+ {
+ if (buffers[i]) ID3D11Buffer_AddRef(buffers[i]);
+ call->vbuffer_info.buffers[i] = buffers[i];
+ call->vbuffer_info.strides[i] = strides[i];
+ call->vbuffer_info.offsets[i] = offsets[i];
+ }
+
+ call->vbuffer_info.strides = (void *)((char *)call->vbuffer_info.buffers + buffer_count * sizeof(*buffers));
+ memcpy(call->vbuffer_info.strides, strides, sizeof(UINT) * buffer_count);
+
+ call->vbuffer_info.offsets = (void *)((char *)call->vbuffer_info.strides + buffer_count * sizeof(UINT));
+ memcpy(call->vbuffer_info.offsets, offsets, sizeof(UINT) * buffer_count);
}
static void STDMETHODCALLTYPE d3d11_deferred_context_IASetIndexBuffer(ID3D11DeviceContext *iface,
@ -1038,7 +1036,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstanced(ID3D11DeviceContext *iface,
@@ -2647,7 +3513,16 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShader(ID3D11DeviceCon
@@ -2795,7 +3659,16 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetShader(ID3D11DeviceCon
static void STDMETHODCALLTYPE d3d11_deferred_context_IASetPrimitiveTopology(ID3D11DeviceContext *iface,
D3D11_PRIMITIVE_TOPOLOGY topology)
{
@ -1056,7 +1054,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_VSSetShaderResources(ID3D11DeviceContext *iface,
@@ -2707,8 +3582,28 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargets(ID3D11De
@@ -2855,8 +3728,28 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargets(ID3D11De
UINT render_target_view_count, ID3D11RenderTargetView *const *render_target_views,
ID3D11DepthStencilView *depth_stencil_view)
{
@ -1086,7 +1084,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorderedAccessViews(
@@ -2728,15 +3623,44 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_OMSetRenderTargetsAndUnorde
@@ -2876,15 +3769,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)
{
@ -1133,7 +1131,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_SOSetTargets(ID3D11DeviceContext *iface, UINT buffer_count,
@@ -2778,13 +3702,34 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DispatchIndirect(ID3D11Devi
@@ -2926,13 +3848,34 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DispatchIndirect(ID3D11Devi
static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetState(ID3D11DeviceContext *iface,
ID3D11RasterizerState *rasterizer_state)
{
@ -1170,7 +1168,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_RSSetScissorRects(ID3D11DeviceContext *iface,
@@ -2899,8 +3844,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetShaderResources(ID3D11
@@ -3047,8 +3990,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)
{
@ -1190,7 +1188,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceContext *iface,
@@ -2913,36 +3868,62 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_HSSetSamplers(ID3D11DeviceC
@@ -3061,36 +4014,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)
{
@ -1258,7 +1256,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_CSSetShaderResources(ID3D11DeviceContext *iface,
@@ -3243,7 +4224,15 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSGetConstantBuffers(ID3D11
@@ -3391,7 +4370,15 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_CSGetConstantBuffers(ID3D11
static void STDMETHODCALLTYPE d3d11_deferred_context_ClearState(ID3D11DeviceContext *iface)
{
@ -1275,7 +1273,7 @@ index 366f330bf0..7aac903b54 100644
}
static void STDMETHODCALLTYPE d3d11_deferred_context_Flush(ID3D11DeviceContext *iface)
@@ -3268,9 +4257,29 @@ static UINT STDMETHODCALLTYPE d3d11_deferred_context_GetContextFlags(ID3D11Devic
@@ -3416,9 +4403,29 @@ static UINT STDMETHODCALLTYPE d3d11_deferred_context_GetContextFlags(ID3D11Devic
static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_FinishCommandList(ID3D11DeviceContext *iface,
BOOL restore, ID3D11CommandList **command_list)
{
@ -1307,7 +1305,7 @@ index 366f330bf0..7aac903b54 100644
}
static const struct ID3D11DeviceContextVtbl d3d11_deferred_context_vtbl =
@@ -4059,6 +5068,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device
@@ -4207,6 +5214,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device
object->device = iface;
object->refcount = 1;

View File

@ -1,38 +0,0 @@
From a911b0d8c83dae701997bbbc476b55376727c647 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 24 Jan 2017 11:52:50 +0100
Subject: d3d11: Simplify d3d11_deferred_context_IASetVertexBuffers.
---
dlls/d3d11/device.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 83d97665ed5..7cd16c37470 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -3252,17 +3252,15 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_IASetVertexBuffers(ID3D11De
call->vbuffer_info.num_buffers = buffer_count;
call->vbuffer_info.buffers = (void *)(call + 1);
+ call->vbuffer_info.strides = (void *)&call->vbuffer_info.buffers[buffer_count];
+ call->vbuffer_info.offsets = (void *)&call->vbuffer_info.strides[buffer_count];
for (i = 0; i < buffer_count; i++)
{
if (buffers[i]) ID3D11Buffer_AddRef(buffers[i]);
call->vbuffer_info.buffers[i] = buffers[i];
+ call->vbuffer_info.strides[i] = strides[i];
+ call->vbuffer_info.offsets[i] = offsets[i];
}
-
- call->vbuffer_info.strides = (void *)((char *)call->vbuffer_info.buffers + buffer_count * sizeof(*buffers));
- memcpy(call->vbuffer_info.strides, strides, sizeof(UINT) * buffer_count);
-
- call->vbuffer_info.offsets = (void *)((char *)call->vbuffer_info.strides + buffer_count * sizeof(UINT));
- memcpy(call->vbuffer_info.offsets, offsets, sizeof(UINT) * buffer_count);
}
static void STDMETHODCALLTYPE d3d11_deferred_context_IASetIndexBuffer(ID3D11DeviceContext *iface,
--
2.11.0

View File

@ -3348,7 +3348,6 @@ if test "$enable_d3d11_Deferred_Context" -eq 1; then
patch_apply d3d11-Deferred_Context/0008-d3d11-Implement-ClearRenderTargetView-for-deferred-c.patch
patch_apply d3d11-Deferred_Context/0009-d3d11-Implement-Draw-for-deferred-contexts.patch
patch_apply d3d11-Deferred_Context/0010-d3d11-Implement-ClearDepthStencilView-for-deferred-c.patch
patch_apply d3d11-Deferred_Context/0011-d3d11-Simplify-d3d11_deferred_context_IASetVertexBuf.patch
(
printf '%s\n' '+ { "Kimmo Myllyvirta", "d3d11: Add stub deferred rendering context.", 1 },';
printf '%s\n' '+ { "Michael Müller", "wined3d: Add wined3d_resource_map_info function.", 1 },';
@ -3360,7 +3359,6 @@ if test "$enable_d3d11_Deferred_Context" -eq 1; then
printf '%s\n' '+ { "Michael Müller", "d3d11: Implement ClearRenderTargetView for deferred contexts.", 1 },';
printf '%s\n' '+ { "Michael Müller", "d3d11: Implement Draw for deferred contexts.", 1 },';
printf '%s\n' '+ { "Michael Müller", "d3d11: Implement ClearDepthStencilView for deferred contexts.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "d3d11: Simplify d3d11_deferred_context_IASetVertexBuffers.", 1 },';
) >> "$patchlist"
fi