summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/glsl/builtin_functions.cpp')
-rw-r--r--src/compiler/glsl/builtin_functions.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index edd02bb031b..db0dcb6288f 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -528,6 +528,12 @@ barrier_supported(const _mesa_glsl_parse_state *state)
state->stage == MESA_SHADER_TESS_CTRL;
}
+static bool
+vote(const _mesa_glsl_parse_state *state)
+{
+ return state->ARB_shader_group_vote_enable;
+}
+
/** @} */
/******************************************************************************/
@@ -853,6 +859,8 @@ private:
ir_function_signature *_shader_clock(builtin_available_predicate avail,
const glsl_type *type);
+ ir_function_signature *_vote(enum ir_expression_operation opcode);
+
#undef B0
#undef B1
#undef B2
@@ -2935,6 +2943,10 @@ builtin_builder::create_builtins()
glsl_type::uvec2_type),
NULL);
+ add_function("anyInvocationARB", _vote(ir_unop_vote_any), NULL);
+ add_function("allInvocationsARB", _vote(ir_unop_vote_all), NULL);
+ add_function("allInvocationsEqualARB", _vote(ir_unop_vote_eq), NULL);
+
#undef F
#undef FI
#undef FIUD
@@ -5576,6 +5588,16 @@ builtin_builder::_shader_clock(builtin_available_predicate avail,
return sig;
}
+ir_function_signature *
+builtin_builder::_vote(enum ir_expression_operation opcode)
+{
+ ir_variable *value = in_var(glsl_type::bool_type, "value");
+
+ MAKE_SIG(glsl_type::bool_type, vote, 1, value);
+ body.emit(ret(expr(opcode, value)));
+ return sig;
+}
+
/** @} */
/******************************************************************************/