dri: Move i965-specific context flag logic to dri common.
[mesa.git] / src / mesa / drivers / dri / common / dri_util.c
index 32f0e33009f594dfd6ccdffd037fd4dd8527f380..db44eede651168185ee04a53f4557631aa508c37 100644 (file)
@@ -47,6 +47,7 @@
 #include "utils.h"
 #include "xmlpool.h"
 #include "../glsl/glsl_parser_extras.h"
+#include "main/mtypes.h"
 #include "main/version.h"
 #include "main/macros.h"
 
@@ -378,6 +379,14 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
         return NULL;
     }
 
+    struct gl_context *ctx = context->driverPrivate;
+    if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
+        ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
+    if ((flags & __DRI_CTX_FLAG_DEBUG) != 0) {
+        ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
+        ctx->Debug.DebugOutput = GL_TRUE;
+    }
+
     *error = __DRI_CTX_ERROR_SUCCESS;
     return context;
 }