mesa: Implement GL_KHR_blend_equation_advanced_coherent.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 30 Jun 2016 04:53:06 +0000 (21:53 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Aug 2016 02:22:10 +0000 (19:22 -0700)
This adds the extension enable (so drivers can advertise it) and the
extra boolean state flag, GL_BLEND_ADVANCED_COHERENT_KHR, which can
be set to request coherent blending.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/mesa/main/blend.c
src/mesa/main/enable.c
src/mesa/main/extensions_table.h
src/mesa/main/get.c
src/mesa/main/get_hash_params.py
src/mesa/main/mtypes.h

index de6d3c48e05fd452e5e9811cf3f4d17cd6670317..ad79ee011d29b58b2e4df0cb804931dea4fe4ce5 100644 (file)
@@ -1039,6 +1039,8 @@ void _mesa_init_color( struct gl_context * ctx )
     * if EGL_KHR_gl_colorspace has been used to request sRGB.
     */
    ctx->Color.sRGBEnabled = _mesa_is_gles(ctx);
+
+   ctx->Color.BlendCoherent = true;
 }
 
 /*@}*/
index 1468a4597919bcb7564cd042ecd6fe4365aea3d1..d1ab81e50eef3acba0b038a636588b8348ca5629 100644 (file)
@@ -1017,6 +1017,14 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          ctx->Multisample.SampleMask = state;
          break;
 
+      case GL_BLEND_ADVANCED_COHERENT_KHR:
+         CHECK_EXTENSION(KHR_blend_equation_advanced_coherent, cap);
+         if (ctx->Color.BlendCoherent == state)
+            return;
+         FLUSH_VERTICES(ctx, _NEW_COLOR);
+         ctx->Color.BlendCoherent = state;
+         break;
+
       default:
          goto invalid_enum_error;
    }
@@ -1619,6 +1627,10 @@ _mesa_IsEnabled( GLenum cap )
          CHECK_EXTENSION(ARB_sample_shading);
          return ctx->Multisample.SampleShading;
 
+      case GL_BLEND_ADVANCED_COHERENT_KHR:
+         CHECK_EXTENSION(KHR_blend_equation_advanced_coherent);
+         return ctx->Color.BlendCoherent;
+
       default:
          goto invalid_enum_error;
    }
index e8c825bb1130d1b82147e17555f8e5a317067331..c6fdd2c4cc669a8569c2e71ed4624ece01bc9ca6 100644 (file)
@@ -283,6 +283,7 @@ EXT(INGR_blend_func_separate                , EXT_blend_func_separate
 EXT(INTEL_performance_query                 , INTEL_performance_query                , GLL, GLC,  x , ES2, 2013)
 
 EXT(KHR_blend_equation_advanced             , KHR_blend_equation_advanced            , GLL, GLC,  x , ES2, 2014)
+EXT(KHR_blend_equation_advanced_coherent    , KHR_blend_equation_advanced_coherent   , GLL, GLC,  x , ES2, 2014)
 EXT(KHR_context_flush_control               , dummy_true                             , GLL, GLC,  x , ES2, 2014)
 EXT(KHR_debug                               , dummy_true                             , GLL, GLC,  11, ES2, 2012)
 EXT(KHR_robust_buffer_access_behavior       , ARB_robust_buffer_access_behavior      , GLL, GLC,  x , ES2, 2014)
index b0178270ae7da0b856497564cea06e29545297f0..97dfb0c59fdd0efb0a000edf68b172b7e855c46c 100644 (file)
@@ -465,6 +465,7 @@ EXTRA_EXT(ATI_meminfo);
 EXTRA_EXT(NVX_gpu_memory_info);
 EXTRA_EXT(ARB_cull_distance);
 EXTRA_EXT(EXT_window_rectangles);
+EXTRA_EXT(KHR_blend_equation_advanced_coherent);
 
 static const int
 extra_ARB_color_buffer_float_or_glcore[] = {
index 89d164dd98df9e103bcbd78dfec0b73d2fbc2b08..3414743ddbf94aece6e7c1f191183bf99d59c9d4 100644 (file)
@@ -338,6 +338,9 @@ descriptor=[
 
 # blend_func_extended
   [ "MAX_DUAL_SOURCE_DRAW_BUFFERS", "CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended" ],
+
+# GL_KHR_blend_equation_advanced_coherent
+  [ "BLEND_ADVANCED_COHERENT_KHR", "CONTEXT_BOOL(Color.BlendCoherent), extra_KHR_blend_equation_advanced_coherent" ],
 ]},
 
 # GLES3 is not a typo.
index 3e12555e390c6ce3ecf87187c215ea647a135032..76371609e6c67fab30452f0e1357ef20c96dfa36 100644 (file)
@@ -461,6 +461,9 @@ struct gl_colorbuffer_attrib
     * requires all draw buffers to match, so we only need a single value.
     */
    enum gl_advanced_blend_mode _AdvancedBlendMode;
+
+   /** Coherency requested via glEnable(GL_BLEND_ADVANCED_COHERENT_KHR)? */
+   bool BlendCoherent;
    /*@}*/
 
    /** 
@@ -3957,6 +3960,7 @@ struct gl_extensions
    GLboolean GREMEDY_string_marker;
    GLboolean INTEL_performance_query;
    GLboolean KHR_blend_equation_advanced;
+   GLboolean KHR_blend_equation_advanced_coherent;
    GLboolean KHR_robustness;
    GLboolean KHR_texture_compression_astc_hdr;
    GLboolean KHR_texture_compression_astc_ldr;