[Mesa-dev] [PATCH 2/4] glsl: Move initialize_context() to glsl_parser_extras.cpp so it can be re-used.

Paul Berry stereotype441 at gmail.com
Wed Jul 20 13:39:09 PDT 2011


On 20 July 2011 09:52, Paul Berry <stereotype441 at gmail.com> wrote:
> On 20 July 2011 07:55, Chad Versace <chad at chad-versace.us> wrote:
>>> +   ctx->Const.GLSLVersion = 120;
>>> +
>>> +   /* 1.10 minimums. */
>>> +   ctx->Const.MaxLights = 8;
>>
>> There is conflict here. The GLSL vrsion is 1.20, but the comment says 1.10.
>> The minimum values below are identical for both versions, so I can't determine
>> which is correct---1.10 or 1.20.
>
> Hmm, the function that was the source of this refactor
> (initialize_context in glsl/main.cpp) was even worse--it set the GLSL
> version to 1.30, yet had a comment saying "1.10 minimums".  I will
> need to do more digging to figure out what is correct.  I'll get back
> to you.

Ok, I've figured out what's going on here.  We're initializing a stub
context to be used by the standalone GLSL compiler as it compiles
built-ins, and by the unit testing code as it tests optimization
passes.  The values we plug into ctx->Const... normally tell the GLSL
compiler about the limits of the underlying driver/hardware.  However,
since we are doing a standalone compile, there isn't any driver or
hardware, so it hardly matters what values we plug into these
constants, provided that the built-ins and test cases we are compiling
don't depend on them (and to my knowledge, they don't).

Still, it seems sensible to set the values to the minimum values
guaranteed by GLSL 1.20, since that's the largest version of GLSL that
Mesa currently supports.  The code was already consistent with that
except for the misleading "1.10 minimums" comment (and MaxDrawBuffers,
which we already discussed), so I'll just change the comment to say
"1.20 minimums".


More information about the mesa-dev mailing list