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
Tue Sep 14 02:30:47 UTC 2010


Module: Mesa
Branch: shader-work
Commit: 1c6de307bb73b492274aeba303fb69160df69514
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c6de307bb73b492274aeba303fb69160df69514

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 979bc40..f5fe94d 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 cabc42b..d66a60f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3088,6 +3088,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