[PATCH 1/7] wined3d: Move dispatch_compute() to context.c file.
Józef Kucia
joseph.kucia at gmail.com
Sun Feb 25 16:23:28 CST 2018
From: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/context.c | 61 +++++++++++++++++++++++++++++++++++++++++-
dlls/wined3d/drawprim.c | 59 ----------------------------------------
dlls/wined3d/wined3d_private.h | 2 --
3 files changed, 60 insertions(+), 62 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 4929b843c244..e36898f84fd9 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -4003,7 +4003,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
return TRUE;
}
-void context_apply_compute_state(struct wined3d_context *context,
+static void context_apply_compute_state(struct wined3d_context *context,
const struct wined3d_device *device, const struct wined3d_state *state)
{
const struct StateEntry *state_table = context->state_table;
@@ -4227,3 +4227,62 @@ struct wined3d_context *context_reacquire(const struct wined3d_device *device,
ERR("Acquired context %p instead of %p.\n", current_context, context);
return current_context;
}
+
+void dispatch_compute(struct wined3d_device *device, const struct wined3d_state *state,
+ const struct wined3d_dispatch_parameters *parameters)
+{
+ const struct wined3d_gl_info *gl_info;
+ struct wined3d_context *context;
+
+ context = context_acquire(device, NULL, 0);
+ if (!context->valid)
+ {
+ context_release(context);
+ WARN("Invalid context, skipping dispatch.\n");
+ return;
+ }
+ gl_info = context->gl_info;
+
+ if (!gl_info->supported[ARB_COMPUTE_SHADER])
+ {
+ context_release(context);
+ FIXME("OpenGL implementation does not support compute shaders.\n");
+ return;
+ }
+
+ if (parameters->indirect)
+ wined3d_buffer_load(parameters->u.indirect.buffer, context, state);
+
+ context_apply_compute_state(context, device, state);
+
+ if (!state->shader[WINED3D_SHADER_TYPE_COMPUTE])
+ {
+ context_release(context);
+ WARN("No compute shader bound, skipping dispatch.\n");
+ return;
+ }
+
+ if (parameters->indirect)
+ {
+ const struct wined3d_indirect_dispatch_parameters *indirect = ¶meters->u.indirect;
+ struct wined3d_buffer *buffer = indirect->buffer;
+
+ GL_EXTCALL(glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, buffer->buffer_object));
+ GL_EXTCALL(glDispatchComputeIndirect((GLintptr)indirect->offset));
+ GL_EXTCALL(glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0));
+ }
+ else
+ {
+ const struct wined3d_direct_dispatch_parameters *direct = ¶meters->u.direct;
+ GL_EXTCALL(glDispatchCompute(direct->group_count_x, direct->group_count_y, direct->group_count_z));
+ }
+ checkGLcall("dispatch compute");
+
+ GL_EXTCALL(glMemoryBarrier(GL_ALL_BARRIER_BITS));
+ checkGLcall("glMemoryBarrier");
+
+ if (wined3d_settings.strict_draw_ordering)
+ gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
+
+ context_release(context);
+}
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 7eccc8f7d621..f87f0919c166 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -727,62 +727,3 @@ 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,
- const struct wined3d_dispatch_parameters *parameters)
-{
- const struct wined3d_gl_info *gl_info;
- struct wined3d_context *context;
-
- context = context_acquire(device, NULL, 0);
- if (!context->valid)
- {
- context_release(context);
- WARN("Invalid context, skipping dispatch.\n");
- return;
- }
- gl_info = context->gl_info;
-
- if (!gl_info->supported[ARB_COMPUTE_SHADER])
- {
- context_release(context);
- FIXME("OpenGL implementation does not support compute shaders.\n");
- return;
- }
-
- if (parameters->indirect)
- wined3d_buffer_load(parameters->u.indirect.buffer, context, state);
-
- context_apply_compute_state(context, device, state);
-
- if (!state->shader[WINED3D_SHADER_TYPE_COMPUTE])
- {
- context_release(context);
- WARN("No compute shader bound, skipping dispatch.\n");
- return;
- }
-
- if (parameters->indirect)
- {
- const struct wined3d_indirect_dispatch_parameters *indirect = ¶meters->u.indirect;
- struct wined3d_buffer *buffer = indirect->buffer;
-
- GL_EXTCALL(glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, buffer->buffer_object));
- GL_EXTCALL(glDispatchComputeIndirect((GLintptr)indirect->offset));
- GL_EXTCALL(glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0));
- }
- else
- {
- const struct wined3d_direct_dispatch_parameters *direct = ¶meters->u.direct;
- GL_EXTCALL(glDispatchCompute(direct->group_count_x, direct->group_count_y, direct->group_count_z));
- }
- checkGLcall("dispatch compute");
-
- GL_EXTCALL(glMemoryBarrier(GL_ALL_BARRIER_BITS));
- checkGLcall("glMemoryBarrier");
-
- if (wined3d_settings.strict_draw_ordering)
- gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
-
- context_release(context);
-}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b4d15c5b5f95..650c1a554e27 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2135,8 +2135,6 @@ void context_alloc_occlusion_query(struct wined3d_context *context,
void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device) DECLSPEC_HIDDEN;
BOOL context_apply_clear_state(struct wined3d_context *context, const struct wined3d_state *state,
UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN;
-void context_apply_compute_state(struct wined3d_context *context,
- const struct wined3d_device *device, const struct wined3d_state *state) DECLSPEC_HIDDEN;
BOOL context_apply_draw_state(struct wined3d_context *context,
const struct wined3d_device *device, const struct wined3d_state *state) DECLSPEC_HIDDEN;
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
--
2.16.1
More information about the wine-devel
mailing list