mesa/st: move barriers to direct call
authorDave Airlie <airlied@redhat.com>
Mon, 6 Dec 2021 07:04:14 +0000 (17:04 +1000)
committerMarge Bot <emma+marge@anholt.net>
Tue, 7 Dec 2021 13:03:53 +0000 (13:03 +0000)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14073>

src/mesa/main/barrier.c
src/mesa/main/dd.h
src/mesa/state_tracker/st_cb_texturebarrier.c
src/mesa/state_tracker/st_cb_texturebarrier.h
src/mesa/state_tracker/st_context.c

index 82f2dce..39e8d6e 100644 (file)
@@ -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);
 }
index afedf30..27bd1d6 100644 (file)
@@ -932,11 +932,6 @@ struct dd_function_table {
                                    struct gl_transform_feedback_object *obj);
 
    /**
-    * \name GL_NV_texture_barrier interface
-    */
-   void (*TextureBarrier)(struct gl_context *ctx);
-
-   /**
     * \name GL_ARB_texture_multisample
     */
    void (*GetSamplePosition)(struct gl_context *ctx,
@@ -968,25 +963,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
     */
    /*@{*/
index a790a7f..e1e50da 100644 (file)
@@ -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;
-}
index 3b7d377..d6bb516 100644 (file)
 #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
index dc06693..73c2a81 100644 (file)
@@ -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);