[Mesa-dev] [PATCH 2/2] mesa: simplify code setting boolean uniforms
Brian Paul
brianp at vmware.com
Thu Mar 19 07:53:37 PDT 2015
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;
- } 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
More information about the mesa-dev
mailing list