<div dir="ltr">oops, forgot to forward this to the list!<div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Joel Leclerc</b> <span dir="ltr"><<a href="mailto:lkjoel@ubuntu.com">lkjoel@ubuntu.com</a>></span><br>Date: Tue, Sep 23, 2014 at 9:53 AM<br>Subject: Re: [Mesa-users] glGetUniformLocation returns -1 for most uniforms<br>To: Jonas Kulla <<a href="mailto:nyocurio@gmail.com">nyocurio@gmail.com</a>><br><br><br><div dir="ltr">Yes, they are used in the shader.<div><br></div><div>The shader uniforms are used in a general header file included by all shaders, so some of them aren't used in some shaders, but in the shaders that _do_ use them, they still return the same error.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 23, 2014 at 5:42 AM, Jonas Kulla <span dir="ltr"><<a href="mailto:nyocurio@gmail.com" target="_blank">nyocurio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Have you made sure that the uniforms are actually used in the shader? If they're not, the compiler is free to optimize them out and return -1 for their location, as it doesn't change runtime behavior.<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>2014-09-23 5:17 GMT+02:00 Joel Leclerc <span dir="ltr"><<a href="mailto:lkjoel@ubuntu.com" target="_blank">lkjoel@ubuntu.com</a>></span>:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Normally, I use the proprietary nvidia GL driver to test my application, but now that I use the mesa backend, for some reason, glGetUniformLocation returns -1 on certain uniforms (for reasons I can't comprehend).<div><br></div><div>Here is part of my shader source:</div><div><br></div><div><div>uniform mat4 N_MVP;</div><div>uniform bool N_UV_flip;</div><div>uniform float N_UV_z;</div><div>uniform float N_alpha;</div><div>uniform bool N_3D;</div><div>uniform float N_time;</div><div>uniform float N_rand;</div><div><br></div><div>If I run glGetUniformLocation(shader->shader_handle, "N_rand"), it returns -1. same for N_time, and N_UV_z. However, using the same code for N_alpha returns 2.</div><div><br></div><div>This does not happen on the nvidia GL driver.</div><div><br></div><div>Any clues as to why? Source code is available here: <a href="https://github.com/MiJyn/nightmare" target="_blank">https://github.com/MiJyn/nightmare</a> and <a href="https://github.com/MiJyn/silentponyville" target="_blank">https://github.com/MiJyn/silentponyville</a> .</div><span><font color="#888888"><div><br></div>-- <br><div dir="ltr"><font size="4">Joel Leclerc</font><div><font>Individual software and game developer,</font></div><div><font> Lead developer of the SythOS project.</font></div><div><font>Main email: <a href="mailto:lkjoel@ubuntu.com" target="_blank">lkjoel@ubuntu.com</a> | Chat: <a href="mailto:lkjoeldev@gmail.com" target="_blank">lkjoeldev@gmail.com</a></font></div><div><font>Twitter: <a href="https://twitter.com/__MiJyn__" target="_blank">@__MiJyn__</a> | </font><font>Website: </font><a href="http://mijyn.github.io/" target="_blank">http://mijyn.github.io/</a></div><div><font>Github: </font><a href="https://github.com/MiJyn" target="_blank">https://github.com/MiJyn</a><br></div></div>
</font></span></div></div>
<br></div></div>_______________________________________________<br>
mesa-users mailing list<br>
<a href="mailto:mesa-users@lists.freedesktop.org" target="_blank">mesa-users@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-users" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><font size="4">Joel Leclerc</font><div><font>Individual software and game developer,</font></div><div><font> Lead developer of the SythOS project.</font></div><div><font>Main email: <a href="mailto:lkjoel@ubuntu.com" target="_blank">lkjoel@ubuntu.com</a> | Chat: <a href="mailto:lkjoeldev@gmail.com" target="_blank">lkjoeldev@gmail.com</a></font></div><div><font>Twitter: <a href="https://twitter.com/__MiJyn__" target="_blank">@__MiJyn__</a> | </font><font>Website: </font><a href="http://mijyn.github.io/" target="_blank">http://mijyn.github.io/</a></div><div><font>Github: </font><a href="https://github.com/MiJyn" target="_blank">https://github.com/MiJyn</a><br></div></div>
</div>
</div></div></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><font size="4">Joel Leclerc</font><div><font>Individual software and game developer,</font></div><div><font> Lead developer of the SythOS project.</font></div><div><font>Main email: <a href="mailto:lkjoel@ubuntu.com" target="_blank">lkjoel@ubuntu.com</a> | Chat: <a href="mailto:lkjoeldev@gmail.com" target="_blank">lkjoeldev@gmail.com</a></font></div><div><font>Twitter: <a href="https://twitter.com/__MiJyn__" target="_blank">@__MiJyn__</a> | </font><font>Website: </font><a href="http://mijyn.github.io/" target="_blank">http://mijyn.github.io/</a></div><div><font>Github: </font><a href="https://github.com/MiJyn" target="_blank">https://github.com/MiJyn</a><br></div></div>
</div></div>