aubinator: Don't skip the first field in each subgroup
authorJason Ekstrand <jason.ekstrand@intel.com>
Sun, 12 Nov 2017 05:43:46 +0000 (21:43 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 13 Nov 2017 15:37:23 +0000 (07:37 -0800)
The previous iteration algorithm would advance the field pointer right
after we advance the group.  This meant that you would end up with
skipping the first field of the group.  In the common case, where the
only field is a struct (e.g. 3DSTATE_VERTEX_BUFFERS), it would get
skipped entirely.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/common/gen_decoder.c

index d09b6ea32b66926768543a5bc72503721f07b7c7..b3501aec912f54918de4a8779c99e9e738cb567e 100644 (file)
@@ -824,14 +824,15 @@ iter_advance_group(struct gen_field_iterator *iter)
 static bool
 iter_advance_field(struct gen_field_iterator *iter)
 {
-   while (!iter_more_fields(iter)) {
+   if (iter_more_fields(iter)) {
+      iter->field = iter->field->next;
+   } else {
       if (!iter_more_groups(iter))
          return false;
 
       iter_advance_group(iter);
    }
 
-   iter->field = iter->field->next;
    if (iter->field->name)
       strncpy(iter->name, iter->field->name, sizeof(iter->name));
    else