summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel/intel_extensions.c
diff options
context:
space:
mode:
authorChad Versace <chad@chad-versace.us>2010-10-07 16:04:30 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-10-11 14:25:30 -0700
commita34817917bd8c408d8f732c24b4eb586f666d6c1 (patch)
tree5ff6ed8269931a9c700a2d3d13fcf03cf5b6ff30 /src/mesa/drivers/dri/intel/intel_extensions.c
parent603741a86df0e43c0b52e8c202a35c7fe2fc1d9c (diff)
intel_extensions: Add ability to set GLSL version via environment
Add ability to set the GLSL version used by the GLcontext by setting the environment variable INTEL_GLSL_VERSION. For example, env INTEL_GLSL_VERSION=130 prog args If the environment variable is missing, the GLSL versions defaults to 120. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_extensions.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 1a32026eb5..8d38a28bb8 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -197,6 +197,22 @@ static const struct dri_extension fragment_shader_extensions[] = {
};
/**
+ * \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.
*/
@@ -208,7 +224,8 @@ intelInitExtensions(GLcontext *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);