[Mesa-dev] [PATCH 01/18] glsl: Take advantage of the layout qualifier flags union to clean up parsing.

Eric Anholt eric at anholt.net
Thu Jul 5 12:27:47 PDT 2012


Ian Romanick <idr at freedesktop.org> writes:

> On 07/02/2012 05:38 PM, Eric Anholt wrote:
>> The got_one variable was set iff one of the bits in flags.i was set.
>> ---
>>   src/glsl/glsl_parser.yy |   31 ++++++-------------------------
>>   1 file changed, 6 insertions(+), 25 deletions(-)
>>
>> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
>> index 5ca8740..e688b48 100644
>> --- a/src/glsl/glsl_parser.yy
>> +++ b/src/glsl/glsl_parser.yy
>> @@ -1119,21 +1119,17 @@ layout_qualifier_id_list:
>>   layout_qualifier_id:
>>   	any_identifier
>>   	{
>> -	   bool got_one = false;
>> -
>>   	   memset(&  $$, 0, sizeof($$));
>>
>>   	   /* Layout qualifiers for ARB_fragment_coord_conventions. */
>> -	   if (!got_one&&  state->ARB_fragment_coord_conventions_enable) {
>> +	   if (!$$.flags.i&&  state->ARB_fragment_coord_conventions_enable) {
>>   	      if (strcmp($1, "origin_upper_left") == 0) {
>> -		 got_one = true;
>>   		 $$.flags.q.origin_upper_left = 1;
>>   	      } else if (strcmp($1, "pixel_center_integer") == 0) {
>> -		 got_one = true;
>>   		 $$.flags.q.pixel_center_integer = 1;
>>   	      }
>>
>> -	      if (got_one&&  state->ARB_fragment_coord_conventions_warn) {
>> +	      if ($$.flags.i&&  state->ARB_fragment_coord_conventions_warn) {
>>   		 _mesa_glsl_warning(&  @1, state,
>>   				    "GL_ARB_fragment_coord_conventions layout "
>>   				    "identifier `%s' used\n", $1);
>> @@ -1141,36 +1137,27 @@ layout_qualifier_id:
>>   	   }
>>
>>   	   /* Layout qualifiers for AMD/ARB_conservative_depth. */
>> -	   if (!got_one&&
>> +	   if (!$$.flags.i&&
>>   	(state->AMD_conservative_depth_enable ||
>>   	        state->ARB_conservative_depth_enable)) {
>>   	      if (strcmp($1, "depth_any") == 0) {
>> -	         got_one = true;
>>   	         $$.flags.q.depth_any = 1;
>>   	      } else if (strcmp($1, "depth_greater") == 0) {
>> -	         got_one = true;
>>   	         $$.flags.q.depth_greater = 1;
>>   	      } else if (strcmp($1, "depth_less") == 0) {
>> -	         got_one = true;
>>   	         $$.flags.q.depth_less = 1;
>>   	      } else if (strcmp($1, "depth_unchanged") == 0) {
>> -	         got_one = true;
>>   	         $$.flags.q.depth_unchanged = 1;
>>   	      }
>>   	
>> -	      if (got_one&&  state->AMD_conservative_depth_warn) {
>> +	      if ($$.flags.i&&  state->AMD_conservative_depth_warn) {
>>   	         _mesa_glsl_warning(&  @1, state,
>>   	                            "GL_AMD_conservative_depth "
>>   	                            "layout qualifier `%s' is used\n", $1);
>>   	      }
>> -	      if (got_one&&  state->ARB_conservative_depth_warn) {
>> -	         _mesa_glsl_warning(&  @1, state,
>> -	                            "GL_ARB_conservative_depth "
>> -	                            "layout qualifier `%s' is used\n", $1);
>> -	      }
>
> Did you mean for this entire hunk to go?  It seems like it should get 
> the same treatment as the previous block.

It looks like I incorrectly read these as duplicated blocks and deleted
one without mentioning it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120705/cddc62e3/attachment.pgp>


More information about the mesa-dev mailing list