[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 09:52:13 PDT 2011

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.

>> +   ctx->Const.MaxDrawBuffers = 2;
>                 ^^^^^^^^^^^^^^^^^^^
> For GLSL 1.10 and 1.20, the minimum gl_MaxDrawBuffers is 1.
> Is there a reason why you chose 2? If so, it should be
> documented why you deviated from the minimum value.

No reason other than an oversight.  The function that was the source
of the refactor overrode the 1.10 minimums in a few cases, for reasons
that were not always documented.  I tried to make my new function set
everything to the correct minimums, and have the code in glsl/main.cpp
override just the ones that it needed to override, but it looks like I
missed MaxDrawBuffers.  I'll fix it so that initialize_context sets
the correct minimum and glsl/main.cpp overrides it.

More information about the mesa-dev mailing list