[Mesa-dev] [PATCH] compiler/glsl: Fix uniform location counting.

Ilia Mirkin imirkin at alum.mit.edu
Wed Feb 17 12:35:26 UTC 2016


On Wed, Feb 17, 2016 at 6:29 AM, Manolova, Plamena
<plamena.manolova at intel.com> wrote:
>>> > +   if (entries_total > 0)
>>> > +      entries_total -= 1;
>>>
>>> This seems weird... why are you doing that?
>
>
> According to the spec:
> https://www.opengl.org/registry/specs/ARB/explicit_uniform_location.txt:
> "The explicitly defined locations
>     and the generated locations must be in the range of 0 to
> MAX_UNIFORM_LOCATIONS minus one.", which means that the uniforms must fit
> between array slots 0 - 98303, however if we use total_entries without
> subtracting 1 we will be comparing to the range 1 - 98304 which will trigger
> an error.

But that's just a question of changing a >= into a > right? As it is,
you're saying that entries_total == 0 and entries_total == 1 are the
same thing (by subtracting 1). This is very odd.

  -ilia


More information about the mesa-dev mailing list