[Mesa-dev] [PATCH 31/36] glsl: Check for SSBO variable in SSBO atomic lowering

Iago Toral itoral at igalia.com
Mon Nov 16 06:39:49 PST 2015


On Sat, 2015-11-14 at 13:44 -0800, Jordan Justen wrote:
> When an atomic function is called, we need to check to see if it is
> for an SSBO variable before lowering it to the SSBO specific intrinsic
> function.
> 
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> Cc: Iago Toral Quiroga <itoral at igalia.com>
> ---
>  src/glsl/lower_ubo_reference.cpp | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
> index a64e9d7..d083936 100644
> --- a/src/glsl/lower_ubo_reference.cpp
> +++ b/src/glsl/lower_ubo_reference.cpp
> @@ -855,6 +855,20 @@ lower_ubo_reference_visitor::lower_ssbo_atomic_intrinsic(ir_call *ir)
>  ir_call *
>  lower_ubo_reference_visitor::check_for_ssbo_atomic_intrinsic(ir_call *ir)
>  {
> +   exec_list& params = ir->actual_parameters;
> +
> +   if (params.length() < 2)
> +      return ir;
> +
> +   ir_rvalue *rvalue =
> +      ((ir_instruction *) params.get_head())->as_rvalue();
> +   if (!rvalue)
> +      return ir;
> +
> +   ir_variable *var = rvalue->variable_referenced();
> +   if (!var || !var->is_in_buffer_block())

The above should be:

if (!var || !var->is_in_shader_storage_block())

With that change,
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

> +      return ir;
> +
>     const char *callee = ir->callee_name();
>     if (!strcmp("__intrinsic_atomic_add", callee) ||
>         !strcmp("__intrinsic_atomic_min", callee) ||




More information about the mesa-dev mailing list