On 03/19/2015 09:26 AM, Matt Turner wrote:
On Thu, Mar 19, 2015 at 7:53 AM, Brian Paul <bri...@vmware.com> wrote:
src[i] is a union.  Just check if src[i].u is non-zero to choose
between ctx->Const.UniformBooleanTrue and zero.
---
  src/mesa/main/uniform_query.cpp | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 2ab5528..9ce45ee 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -785,11 +785,7 @@ _mesa_uniform(struct gl_context *ctx, struct 
gl_shader_program *shProg,
        const unsigned elems = components * count;

        for (unsigned i = 0; i < elems; i++) {
-        if (basicType == GLSL_TYPE_FLOAT) {
-            dst[i].i = src[i].f != 0.0f ? ctx->Const.UniformBooleanTrue : 0;

I guess this also handles -0.0f as well, which isn't 0u. I'm not sure
if that's desired behavior or not?

Good question. But it seems a little far-fetched that a real app would rely on glUniform1f(loc, -0.0) to set a boolean to false.

I don't see any spec language about this case.

What do you think?

-Brian


-        } else {
-            dst[i].i = src[i].i != 0    ? ctx->Const.UniformBooleanTrue : 0;
-        }
+         dst[i].i = src[i].u ? ctx->Const.UniformBooleanTrue : 0;
        }
     }

--
1.9.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to