<div dir="ltr">No for this particular length, it only needs to account for the 3 chars in "[0]". That suffix is required by spec to be appended (hard-coded string), see the bottom of mesa/src/mesa/main/uniforms.c where the function glGetActiveUniform is (I believe Ian added the code in early 2012).<br>
<div class="gmail_quote"><div class=""><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 30, 2013 at 4:26 AM, Dragomir Ivanov <span dir="ltr"><<a href="mailto:drago.ivanov@gmail.com" target="_blank">drago.ivanov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I don't know OpenGL very much, but can uniforms be more than 10? So you can have "[24]" where you will need +4, not +3. </div>
<div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Sat, Mar 30, 2013 at 3:22 AM, Haixia Shi <span dir="ltr"><<a href="mailto:hshi@chromium.org" target="_blank">hshi@chromium.org</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>If the active uniform is an array, then the length of the uniform name should<br>
include the three extra characters for the "[0]" suffix, which is required by<br>the GL 4.2 spec to be appended to the uniform name in glGetActiveUniform().<br><br>This avoids the situation where the output buffer does not have enough space<br>
to hold the "[0]" suffix, resulting in an incomplete array specification like<br>"foobar[0".<br><br>Change-Id: Icd58cd6a73c9de7bbe5659d757b8009021846019<br>Signed-off-by: Haixia Shi <<a href="mailto:hshi@chromium.org" target="_blank">hshi@chromium.org</a>><br>
Reviewed-by: Stéphane Marchesin <<a href="mailto:marcheu@chromium.org" target="_blank">marcheu@chromium.org</a>><br>---<br> src/mesa/main/shaderapi.c | 5 ++++-<br> 1 file changed, 4 insertions(+), 1 deletion(-)<br><br>
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c<br>index be69467..68767f4 100644<br>--- a/src/mesa/main/shaderapi.c<br>+++ b/src/mesa/main/shaderapi.c<br>@@ -519,8 +519,11 @@ get_programiv(struct gl_context *ctx, GLuint<br>
program, GLenum pname, GLint *param<br><br>       for (i = 0; i < shProg->NumUserUniformStorage; i++) {<br>         /* Add one for the terminating NUL character.<br>+         * However if the uniform is an array, then add three extra characters<br>
+         * for the appended "[0]" suffix, in addition to the terminating NUL.<br>          */<br>-        const GLint len = strlen(shProg->UniformStorage[i].name) + 1;<br>+        const GLint len = strlen(shProg->UniformStorage[i].name) + 1 +<br>
+            ((shProg->UniformStorage[i].array_elements != 0) ? 3 : 0);<br><br>         if (len > max_len)<br>            max_len = len;<br></div><font color="#888888">--<br>1.8.1.3<br>_______________________________________________<br>
mesa-dev mailing list<br><a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></blockquote></div><br></div></blockquote></div><br></div></div></div></div></div>