=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Move dispatch_compute() to context.c file.

Alexandre Julliard julliard at winehq.org
Mon Feb 26 13:42:20 CST 2018


Module: wine
Branch: master
Commit: 41717a148e48544811a5eefcb7e49c8433d5f90b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=41717a148e48544811a5eefcb7e49c8433d5f90b

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Sun Feb 25 23:23:28 2018 +0100

wined3d: Move dispatch_compute() to context.c file.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 d552c8c..1c39f0a 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -4023,7 +4023,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;
@@ -4247,3 +4247,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 = &parameters->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 = &parameters->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 7eccc8f..f87f091 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 = &parameters->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 = &parameters->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 b4d15c5..650c1a5 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,




More information about the wine-cvs mailing list