On Thu, Feb 11, 2016 at 11:31 AM, Plamena Manolova
<[email protected]> wrote:
> +   struct empty_uniform_block *current_block = NULL;
> +   unsigned prev_location = -1;
> +
> +   for (unsigned i = 0; i < prog->NumUniformRemapTable; i++) {
> +      /* We found empty space in UniformRemapTable. */
> +      if (prog->UniformRemapTable[i] == NULL) {
> +         /* We've found the beginning of new continous block of empty slots 
> */
> +         if ((i == 0) || !current_block || (i != prev_location + 1)) {

You could delete prev_location entirely and transform this into

if (!current_block || current_block->start + current_block->slots != i)

> +            current_block = ralloc(NULL, struct empty_uniform_block);
> +            current_block->start = i;
> +            current_block->slots = 1;

And depending on how clever you want to get, you could change the
above to rzalloc, not touch slots here, and drop the continue. Then
the slots++ will magically increment it to 1. Up to you if you find
this more or less readable though, I don't have a strong preference
either way.

> +            list_addtail(&current_block->link, &prog->EmptyUniformLocations);
> +            prev_location = i;
> +            continue;
> +         }
> +
> +         /* The current block continues, so we simply increment its slots */
> +         current_block->slots++;
> +         prev_location = i;
> +      }
>     }
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to