Mesa (main): mesa/st: move barriers to direct call

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 7 13:47:27 UTC 2021


Module: Mesa
Branch: main
Commit: 12f8475ff98cfc0b14274fb4a62ed26258c84845
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=12f8475ff98cfc0b14274fb4a62ed26258c84845

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Dec  6 17:04:14 2021 +1000

mesa/st: move barriers to direct call

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14073>

---

 src/mesa/main/barrier.c                       | 63 +++++++++++++--------------
 src/mesa/main/dd.h                            | 24 ----------
 src/mesa/state_tracker/st_cb_texturebarrier.c | 13 ++----
 src/mesa/state_tracker/st_cb_texturebarrier.h |  8 ++--
 src/mesa/state_tracker/st_context.c           |  2 -
 5 files changed, 37 insertions(+), 73 deletions(-)

diff --git a/src/mesa/main/barrier.c b/src/mesa/main/barrier.c
index 82f2dce86ac..39e8d6ead63 100644
--- a/src/mesa/main/barrier.c
+++ b/src/mesa/main/barrier.c
@@ -31,6 +31,8 @@
 #include "context.h"
 #include "barrier.h"
 
+#include "state_tracker/st_cb_texturebarrier.h"
+
 void GLAPIENTRY
 _mesa_TextureBarrierNV(void)
 {
@@ -42,7 +44,7 @@ _mesa_TextureBarrierNV(void)
       return;
    }
 
-   ctx->Driver.TextureBarrier(ctx);
+   st_TextureBarrier(ctx);
 }
 
 void GLAPIENTRY
@@ -50,8 +52,7 @@ _mesa_MemoryBarrier(GLbitfield barriers)
 {
    GET_CURRENT_CONTEXT(ctx);
 
-   if (ctx->Driver.MemoryBarrier)
-      ctx->Driver.MemoryBarrier(ctx, barriers);
+   st_MemoryBarrier(ctx, barriers);
 }
 
 static ALWAYS_INLINE void
@@ -65,34 +66,32 @@ memory_barrier_by_region(struct gl_context *ctx, GLbitfield barriers,
                                  GL_TEXTURE_FETCH_BARRIER_BIT |
                                  GL_UNIFORM_BARRIER_BIT;
 
-   if (ctx->Driver.MemoryBarrier) {
-      /* From section 7.11.2 of the OpenGL ES 3.1 specification:
-       *
-       *    "When barriers is ALL_BARRIER_BITS, shader memory accesses will be
-       *     synchronized relative to all these barrier bits, but not to other
-       *     barrier bits specific to MemoryBarrier."
-       *
-       * That is, if barriers is the special value GL_ALL_BARRIER_BITS, then all
-       * barriers allowed by glMemoryBarrierByRegion should be activated."
-       */
-      if (barriers == GL_ALL_BARRIER_BITS) {
-         ctx->Driver.MemoryBarrier(ctx, all_allowed_bits);
-         return;
-      }
-
-      /* From section 7.11.2 of the OpenGL ES 3.1 specification:
-       *
-       *    "An INVALID_VALUE error is generated if barriers is not the special
-       *     value ALL_BARRIER_BITS, and has any bits set other than those
-       *     described above."
-       */
-      if (!no_error && (barriers & ~all_allowed_bits) != 0) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glMemoryBarrierByRegion(unsupported barrier bit");
-      }
-
-      ctx->Driver.MemoryBarrier(ctx, barriers);
+   /* From section 7.11.2 of the OpenGL ES 3.1 specification:
+    *
+    *    "When barriers is ALL_BARRIER_BITS, shader memory accesses will be
+    *     synchronized relative to all these barrier bits, but not to other
+    *     barrier bits specific to MemoryBarrier."
+    *
+    * That is, if barriers is the special value GL_ALL_BARRIER_BITS, then all
+    * barriers allowed by glMemoryBarrierByRegion should be activated."
+    */
+   if (barriers == GL_ALL_BARRIER_BITS) {
+      st_MemoryBarrier(ctx, all_allowed_bits);
+      return;
    }
+
+   /* From section 7.11.2 of the OpenGL ES 3.1 specification:
+    *
+    *    "An INVALID_VALUE error is generated if barriers is not the special
+    *     value ALL_BARRIER_BITS, and has any bits set other than those
+    *     described above."
+    */
+   if (!no_error && (barriers & ~all_allowed_bits) != 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glMemoryBarrierByRegion(unsupported barrier bit");
+   }
+
+   st_MemoryBarrier(ctx, barriers);
 }
 
 void GLAPIENTRY
@@ -120,7 +119,7 @@ _mesa_BlendBarrier(void)
       return;
    }
 
-   ctx->Driver.FramebufferFetchBarrier(ctx);
+   st_FramebufferFetchBarrier(ctx);
 }
 
 void GLAPIENTRY
