summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-03 15:45:04 -0800
committerJason Ekstrand <[email protected]>2015-11-03 15:45:04 -0800
commitb00e3f221b3f6dd0e87697c53331fd033b6e8676 (patch)
treea59dfeca8fd404c65da59a663e0abda301e893a2 /src/glsl/builtin_functions.cpp
parenta1e7b8701a4687f29b013364a852aa773c80f960 (diff)
parent5d4b019d2a6d4deb4db11780618515cf1fa8a4fc (diff)
Merge remote-tracking branch 'mesa-public/master' into vulkan
Diffstat (limited to 'src/glsl/builtin_functions.cpp')
-rw-r--r--src/glsl/builtin_functions.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index aae25f893e8..509a57b8813 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -401,6 +401,12 @@ shader_atomic_counters(const _mesa_glsl_parse_state *state)
}
static bool
+shader_clock(const _mesa_glsl_parse_state *state)
+{
+ return state->ARB_shader_clock_enable;
+}
+
+static bool
shader_storage_buffer_object(const _mesa_glsl_parse_state *state)
{
return state->has_shader_storage_buffer_objects();
@@ -782,6 +788,11 @@ private:
ir_function_signature *_memory_barrier(
builtin_available_predicate avail);
+ ir_function_signature *_shader_clock_intrinsic(builtin_available_predicate avail,
+ const glsl_type *type);
+ ir_function_signature *_shader_clock(builtin_available_predicate avail,
+ const glsl_type *type);
+
#undef B0
#undef B1
#undef B2
@@ -952,6 +963,11 @@ builtin_builder::create_intrinsics()
add_function("__intrinsic_memory_barrier",
_memory_barrier_intrinsic(shader_image_load_store),
NULL);
+
+ add_function("__intrinsic_shader_clock",
+ _shader_clock_intrinsic(shader_clock,
+ glsl_type::uvec2_type),
+ NULL);
}
/**
@@ -2741,6 +2757,11 @@ builtin_builder::create_builtins()
_memory_barrier(shader_image_load_store),
NULL);
+ add_function("clock2x32ARB",
+ _shader_clock(shader_clock,
+ glsl_type::uvec2_type),
+ NULL);
+
#undef F
#undef FI
#undef FIUD
@@ -5251,6 +5272,28 @@ builtin_builder::_memory_barrier(builtin_available_predicate avail)
return sig;
}
+ir_function_signature *
+builtin_builder::_shader_clock_intrinsic(builtin_available_predicate avail,
+ const glsl_type *type)
+{
+ MAKE_INTRINSIC(type, avail, 0);
+ return sig;
+}
+
+ir_function_signature *
+builtin_builder::_shader_clock(builtin_available_predicate avail,
+ const glsl_type *type)
+{
+ MAKE_SIG(type, avail, 0);
+
+ ir_variable *retval = body.make_temp(type, "clock_retval");
+
+ body.emit(call(shader->symbols->get_function("__intrinsic_shader_clock"),
+ retval, sig->parameters));
+ body.emit(ret(retval));
+ return sig;
+}
+
/** @} */
/******************************************************************************/