From 65b542a7ccbbf59c1e1000f677c799a660b5183e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Thu, 30 Mar 2017 08:55:05 +0200 Subject: [PATCH] st/mesa: implement ARB_shader_clock MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Samuel Pitoiset Reviewed-by: Marek Olšák --- src/mesa/state_tracker/st_extensions.c | 1 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 16f86856a34..a48c22e82e7 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -599,6 +599,7 @@ void st_init_extensions(struct pipe_screen *screen, { o(ARB_robust_buffer_access_behavior), PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR }, { o(ARB_sample_shading), PIPE_CAP_SAMPLE_SHADING }, { o(ARB_seamless_cube_map), PIPE_CAP_SEAMLESS_CUBE_MAP }, + { o(ARB_shader_clock), PIPE_CAP_TGSI_CLOCK }, { o(ARB_shader_draw_parameters), PIPE_CAP_DRAW_PARAMETERS }, { o(ARB_shader_group_vote), PIPE_CAP_TGSI_VOTE }, { o(ARB_shader_stencil_export), PIPE_CAP_SHADER_STENCIL_EXPORT }, diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 31c14ed9ec7..369dff77075 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3963,6 +3963,16 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) visit_image_intrinsic(ir); return; + case ir_intrinsic_shader_clock: { + ir->return_deref->accept(this); + + st_dst_reg dst = st_dst_reg(this->result); + dst.writemask = TGSI_WRITEMASK_XY; + + emit_asm(ir, TGSI_OPCODE_CLOCK, dst); + return; + } + case ir_intrinsic_invalid: case ir_intrinsic_generic_load: case ir_intrinsic_generic_store: @@ -3974,7 +3984,6 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) case ir_intrinsic_generic_atomic_max: case ir_intrinsic_generic_atomic_exchange: case ir_intrinsic_generic_atomic_comp_swap: - case ir_intrinsic_shader_clock: unreachable("Invalid intrinsic"); } } -- 2.30.2