Mesa (shader-work): mesa: add GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB and env var to set it
Luca Barbieri
lb at kemper.freedesktop.org
Wed Sep 8 04:52:11 UTC 2010
Module: Mesa
Branch: shader-work
Commit: c834a102d87cf4988e6e16455f53e61b414aa31c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c834a102d87cf4988e6e16455f53e61b414aa31c
Author: Luca Barbieri <luca at luca-barbieri.com>
Date: Wed Sep 8 06:24:10 2010 +0200
mesa: add GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB and env var to set it
ARB_robustness specifies it, and we need the bit to choose whether
to apply some loop optimizations in the GLSL compiler.
Currenly, it is turned on by export MESA_ROBUST_ACCESS=1.
In the future, GLX_ARB_create_context_robustness will allow to turn
it on in the standard way.
---
src/mesa/main/context.c | 5 +++++
src/mesa/main/mtypes.h | 4 ++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 8e34ec4..1966309 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -873,6 +873,11 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
ctx->WinSysDrawBuffer = NULL;
ctx->WinSysReadBuffer = NULL;
+ /* eventually, GLX_ARB_create_context_robustness will be usable to enable this too */
+ if (_mesa_getenv("MESA_ROBUST_ACCESS")) {
+ ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB;
+ }
+
/* misc one-time initializations */
one_time_init(ctx);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3e54656..38a0728 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3089,6 +3089,10 @@ typedef enum {
API_OPENGLES2
} gl_api;
+#ifndef GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB
+#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
+#endif
+
/**
* Mesa rendering context.
*
More information about the mesa-commit
mailing list