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

Jason Ekstrand jason at jlekstrand.net
Fri Feb 23 19:10:56 UTC 2018


On Fri, Feb 23, 2018 at 1:26 AM, 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.
> ---
>  src/compiler/spirv/vtn_variables.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_
> variables.c
> index 78adab3ed2..81658afbd9 100644
> --- a/src/compiler/spirv/vtn_variables.c
> +++ b/src/compiler/spirv/vtn_variables.c
> @@ -687,6 +687,10 @@ vtn_type_block_size(struct vtn_builder *b, struct
> vtn_type *type)
>                  base_type == GLSL_TYPE_UINT64 ||
>                  base_type == GLSL_TYPE_INT64) {
>           return glsl_get_vector_elements(type->type) * 8;
> +      } else if (base_type == GLSL_TYPE_FLOAT16 ||
> +                 base_type == GLSL_TYPE_UINT16 ||
> +                 base_type == GLSL_TYPE_INT16){
> +         return glsl_get_vector_elements(type->type) * 2;
>

Let's just drop the whole if statement and use glsl_get_bit_size() instead.


>        } else {
>           return glsl_get_vector_elements(type->type) * 4;
>        }
> --
> 2.14.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180223/6d77c4af/attachment-0001.html>


More information about the mesa-dev mailing list