[Mesa-dev] [PATCH] glsl: fix shader_storage_blocks_write_access for SSBO block arrays

Timothy Arceri tarceri at itsqueeze.com
Tue Apr 9 01:54:27 UTC 2019


Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 9/4/19 7:21 am, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> CTS: GL45-CTS.compute_shader.resources-max
> 
> Fixes: 4e1e8f684bf "glsl: remember which SSBOs are not read-only and pass it to gallium"
> ---
>   src/compiler/glsl/link_uniforms.cpp | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
> index ef124111991..bbd71593948 100644
> --- a/src/compiler/glsl/link_uniforms.cpp
> +++ b/src/compiler/glsl/link_uniforms.cpp
> @@ -537,22 +537,26 @@ public:
>               for (unsigned i = 0; i < num_blks; i++) {
>                  if (strcmp(var->get_interface_type()->name, blks[i].Name) == 0) {
>                     buffer_block_index = i;
>                     break;
>                  }
>               }
>            }
>            assert(buffer_block_index != -1);
>   
>            if (var->is_in_shader_storage_block() &&
> -             !var->data.memory_read_only)
> -            shader_storage_blocks_write_access |= 1 << buffer_block_index;
> +             !var->data.memory_read_only) {
> +            shader_storage_blocks_write_access |=
> +               u_bit_consecutive(buffer_block_index,
> +                                 var->type->is_array() ?
> +                                    var->type->array_size() : 1);
> +         }
>   
>            /* Uniform blocks that were specified with an instance name must be
>             * handled a little bit differently.  The name of the variable is the
>             * name used to reference the uniform block instead of being the name
>             * of a variable within the block.  Therefore, searching for the name
>             * within the block will fail.
>             */
>            if (var->is_interface_instance()) {
>               ubo_byte_offset = 0;
>               process(var->get_interface_type(),
> 


More information about the mesa-dev mailing list