diff options
author | Ian Romanick <[email protected]> | 2016-09-02 08:54:48 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2017-01-20 15:41:23 -0800 |
commit | 0d14fec345025567546979160217bb5278836132 (patch) | |
tree | f9d8d02991e128da80b431697e8eea2b7d75270b /src | |
parent | bfc4080d38090e48253cc89ee09afbb602997114 (diff) |
glsl: Add interaction between ARB_gpu_shader_int64 and ARB_shader_clock
If ARB_gpu_shader_int64 is supported, ARB_shader_clock also adds
clockARB() that returns a uint64_t. Rather than add new opcodes and
intrinsics for this, just wrap the existing intrinsic with a
packUint2x32.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/builtin_functions.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index 1044de72dc1..0749ba1d448 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -471,6 +471,13 @@ shader_clock(const _mesa_glsl_parse_state *state) } static bool +shader_clock_int64(const _mesa_glsl_parse_state *state) +{ + return state->ARB_shader_clock_enable && + state->ARB_gpu_shader_int64_enable; +} + +static bool shader_storage_buffer_object(const _mesa_glsl_parse_state *state) { return state->has_shader_storage_buffer_objects(); @@ -3077,6 +3084,11 @@ builtin_builder::create_builtins() glsl_type::uvec2_type), NULL); + add_function("clockARB", + _shader_clock(shader_clock_int64, + glsl_type::uint64_t_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); @@ -5858,7 +5870,13 @@ builtin_builder::_shader_clock(builtin_available_predicate avail, body.emit(call(shader->symbols->get_function("__intrinsic_shader_clock"), retval, sig->parameters)); - body.emit(ret(retval)); + + if (type == glsl_type::uint64_t_type) { + body.emit(ret(expr(ir_unop_pack_uint_2x32, retval))); + } else { + body.emit(ret(retval)); + } + return sig; } |