From: Neil Roberts Date: Tue, 23 Sep 2014 18:01:04 +0000 (+0100) Subject: mesa: Add support for the GL_KHR_context_flush_control extension X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=60ec95fa1e0c42bd42358185970b20c9b81591fa;p=mesa.git mesa: Add support for the GL_KHR_context_flush_control extension The GL side of this extension just provides an accessor via glGetIntegerv for the value of GL_CONTEXT_RELEASE_BEHAVIOR so it is trivial to implement. There is a constant on the context for the value of the enum which is initialised to GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH. The extension is always enabled because it doesn't need any driver interaction to retrieve the value. If the value of the enum is anything but FLUSH then _mesa_make_current will now refrain from calling _mesa_flush. This should only affect drivers that explicitly change the enum to a non-default value. Reviewed-by: Ian Romanick --- diff --git a/src/mapi/glapi/gen/KHR_context_flush_control.xml b/src/mapi/glapi/gen/KHR_context_flush_control.xml new file mode 100644 index 00000000000..bc724357be1 --- /dev/null +++ b/src/mapi/glapi/gen/KHR_context_flush_control.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 534e6a0b403..e1b12462e34 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8379,6 +8379,8 @@ + + diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 25b9bfc4cf6..7c62dbc84da 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -719,6 +719,9 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) /** GL_ARB_gpu_shader5 */ consts->MinFragmentInterpolationOffset = MIN_FRAGMENT_INTERPOLATION_OFFSET; consts->MaxFragmentInterpolationOffset = MAX_FRAGMENT_INTERPOLATION_OFFSET; + + /** GL_KHR_context_flush_control */ + consts->ContextReleaseBehavior = GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH; } @@ -1622,9 +1625,11 @@ _mesa_make_current( struct gl_context *newCtx, } if (curCtx && - (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && + (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && /* make sure this context is valid for flushing */ - curCtx != newCtx) + curCtx != newCtx && + curCtx->Const.ContextReleaseBehavior == + GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH) _mesa_flush(curCtx); /* We used to call _glapi_check_multithread() here. Now do it in drivers */ diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 15d66a74425..0df04c2e698 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -320,6 +320,7 @@ static const struct extension extension_table[] = { /* KHR extensions */ { "GL_KHR_debug", o(dummy_true), GL, 2012 }, + { "GL_KHR_context_flush_control", o(dummy_true), GL | ES2, 2014 }, /* Vendor extensions */ { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index aa9f282d821..a931d9d86c1 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -318,6 +318,9 @@ descriptor=[ [ "PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL", "CONST(MAX_PERFQUERY_COUNTER_NAME_LENGTH), extra_INTEL_performance_query" ], [ "PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL", "CONST(MAX_PERFQUERY_COUNTER_DESC_LENGTH), extra_INTEL_performance_query" ], [ "PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL", "CONST(PERFQUERY_HAVE_GPA_EXTENDED_COUNTERS), extra_INTEL_performance_query" ], + +# GL_KHR_context_flush_control + [ "CONTEXT_RELEASE_BEHAVIOR", "CONTEXT_ENUM(Const.ContextReleaseBehavior), NO_EXTRA" ], ]}, # GLES3 is not a typo. diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e1f1f1dde44..35f5f698478 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3680,6 +3680,9 @@ struct gl_constants GLboolean FakeSWMSAA; + /** GL_KHR_context_flush_control */ + GLenum ContextReleaseBehavior; + struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; };