From: Chris Forbes <[email protected]>
[[email protected]: Add CS support]
Signed-off-by: Jordan Justen <[email protected]>
---
src/glsl/builtin_functions.cpp | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index c607572..a851cf1 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -99,6 +99,18 @@ gs_only(const _mesa_glsl_parse_state *state)
}
static bool
+tcs_only(const _mesa_glsl_parse_state *state)
+{
+ return false; /* TODO: state->stage == MESA_SHADER_TESS_CTRL; */
+}
+
+static bool
+cs_only(const _mesa_glsl_parse_state *state)
+{
+ return state->stage == MESA_SHADER_COMPUTE;
+}
+
+static bool
v110(const _mesa_glsl_parse_state *state)
{
return !state->es_shader;
@@ -387,6 +399,12 @@ fp64(const _mesa_glsl_parse_state *state)
return state->has_double();
}
+static bool
+barrier_supported(const _mesa_glsl_parse_state *state)
+{
+ return tcs_only(state) || cs_only(state);
+}
+
/** @} */
/******************************************************************************/
@@ -631,6 +649,7 @@ private:
const glsl_type *stream_type);
ir_function_signature *_EndStreamPrimitive(builtin_available_predicate
avail,
const glsl_type *stream_type);
+ B0(barrier)
B2(textureQueryLod);
B1(textureQueryLevels);
@@ -1910,6 +1929,7 @@ builtin_builder::create_builtins()
_EndStreamPrimitive(gs_streams, glsl_type::uint_type),
_EndStreamPrimitive(gs_streams, glsl_type::int_type),
NULL);
+ add_function("barrier", _barrier(), NULL);
add_function("textureQueryLOD",
_textureQueryLod(glsl_type::sampler1D_type,
glsl_type::float_type),
@@ -4262,6 +4282,15 @@
builtin_builder::_EndStreamPrimitive(builtin_available_predicate avail,
}
ir_function_signature *
+builtin_builder::_barrier()
+{
+ MAKE_SIG(glsl_type::void_type, barrier_supported, 0);
+
+ body.emit(new(mem_ctx) ir_barrier());
+ return sig;
+}
+
+ir_function_signature *
builtin_builder::_textureQueryLod(const glsl_type *sampler_type,
const glsl_type *coord_type)
{
--
2.1.4
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev