[Mesa-dev] [PATCH 4/6] st/mesa: implement ARB_shader_clock

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Mar 30 09:41:56 UTC 2017



On 03/30/2017 09:38 AM, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
>  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 16f8685..a48c22e 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -592,20 +592,21 @@ void st_init_extensions(struct pipe_screen *screen,
>        { o(ARB_indirect_parameters),          PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS       },
>        { o(ARB_instanced_arrays),             PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR  },
>        { o(ARB_occlusion_query),              PIPE_CAP_OCCLUSION_QUERY                  },
>        { o(ARB_occlusion_query2),             PIPE_CAP_OCCLUSION_QUERY                  },
>        { o(ARB_pipeline_statistics_query),    PIPE_CAP_QUERY_PIPELINE_STATISTICS        },
>        { o(ARB_point_sprite),                 PIPE_CAP_POINT_SPRITE                     },
>        { o(ARB_query_buffer_object),          PIPE_CAP_QUERY_BUFFER_OBJECT              },
>        { 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            },
>        { o(ARB_shader_texture_image_samples), PIPE_CAP_TGSI_TXQS                        },
>        { o(ARB_shader_texture_lod),           PIPE_CAP_SM3                              },
>        { o(ARB_shadow),                       PIPE_CAP_TEXTURE_SHADOW_MAP               },
>        { o(ARB_texture_buffer_object),        PIPE_CAP_TEXTURE_BUFFER_OBJECTS           },
>        { o(ARB_texture_cube_map_array),       PIPE_CAP_CUBE_MAP_ARRAY                   },
>        { o(ARB_texture_gather),               PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS    },
>        { o(ARB_texture_mirror_clamp_to_edge), PIPE_CAP_TEXTURE_MIRROR_CLAMP             },
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 63de74a..6e3bccd 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -3988,32 +3988,41 @@ glsl_to_tgsi_visitor::visit(ir_call *ir)
>     case ir_intrinsic_image_atomic_and:
>     case ir_intrinsic_image_atomic_or:
>     case ir_intrinsic_image_atomic_xor:
>     case ir_intrinsic_image_atomic_exchange:
>     case ir_intrinsic_image_atomic_comp_swap:
>     case ir_intrinsic_image_size:
>     case ir_intrinsic_image_samples:
>        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;
> +   }

Maybe add visit_clock_intrinsic() for consistency? Although, there is 
only one intrinsic for that. Your call.

> +
>     case ir_intrinsic_invalid:
>     case ir_intrinsic_generic_load:
>     case ir_intrinsic_generic_store:
>     case ir_intrinsic_generic_atomic_add:
>     case ir_intrinsic_generic_atomic_and:
>     case ir_intrinsic_generic_atomic_or:
>     case ir_intrinsic_generic_atomic_xor:
>     case ir_intrinsic_generic_atomic_min:
>     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");
>     }
>  }
>
>  void
>  glsl_to_tgsi_visitor::calc_deref_offsets(ir_dereference *tail,
>                                           unsigned *array_elements,
>                                           uint16_t *index,
>                                           st_src_reg *indirect,
>                                           unsigned *location)
>


More information about the mesa-dev mailing list