replace _mesa_logbase2 with util_logbase2
[mesa.git] / src / mesa / state_tracker / st_cb_texturebarrier.c
index 7fd1cbd1d7c37c41e365028ca3211489e44b4971..45db0a3a576542b46dd85bbb7c69b14320f4d8bc 100644 (file)
@@ -33,7 +33,7 @@
  */
 
 
-#include "main/imports.h"
+#include "util/imports.h"
 #include "main/context.h"
 
 #include "pipe/p_context.h"
@@ -54,6 +54,18 @@ st_TextureBarrier(struct gl_context *ctx)
 }
 
 
+/**
+ * Called via ctx->Driver.FramebufferFetchBarrier()
+ */
+static void
+st_FramebufferFetchBarrier(struct gl_context *ctx)
+{
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+
+   pipe->texture_barrier(pipe, PIPE_TEXTURE_BARRIER_FRAMEBUFFER);
+}
+
+
 /**
  * Called via ctx->Driver.MemoryBarrier()
  */
@@ -83,21 +95,25 @@ st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers)
        */
       flags |= PIPE_BARRIER_TEXTURE;
    }
-   /* GL_TEXTURE_UPDATE_BARRIER_BIT:
-    * Texture updates translate to:
-    *  (1) texture transfers to/from the CPU,
-    *  (2) texture as blit destination, or
-    *  (3) texture as framebuffer.
-    * In all cases, we assume the driver does the required flushing
-    * automatically.
-    */
-   /* GL_BUFFER_UPDATE_BARRIER_BIT:
-    * Buffer updates translate to
-    *  (1) buffer transfers to/from the CPU,
-    *  (2) resource copies and clears.
-    * In all cases, we assume the driver does the required flushing
-    * automatically.
-    */
+   if (barriers & GL_TEXTURE_UPDATE_BARRIER_BIT) {
+      /* GL_TEXTURE_UPDATE_BARRIER_BIT:
+       * Texture updates translate to:
+       *  (1) texture transfers to/from the CPU,
+       *  (2) texture as blit destination, or
+       *  (3) texture as framebuffer.
+       * Some drivers may handle these automatically, and can ignore the bit.
+       */
+      flags |= PIPE_BARRIER_UPDATE_TEXTURE;
+   }
+   if (barriers & GL_BUFFER_UPDATE_BARRIER_BIT) {
+      /* GL_BUFFER_UPDATE_BARRIER_BIT:
+       * Buffer updates translate to
+       *  (1) buffer transfers to/from the CPU,
+       *  (2) resource copies and clears.
+       * Some drivers may handle these automatically, and can ignore the bit.
+       */
+      flags |= PIPE_BARRIER_UPDATE_BUFFER;
+   }
    if (barriers & GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT)
       flags |= PIPE_BARRIER_MAPPED_BUFFER;
    if (barriers & GL_QUERY_BUFFER_BARRIER_BIT)
@@ -118,5 +134,6 @@ st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers)
 void st_init_texture_barrier_functions(struct dd_function_table *functions)
 {
    functions->TextureBarrier = st_TextureBarrier;
+   functions->FramebufferFetchBarrier = st_FramebufferFetchBarrier;
    functions->MemoryBarrier = st_MemoryBarrier;
 }