[Mesa-users] Fwd: glGetUniformLocation returns -1 for most uniforms
Joel Leclerc
lkjoel at ubuntu.com
Sat Sep 27 08:57:18 PDT 2014
oops, forgot to forward this to the list!
---------- Forwarded message ----------
From: Joel Leclerc <lkjoel at ubuntu.com>
Date: Tue, Sep 23, 2014 at 9:53 AM
Subject: Re: [Mesa-users] glGetUniformLocation returns -1 for most uniforms
To: Jonas Kulla <nyocurio at gmail.com>
Yes, they are used in the shader.
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.
On Tue, Sep 23, 2014 at 5:42 AM, Jonas Kulla <nyocurio at gmail.com> wrote:
> 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.
>
> 2014-09-23 5:17 GMT+02:00 Joel Leclerc <lkjoel at ubuntu.com>:
>
>> 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).
>>
>> Here is part of my shader source:
>>
>> uniform mat4 N_MVP;
>> uniform bool N_UV_flip;
>> uniform float N_UV_z;
>> uniform float N_alpha;
>> uniform bool N_3D;
>> uniform float N_time;
>> uniform float N_rand;
>>
>> 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.
>>
>> This does not happen on the nvidia GL driver.
>>
>> Any clues as to why? Source code is available here:
>> https://github.com/MiJyn/nightmare and
>> https://github.com/MiJyn/silentponyville .
>>
>> --
>> Joel Leclerc
>> Individual software and game developer,
>> Lead developer of the SythOS project.
>> Main email: lkjoel at ubuntu.com | Chat: lkjoeldev at gmail.com
>> Twitter: @__MiJyn__ <https://twitter.com/__MiJyn__> | Website:
>> http://mijyn.github.io/
>> Github: https://github.com/MiJyn
>>
>> _______________________________________________
>> mesa-users mailing list
>> mesa-users at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-users
>>
>>
>
--
Joel Leclerc
Individual software and game developer,
Lead developer of the SythOS project.
Main email: lkjoel at ubuntu.com | Chat: lkjoeldev at gmail.com
Twitter: @__MiJyn__ <https://twitter.com/__MiJyn__> | Website:
http://mijyn.github.io/
Github: https://github.com/MiJyn
--
Joel Leclerc
Individual software and game developer,
Lead developer of the SythOS project.
Main email: lkjoel at ubuntu.com | Chat: lkjoeldev at gmail.com
Twitter: @__MiJyn__ <https://twitter.com/__MiJyn__> | Website:
http://mijyn.github.io/
Github: https://github.com/MiJyn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-users/attachments/20140927/fdd1c32f/attachment.html>
More information about the mesa-users
mailing list