[Mesa-dev] [PATCH 3/3] glsl: Update builtin variables for GLSL 1.40.

Kenneth Graunke kenneth at whitecape.org
Mon Mar 12 11:23:31 PDT 2012


On 03/12/2012 09:50 AM, Eric Anholt wrote:
> On Sun, 11 Mar 2012 23:59:35 -0700, Kenneth Graunke<kenneth at whitecape.org>  wrote:
>> On 03/09/2012 01:27 PM, Eric Anholt wrote:
>>> Mostly this is a matter of removing variables that have been moved to
>>> the compatibility profile.  There's one addition: gl_InstanceID is
>>> present in the core now.
>>>
>>> This fixes the new piglit tests for GLSL 1.40 builtins.
>>>
>>> -   add_builtin_constant(instructions, symtab, "gl_MaxLights",
>>> -			state->Const.MaxLights);
>>> -   add_builtin_constant(instructions, symtab, "gl_MaxClipPlanes",
>>> -			state->Const.MaxClipPlanes);
>>> -   add_builtin_constant(instructions, symtab, "gl_MaxTextureUnits",
>>> -			state->Const.MaxTextureUnits);
>>> -   add_builtin_constant(instructions, symtab, "gl_MaxTextureCoords",
>>> -			state->Const.MaxTextureCoords);
>>> +   if (add_deprecated) {
>>> +      add_builtin_constant(instructions, symtab, "gl_MaxLights",
>>> +			   state->Const.MaxLights);
>>
>> I can't find gl_MaxLights defined in 1.30 or 1.40.  I agree that it
>> makes sense to drop it as it pertains to fixed-function lighting.
>
> I'm pretty sure it was an unintentional omission (should have been
> present under ARB_compat) in 1.30, given that it existed in 1.20 and the
> 1.30 spec still defines some of the ARB_compatibility variables in terms
> of it.
>
>>> +      add_builtin_constant(instructions, symtab, "gl_MaxClipPlanes",
>>> +			   state->Const.MaxClipPlanes);
>>> +      add_builtin_constant(instructions, symtab, "gl_MaxTextureUnits",
>>> +			   state->Const.MaxTextureUnits);
>>
>> gl_MaxTextureUnits is not deprecated.  (See GLSL 1.40.08 section 7.4.
>> Note the lack of "// Deprecated" comment.)
>
> I think gl_MaxTextureUnits is a special case -- Here's what I wrote in
> the compiler test to check that it's not present:
>
> 	/* This value (number of fixed function texture environment
> 	 * units) was erroneously left in the core profile on release
> 	 * of GLSL 1.40, similar to the typo of increasing the minimum
> 	 * from 2 to 16 in GLSL 1.30.  In GLSL 1.50, a later
> 	 * clarification moved it to to the compatibility profile, but
> 	 * that was never backported to 1.40.
> 	 */

Yes, that makes sense.  Spec bug.  Without any changes:

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list