<p dir="ltr"><br>
On Jan 16, 2016 9:15 PM, "Timothy Arceri" <<a href="mailto:timothy.arceri@collabora.com">timothy.arceri@collabora.com</a>> wrote:<br>
><br>
> From Section 7.9 (SUBROUTINE UNIFORM VARIABLES) of the OpenGL<br>
> 4.5 Core spec:<br>
><br>
> "The command<br>
><br>
> void UniformSubroutinesuiv(enum shadertype, sizei count,<br>
> const uint *indices);<br>
><br>
> will load all active subroutine uniforms for shader stage<br>
> shadertype with subroutine indices from indices, storing<br>
> indices[i] into the uniform at location i. The indices for<br>
> any locations between zero and the value of<br>
> ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS minus one which are not<br>
> used will be ignored."<br>
><br>
> Cc: "11.0 11.1" <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a><br>
> <a href="https://bugs.freedesktop.org/show_bug.cgi?id=93731">https://bugs.freedesktop.org/show_bug.cgi?id=93731</a><br>
> ---<br>
> src/mesa/main/shaderapi.c | 14 ++++++++++++++<br>
> 1 file changed, 14 insertions(+)<br>
><br>
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c<br>
> index cdc85f3..918c5f9 100644<br>
> --- a/src/mesa/main/shaderapi.c<br>
> +++ b/src/mesa/main/shaderapi.c<br>
> @@ -2530,6 +2530,13 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,<br>
> i = 0;<br>
> do {<br>
> struct gl_uniform_storage *uni = sh->SubroutineUniformRemapTable[i];<br>
> + if (uni == NULL) {<br>
> + if (++i < count)<br>
> + continue;<br>
> + else<br>
> + break;</p>
<p dir="ltr">Just</p>
<p dir="ltr">i++;<br>
continue;</p>
<p dir="ltr">Will do the same thing and without repeating the looping condition or making the user think about pre- vs. post-increment. I guess it does make them think about continues in a do-while, but you can't win everything. :-)</p>
<p dir="ltr">> + }<br>
> +<br>
> int uni_count = uni->array_elements ? uni->array_elements : 1;<br>
> int j, k;<br>
><br>
> @@ -2557,6 +2564,13 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,<br>
> i = 0;<br>
> do {<br>
> struct gl_uniform_storage *uni = sh->SubroutineUniformRemapTable[i];<br>
> + if (uni == NULL) {<br>
> + if (++i < count)<br>
> + continue;<br>
> + else<br>
> + break;<br>
> + }<br>
> +<br>
> int uni_count = uni->array_elements ? uni->array_elements : 1;<br>
><br>
> memcpy(&uni->storage[0], &indices[i],<br>
> --<br>
> 2.4.3<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>