@@ -134,5 +133,5 @@ _mesa_FramebufferFetchBarrierEXT(void)
       return;
    }
 
-   ctx->Driver.FramebufferFetchBarrier(ctx);
+   st_FramebufferFetchBarrier(ctx);
 }
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index afedf30b715..27bd1d66334 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -931,11 +931,6 @@ struct dd_function_table {
    void (*ResumeTransformFeedback)(struct gl_context *ctx,
                                    struct gl_transform_feedback_object *obj);
 
-   /**
-    * \name GL_NV_texture_barrier interface
-    */
-   void (*TextureBarrier)(struct gl_context *ctx);
-
    /**
     * \name GL_ARB_texture_multisample
     */
@@ -967,25 +962,6 @@ struct dd_function_table {
     */
    GLenum (*GetGraphicsResetStatus)(struct gl_context *ctx);
 
-   /**
-    * \name GL_ARB_shader_image_load_store interface.
-    */
-   /** @{ */
-   void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
-   /** @} */
-
-   /**
-    * GL_EXT_shader_framebuffer_fetch_non_coherent rendering barrier.
-    *
-    * On return from this function any framebuffer contents written by
-    * previous draw commands are guaranteed to be visible from subsequent
-    * fragment shader invocations using the
-    * EXT_shader_framebuffer_fetch_non_coherent interface.
-    */
-   /** @{ */
-   void (*FramebufferFetchBarrier)(struct gl_context *ctx);
-   /** @} */
-
    /**
     * \name GL_ARB_compute_shader interface
     */
diff --git a/src/mesa/state_tracker/st_cb_texturebarrier.c b/src/mesa/state_tracker/st_cb_texturebarrier.c
index a790a7f649d..e1e50da9b23 100644
--- a/src/mesa/state_tracker/st_cb_texturebarrier.c
+++ b/src/mesa/state_tracker/st_cb_texturebarrier.c
@@ -45,7 +45,7 @@
 /**
  * Called via ctx->Driver.TextureBarrier()
  */
-static void
+void
 st_TextureBarrier(struct gl_context *ctx)
 {
    struct pipe_context *pipe = st_context(ctx)->pipe;
@@ -57,7 +57,7 @@ st_TextureBarrier(struct gl_context *ctx)
 /**
  * Called via ctx->Driver.FramebufferFetchBarrier()
  */
-static void
+void
 st_FramebufferFetchBarrier(struct gl_context *ctx)
 {
    struct pipe_context *pipe = st_context(ctx)->pipe;
@@ -69,7 +69,7 @@ st_FramebufferFetchBarrier(struct gl_context *ctx)
 /**
  * Called via ctx->Driver.MemoryBarrier()
  */
-static void
+void
 st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers)
 {
    struct pipe_context *pipe = st_context(ctx)->pipe;
@@ -130,10 +130,3 @@ st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers)
    if (flags && pipe->memory_barrier)
       pipe->memory_barrier(pipe, flags);
 }
-
-void st_init_texture_barrier_functions(struct dd_function_table *functions)
-{
-   functions->TextureBarrier = st_TextureBarrier;
-   functions->FramebufferFetchBarrier = st_FramebufferFetchBarrier;
-   functions->MemoryBarrier = st_MemoryBarrier;
-}
diff --git a/src/mesa/state_tracker/st_cb_texturebarrier.h b/src/mesa/state_tracker/st_cb_texturebarrier.h
index 3b7d3776fd5..d6bb516465d 100644
--- a/src/mesa/state_tracker/st_cb_texturebarrier.h
+++ b/src/mesa/state_tracker/st_cb_texturebarrier.h
@@ -28,10 +28,8 @@
 #ifndef ST_CB_TEXTUREBARRIER_H
 #define ST_CB_TEXTUREBARRIER_H
 
-
-struct dd_function_table;
-
-extern void st_init_texture_barrier_functions(struct dd_function_table *functions);
-
+void st_TextureBarrier(struct gl_context *ctx);
+void st_FramebufferFetchBarrier(struct gl_context *ctx);
+void st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers);
 
 #endif
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index dc0669341ef..73c2a81ad1d 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -66,7 +66,6 @@
 #include "st_cb_texture.h"
 #include "st_cb_xformfb.h"
 #include "st_cb_flush.h"
-#include "st_cb_texturebarrier.h"
 #include "st_cb_viewport.h"
 #include "st_atom.h"
 #include "st_draw.h"
@@ -963,7 +962,6 @@ st_init_driver_functions(struct pipe_screen *screen,
    st_init_readpixels_functions(functions);
    st_init_semaphoreobject_functions(functions);
    st_init_texture_functions(functions);
-   st_init_texture_barrier_functions(functions);
    st_init_flush_functions(screen, functions);
    st_init_viewport_functions(functions);
    st_init_compute_functions(functions);



More information about the mesa-commit mailing list