d3d11:Implement remaining deferred context draw methods. Superseded

Revisions: 

Revision 1

user image Johannes Specht Author
31 Aug. 17

Implementation of the remaining deferred context draw methods.

Single files Merged diff Tar archive
You have unsaved changes. Press CTRL + ENTER in a text field to submit your comments.

0002-d3d11-Implement-remaining-deferred-context-draw-meth.patch

From d8a723eb806a7dbf301946402fb3e0b8dcdd2211 Mon Sep 17 00:00:00 2001
From: Johannes Specht <jojos_band@gmx.net>
Date: Thu, 31 Aug 2017 20:40:30 +0200
Subject: d3d11:Implement remaining deferred context draw methods
---
dlls/d3d11/device.c | 123 +++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 118 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index b81ad2434e7..e49cb485485 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -80,6 +80,10 @@ enum deferred_cmd
DEFERRED_DRAW, /* draw_info */
DEFERRED_DRAWINDEXED, /* draw_indexed_info */
DEFERRED_DRAWINDEXEDINSTANCED, /* draw_indexed_inst_info */
+ DEFERRED_DRAWAUTO,
+ DEFERRED_DRAWINSTANCED, /* draw_instanced_info */
+ DEFERRED_DRAWINSTANCEDINDIRECT, /* draw_instanced_indirect_info */
+ DEFERRED_DRAWINDEXEDINSTANCEDINDIRECT, /* draw_indexed_instanced_indirect_info */
DEFERRED_MAP, /* map_info */
DEFERRED_DISPATCH, /* dispatch_info */
@@ -265,6 +269,23 @@ struct deferred_call
UINT start_instance;
} draw_indexed_inst_info;
struct
+ {
+ UINT instance_vertex_count;
+ UINT instance_count;
+ UINT start_vertex_location;
+ UINT start_instance_location;
+ } draw_instanced_info;
+ struct
+ {
+ ID3D11Buffer *buffer;
+ UINT offset;
+ } draw_indexed_instanced_indirect_info;
+ struct
+ {
+ ID3D11Buffer *buffer;
+ UINT offset;
+ } draw_instanced_indirect_info;
+ struct
{
ID3D11Resource *resource;
UINT subresource_idx;
@@ -604,6 +625,26 @@ static void free_deferred_calls(struct list *commands)
{
break; /* nothing to do */
}
+ case DEFERRED_DRAWAUTO:
+ {
+ break; /* nothing to do */
+ }
+ case DEFERRED_DRAWINSTANCED:
+ {
+ break; /* nothing to do */
+ }
+ case DEFERRED_DRAWINSTANCEDINDIRECT:
+ {
+ if (call->draw_instanced_indirect_info.buffer)
+ ID3D11Buffer_Release(call->draw_instanced_indirect_info.buffer);
+ break;
+ }
+ case DEFERRED_DRAWINDEXEDINSTANCEDINDIRECT:
+ {
+ if (call->draw_indexed_instanced_indirect_info.buffer)
+ ID3D11Buffer_Release(call->draw_indexed_instanced_indirect_info.buffer);
+ break;
+ }
case DEFERRED_MAP:
{
ID3D11Resource_Release(call->map_info.resource);
@@ -926,6 +967,34 @@ static void exec_deferred_calls(ID3D11DeviceContext *iface, struct list *command
call->draw_indexed_inst_info.base_vertex, call->draw_indexed_inst_info.start_instance);
break;
}
+ case DEFERRED_DRAWAUTO:
+ {
+ ID3D11DeviceContext_DrawAuto(iface);
+ break;
+ }
+ case DEFERRED_DRAWINSTANCED:
+ {
+ ID3D11DeviceContext_DrawInstanced(iface,
+ call->draw_instanced_info.instance_vertex_count,
+ call->draw_instanced_info.instance_count,
+ call->draw_instanced_info.start_vertex_location,
+ call->draw_instanced_info.start_instance_location);
+ break;
+ }
+ case DEFERRED_DRAWINSTANCEDINDIRECT:
+ {
+ ID3D11DeviceContext_DrawInstancedIndirect(iface,
+ call->draw_instanced_indirect_info.buffer,
+ call->draw_instanced_indirect_info.offset);
+ break;
+ }
+ case DEFERRED_DRAWINDEXEDINSTANCEDINDIRECT:
+ {
+ ID3D11DeviceContext_DrawIndexedInstancedIndirect(iface,
+ call->draw_indexed_instanced_indirect_info.buffer,
+ call->draw_indexed_instanced_indirect_info.offset);
+ break;
+ }
case DEFERRED_MAP:
{
D3D11_MAPPED_SUBRESOURCE mapped;
@@ -4170,10 +4239,22 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DrawIndexedInstanced(ID3D11
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstanced(ID3D11DeviceContext *iface,
UINT instance_vertex_count, UINT instance_count, UINT start_vertex_location, UINT start_instance_location)
{
- FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u, "
- "start_instance_location %u stub!\n",
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+
+ TRACE("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u, "
+ "start_instance_location %u.\n",
iface, instance_vertex_count, instance_count, start_vertex_location,
start_instance_location);
+
+ if (!(call = add_deferred_call(context, 0)))
+ return;
+
+ call->cmd = DEFERRED_DRAWINSTANCED;
+ call->draw_instanced_info.instance_vertex_count = instance_vertex_count;
+ call->draw_instanced_info.instance_count = instance_count;
+ call->draw_instanced_info.start_vertex_location = start_vertex_location;
+ call->draw_instanced_info.start_instance_location = start_instance_location;
}
static void STDMETHODCALLTYPE d3d11_deferred_context_GSSetConstantBuffers(ID3D11DeviceContext *iface,
@@ -4403,19 +4484,51 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_SOSetTargets(ID3D11DeviceCo
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawAuto(ID3D11DeviceContext *iface)
{
- FIXME("iface %p stub!\n", iface);
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+
+ TRACE("iface %p.\n", iface);
+
+ if (!(call = add_deferred_call(context,0)))
+ return;
+
+ call->cmd = DEFERRED_DRAWAUTO;
}
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawIndexedInstancedIndirect(ID3D11DeviceContext *iface,
ID3D11Buffer *buffer, UINT offset)
{
- FIXME("iface %p, buffer %p, offset %u stub!\n", iface, buffer, offset);
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+
+ TRACE("iface %p, buffer %p, offset %u.\n", iface, buffer, offset);
+
+ if (!(call = add_deferred_call(context,0)))
+ return;
+
+ call->cmd = DEFERRED_DRAWINDEXEDINSTANCEDINDIRECT;
+
+ if (buffer) ID3D11Buffer_AddRef(buffer);
+ call->draw_indexed_instanced_indirect_info.buffer = buffer;
+ call->draw_indexed_instanced_indirect_info.offset = offset;
}
static void STDMETHODCALLTYPE d3d11_deferred_context_DrawInstancedIndirect(ID3D11DeviceContext *iface,
ID3D11Buffer *buffer, UINT offset)
{
- FIXME("iface %p, buffer %p, offset %u stub!\n", iface, buffer, offset);
+ struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+ struct deferred_call *call;
+
+ TRACE("iface %p, buffer %p, offset %u.\n", iface, buffer, offset);
+
+ if (!(call = add_deferred_call(context,0)))
+ return;
+
+ call->cmd = DEFERRED_DRAWINSTANCEDINDIRECT;
+
+ if (buffer) ID3D11Buffer_AddRef(buffer);
+ call->draw_instanced_indirect_info.buffer = buffer;
+ call->draw_instanced_indirect_info.offset = offset;
}
static void STDMETHODCALLTYPE d3d11_deferred_context_Dispatch(ID3D11DeviceContext *iface,
--
2.14.1