mesa: Implement GL_KHR_blend_equation_advanced_coherent.

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>
This commit is contained in:
Kenneth Graunke 2016-06-29 21:53:06 -07:00
parent c2b10cabed
commit 1bf9b2a600
6 changed files with 23 additions and 0 deletions

View 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;
}
/*@}*/

View 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;
}

View 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)

View 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[] = {

View 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.

View 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;