[Mesa-dev] [PATCH] mesa: Allow override of GL version with environment variables

Kenneth Graunke kenneth at whitecape.org
Mon Sep 26 13:14:09 PDT 2011


On 09/26/2011 12:57 PM, Ian Romanick wrote:
> On 09/26/2011 12:05 PM, Chad Versace wrote:
>> It is necessary to manually set the GL version to 3.0 in order to run
>> Piglit tests using glGetUniform*().
>>
>> This patch allows one to override the version of an OpenGL, OpenGL
>> ES1, or
>> OpenGL ES2 context by setting the environment variable MESA_GL_VERSION,
>> MESA_GLES1_VERSION, or MESA_GLES2_VERSION.
>>
>> CC: Paul Berry<stereotype441 at gmail.com>
>> Signed-off-by: Chad Versace<chad at chad-versace.us>
>> ---
>>   src/mesa/main/version.c |   55
>> +++++++++++++++++++++++++++++++++++++++++++++-
>>   1 files changed, 53 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
>> index 80fa0c2..128c3af 100644
>> --- a/src/mesa/main/version.c
>> +++ b/src/mesa/main/version.c
>> @@ -27,7 +27,40 @@
>>   #include "version.h"
>>   #include "git_sha1.h"
>>
>> +/**
>> + * \brief Override GL version
>> + *
>> + */
>> +static void
>> +override_version(struct gl_context *ctx, GLuint *major, GLuint *minor)
>> +{
>> +   const char *env_var;
>> +   const char *version;
>> +   int n;
>> +
>> +   switch (ctx->API) {
>> +   case API_OPENGL:
>> +      env_var = "MESA_GL_VERSION";
>> +      break;
>> +   case API_OPENGLES:
>> +      env_var = "MESA_GLES1_VERSION";
>> +      break;
>> +   case API_OPENGLES2:
>> +      env_var = "MESA_GLES2_VERSION";
>> +      break;
>> +   }
> 
> The GLES2 bits are unnecessary.  There's only OpenGL ES 2.0.  The GLES1
> bits also have dubious merit.  As far as I'm aware, there's only one
> driver (radeon) in Mesa that supports OpenGL ES 1.0 and not 1.1.

Yeah, I'm not so enthused about overriding GLES version numbers, either.
 We might want something for Halti (ES 3) eventually, but I'm not sure
it's this, and I'd rather cross that bridge when we come to it.

--Kenneth


More information about the mesa-dev mailing list