summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-05-29 10:49:03 -0400
committerIlia Mirkin <[email protected]>2016-06-06 20:48:46 -0400
commit5189f0243a3dd8698c645bbe762b8a1a3caaf1a9 (patch)
tree52424a33a94512e4845b9557d6a9e215eab302af /src/compiler/glsl/builtin_functions.cpp
parent13b859de044d0f970fcafd4bbb643a307c6ab4eb (diff)
mesa: hook up core bits of GL_ARB_shader_group_vote
Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
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;
+}
+
/** @} */
/******************************************************************************/