summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-11-30 12:18:27 -0800
committerMatt Turner <[email protected]>2015-12-18 13:20:13 -0500
commit21cd298aec1c6cb1d6853ccd3de53e45c617fd0a (patch)
treea8acdc9f5faa2cb745a04b88f8a0acb94a9a8918 /src/glsl
parent2268a50ffde18f9907ee7321c8b503b52a23fb05 (diff)
glsl: Implement all(v) as all_equal(v, true).
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/builtin_functions.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 2487a2b1ae5..602852a78d1 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -4392,20 +4392,8 @@ builtin_builder::_all(const glsl_type *type)
ir_variable *v = in_var(type, "v");
MAKE_SIG(glsl_type::bool_type, always_available, 1, v);
- switch (type->vector_elements) {
- case 2:
- body.emit(ret(logic_and(swizzle_x(v), swizzle_y(v))));
- break;
- case 3:
- body.emit(ret(logic_and(logic_and(swizzle_x(v), swizzle_y(v)),
- swizzle_z(v))));
- break;
- case 4:
- body.emit(ret(logic_and(logic_and(logic_and(swizzle_x(v), swizzle_y(v)),
- swizzle_z(v)),
- swizzle_w(v))));
- break;
- }
+ const unsigned vec_elem = v->type->vector_elements;
+ body.emit(ret(expr(ir_binop_all_equal, v, imm(true, vec_elem))));
return sig;
}