From: Chris Forbes
[jordan.l.jus...@intel.com: Add CS support]
Signed-off-by: Jordan Justen
Reviewed-by: Ben Widawsky
---
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 524b8d6..778470d 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
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev