[Mesa-dev] [PATCH 5/7] spirv: Calculate properly 16-bit vector sizes (v2)

Jason Ekstrand jason at jlekstrand.net
Fri Feb 23 21:36:05 UTC 2018


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Fri, Feb 23, 2018 at 1:30 PM, Jose Maria Casanova Crespo <
jmcasanova at igalia.com> wrote:

> Range in 16-bit push constants load was being calculated
> wrongly using 4-bytes per element instead of 2-bytes as it
> should be.
>
> v2: Use glsl_get_bit_size instead of if statement
>     (Jason Ekstrand)
> ---
>  src/compiler/spirv/vtn_variables.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_
> variables.c
> index 78adab3ed2..e68551a336 100644
> --- a/src/compiler/spirv/vtn_variables.c
> +++ b/src/compiler/spirv/vtn_variables.c
> @@ -683,12 +683,9 @@ vtn_type_block_size(struct vtn_builder *b, struct
> vtn_type *type)
>        if (cols > 1) {
>           vtn_assert(type->stride > 0);
>           return type->stride * cols;
> -      } else if (base_type == GLSL_TYPE_DOUBLE ||
> -                base_type == GLSL_TYPE_UINT64 ||
> -                base_type == GLSL_TYPE_INT64) {
> -         return glsl_get_vector_elements(type->type) * 8;
>        } else {
> -         return glsl_get_vector_elements(type->type) * 4;
> +         unsigned type_size = glsl_get_bit_size(type->type) / 8;
> +         return glsl_get_vector_elements(type->type) * type_size;
>        }
>     }
>
> --
> 2.16.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180223/cbe81af9/attachment.html>


More information about the mesa-dev mailing list