mesa: Add blend barrier entry point and driver hook.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 6 Jul 2016 06:21:21 +0000 (23:21 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 24 Aug 2016 20:28:30 +0000 (13:28 -0700)
Both MESA_shader_framebuffer_fetch_non_coherent and the non-coherent
variant of KHR_blend_equation_advanced will use this driver hook to
request coherency between framebuffer reads and writes.  This
intentionally doesn't hook up glBlendBarrierMESA to the dispatch layer
since the extension isn't exposed to applications yet, see [1]
for more details.

[1] https://lists.freedesktop.org/archives/mesa-dev/2016-July/124028.html

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/barrier.c
src/mesa/main/barrier.h
src/mesa/main/dd.h

index 7ae8fc6b0aac41162fe47d5b49cc8261103ffaf3..42a5e0f920300130975d8faf524a9a28c9bf497a 100644 (file)
@@ -108,3 +108,17 @@ _mesa_MemoryBarrierByRegion(GLbitfield barriers)
       ctx->Driver.MemoryBarrier(ctx, barriers);
    }
 }
+
+void GLAPIENTRY
+_mesa_BlendBarrierMESA(void)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (!ctx->Extensions.MESA_shader_framebuffer_fetch_non_coherent) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glBlendBarrier(not supported)");
+      return;
+   }
+
+   ctx->Driver.BlendBarrier(ctx);
+}
index 8eee583c7ff5fe41b971ea3a519145e5f44e631d..21dce90d074a2aadf0f76353ff82c04563e847e9 100644 (file)
@@ -47,4 +47,7 @@ _mesa_MemoryBarrier(GLbitfield barriers);
 void GLAPIENTRY
 _mesa_MemoryBarrierByRegion(GLbitfield barriers);
 
+void GLAPIENTRY
+_mesa_BlendBarrierMESA(void);
+
 #endif /* BARRIER_H */
index a3dc191b4441bfdeaf097c5a99556b7c95b7d227..257dc10381754bcf47f0241d5f63d8e2f7324034 100644 (file)
@@ -957,6 +957,18 @@ struct dd_function_table {
    void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
    /** @} */
 
+   /**
+    * GL_MESA_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
+    * MESA_shader_framebuffer_fetch_non_coherent interface.
+    */
+   /** @{ */
+   void (*BlendBarrier)(struct gl_context *ctx);
+   /** @} */
+
    /**
     * \name GL_ARB_compute_shader interface
     */