[PATCH 07/10] wined3d: Add dispatch_compute() draw primitive.
Guillaume Charifi
guillaume.charifi at sfr.fr
Sun Jan 29 07:43:38 CST 2017
Signed-off-by: Guillaume Charifi <guillaume.charifi at sfr.fr>
---
dlls/wined3d/drawprim.c | 45 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 2 ++
2 files changed, 47 insertions(+)
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index a3d88b9..cbe77eb 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -580,3 +580,47 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
TRACE("Done all gl drawing.\n");
}
+
+void dispatch_compute(struct wined3d_device *device, const struct wined3d_state *state,
+ unsigned int thread_group_count_x, unsigned int thread_group_count_y, unsigned int thread_group_count_z)
+{
+
+ const struct wined3d_gl_info *gl_info;
+ struct wined3d_context *context;
+ unsigned int i;
+
+ context = context_acquire(device, NULL);
+ if (!context->valid)
+ {
+ context_release(context);
+ WARN("Invalid context, skipping draw.\n");
+ return;
+ }
+ gl_info = context->gl_info;
+
+ if (!context_apply_draw_state(context, device, state))
+ {
+ context_release(context);
+ WARN("Unable to apply draw state, skipping draw.\n");
+ return;
+ }
+
+ GL_EXTCALL(glDispatchCompute(thread_group_count_x, thread_group_count_y, thread_group_count_z));
+ checkGLcall("glDispatchCompute");
+
+ if (context->uses_uavs)
+ {
+ GL_EXTCALL(glMemoryBarrier(GL_ALL_BARRIER_BITS));
+ checkGLcall("glMemoryBarrier");
+ }
+
+ for (i = 0; i < context->num_buffer_queries; ++i)
+ wined3d_event_query_issue(context->buffer_queries[i], device);
+
+ if (wined3d_settings.strict_draw_ordering)
+ gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
+
+ context_release(context);
+
+ TRACE("Done all gl drawing (compute).\n");
+}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index fbf85fd..d3463e2 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1343,6 +1343,8 @@ struct wined3d_stream_info
void draw_primitive(struct wined3d_device *device, const struct wined3d_state *state,
int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
+void dispatch_compute(struct wined3d_device *device, const struct wined3d_state *state,
+ unsigned int thread_group_count_x, unsigned int thread_group_count_y, unsigned int thread_group_count_z) DECLSPEC_HIDDEN;
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN;
#define eps 1e-8f
--
Guillaume Charifi <guillaume.charifi at sfr.fr>
More information about the wine-patches
mailing list