[Mesa-dev] [PATCH v2 05/25] spirv: add DF support to SpvOp*ConstantComposite

Jason Ekstrand jason at jlekstrand.net
Mon Jan 2 18:03:40 UTC 2017


On Fri, Dec 16, 2016 at 6:48 AM, Juan A. Suarez Romero <jasuarez at igalia.com>
wrote:

> From: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
>
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
> ---
>  src/compiler/spirv/spirv_to_nir.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/compiler/spirv/spirv_to_nir.c
> b/src/compiler/spirv/spirv_to_nir.c
> index 3fa1d8e..5303a94 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -1032,6 +1032,8 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp
> opcode,
>        case GLSL_TYPE_INT:
>        case GLSL_TYPE_FLOAT:
>        case GLSL_TYPE_BOOL:
> +      case GLSL_TYPE_DOUBLE: {
> +         int bit_size = glsl_get_bit_size(val->const_type);
>           if (glsl_type_is_matrix(val->const_type)) {
>              assert(glsl_get_matrix_columns(val->const_type) ==
> elem_count);
>              for (unsigned i = 0; i < elem_count; i++)
> @@ -1039,12 +1041,16 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp
> opcode,
>           } else {
>              assert(glsl_type_is_vector(val->const_type));
>              assert(glsl_get_vector_elements(val->const_type) ==
> elem_count);
> -            for (unsigned i = 0; i < elem_count; i++)
> -               val->constant->values[0].u32[i] =
> elems[i]->values[0].u32[0];
> +            for (unsigned i = 0; i < elem_count; i++) {
> +               if (bit_size == 64)
> +                   val->constant->values[0].u64[i] =
> elems[i]->values[0].u64[0];
> +               else
>

Please add braces and assert(bit_size == 32)


> +                  val->constant->values[0].u32[i] =
> elems[i]->values[0].u32[0];
> +            }
>           }
>           ralloc_free(elems);
>           break;
> -
> +      }
>        case GLSL_TYPE_STRUCT:
>        case GLSL_TYPE_ARRAY:
>           ralloc_steal(val->constant, elems);
> --
> 2.9.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/20170102/bf6e81d8/attachment.html>


More information about the mesa-dev mailing list