Merge branch 'llvm-cliptest-viewport'
[mesa.git] / src / mesa / drivers / dri / intel / intel_extensions.c
index 1a32026eb5aaf28ce117601c8712557031bf2250..974045730be4011a1a8d8a547bc44a84a3db1fa6 100644 (file)
@@ -196,19 +196,36 @@ static const struct dri_extension fragment_shader_extensions[] = {
    { NULL, NULL }
 };
 
+/**
+ * \brief Get GLSL version from the environment.
+ *
+ * If the environment variable INTEL_GLSL_VERSION is set, convert its value
+ * to an integer and return it. Otherwise, return the default version, 120.
+ */
+static GLuint
+get_glsl_version()
+{
+    const char * s = getenv("INTEL_GLSL_VERSION");
+    if (s == NULL)
+        return 120;
+    else
+        return (GLuint) atoi(s);
+}
+
 /**
  * Initializes potential list of extensions if ctx == NULL, or actually enables
  * extensions for a context.
  */
 void
-intelInitExtensions(GLcontext *ctx)
+intelInitExtensions(struct gl_context *ctx)
 {
    struct intel_context *intel = intel_context(ctx);
 
    driInitExtensions(ctx, card_extensions, GL_FALSE);
 
    _mesa_map_function_array(GL_VERSION_2_1_functions);
-   ctx->Const.GLSLVersion = 120;
+
+   ctx->Const.GLSLVersion = get_glsl_version();
 
    if (intel->gen >= 5)
       driInitExtensions(ctx, ironlake_extensions, GL_FALSE);