dri: Move i965-specific context flag logic to dri common.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_context.c
index f60d4df5d328d60e2a71afccbf8e7cccde040cfd..5d5f41a32fe5e9d0fb16cf19ec4930a1b7ded0bb 100644 (file)
@@ -176,6 +176,7 @@ brw_initialize_context_constants(struct brw_context *brw)
       ctx->Const.MaxColorTextureSamples = 8;
       ctx->Const.MaxDepthTextureSamples = 8;
       ctx->Const.MaxIntegerSamples = 8;
+      ctx->Const.MaxProgramTextureGatherComponents = 4;
    }
 
    ctx->Const.MinLineWidth = 1.0;
@@ -275,7 +276,7 @@ brw_initialize_context_constants(struct brw_context *brw)
 }
 
 bool
-brwCreateContext(int api,
+brwCreateContext(gl_api api,
                 const struct gl_config *mesaVis,
                 __DRIcontext *driContextPriv,
                  unsigned major_version,
@@ -310,7 +311,7 @@ brwCreateContext(int api,
                           mesaVis, driContextPriv,
                          sharedContextPrivate, &functions,
                          error)) {
-      ralloc_free(brw);
+      intelDestroyContext(driContextPriv);
       return false;
    }
 
@@ -331,7 +332,7 @@ brwCreateContext(int api,
 
       if (!brw->hw_ctx) {
          fprintf(stderr, "Gen6+ requires Kernel 3.6 or later.\n");
-         ralloc_free(brw);
+         intelDestroyContext(driContextPriv);
          return false;
       }
    }
@@ -478,16 +479,10 @@ brwCreateContext(int api,
    brw_draw_init( brw );
 
    brw->precompile = driQueryOptionb(&brw->optionCache, "shader_precompile");
+   brw->disable_derivative_optimization =
+      driQueryOptionb(&brw->optionCache, "disable_derivative_optimization");
 
-   ctx->Const.ContextFlags = 0;
-   if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
-      ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
-
-   ctx->Debug.DebugOutput = GL_FALSE;
    if ((flags & __DRI_CTX_FLAG_DEBUG) != 0) {
-      ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
-      ctx->Debug.DebugOutput = GL_TRUE;
-
       /* Turn on some extra GL_ARB_debug_output generation. */
       brw->perf_debug = true;
    }
@@ -503,6 +498,10 @@ brwCreateContext(int api,
    _mesa_initialize_dispatch_tables(ctx);
    _mesa_initialize_vbo_vtxfmt(ctx);
 
+   if (ctx->Extensions.AMD_performance_monitor) {
+      brw_init_performance_monitors(brw);
+   }
+
    return true;
 }