[Mesa-dev] [PATCH 1/4] spirv: Make sampled images a real type

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Dec 11 12:10:47 UTC 2017


Series is,

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

Sam

On 08/12/17 08:42, Jason Ekstrand wrote:
> Previously, we just gave them exactly the same type as the respective
> image (which already had a sampler2D or similar type).  Now they have
> their own base type and a pointer to the vtn_type for the image.
> ---
>  src/compiler/spirv/spirv_to_nir.c | 5 ++++-
>  src/compiler/spirv/vtn_private.h  | 7 +++++++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
> index d321d1a..186e273 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -511,6 +511,7 @@ vtn_type_copy(struct vtn_builder *b, struct vtn_type *src)
>     case vtn_base_type_pointer:
>     case vtn_base_type_image:
>     case vtn_base_type_sampler:
> +   case vtn_base_type_sampled_image:
>        /* Nothing more to do */
>        break;
>  
> @@ -1116,7 +1117,9 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
>     }
>  
>     case SpvOpTypeSampledImage:
> -      val->type = vtn_value(b, w[2], vtn_value_type_type)->type;
> +      val->type->base_type = vtn_base_type_sampled_image;
> +      val->type->image = vtn_value(b, w[2], vtn_value_type_type)->type;
> +      val->type->type = val->type->image->type;
>        break;
>  
>     case SpvOpTypeSampler:
> diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
> index 5f140b4..acd2cc7 100644
> --- a/src/compiler/spirv/vtn_private.h
> +++ b/src/compiler/spirv/vtn_private.h
> @@ -265,6 +265,7 @@ enum vtn_base_type {
>     vtn_base_type_pointer,
>     vtn_base_type_image,
>     vtn_base_type_sampler,
> +   vtn_base_type_sampled_image,
>     vtn_base_type_function,
>  };
>  
> @@ -347,6 +348,12 @@ struct vtn_type {
>           SpvAccessQualifier access_qualifier;
>        };
>  
> +      /* Members for sampled image types */
> +      struct {
> +         /* For sampled images, the image type */
> +         struct vtn_type *image;
> +      };
> +
>        /* Members for function types */
>        struct {
>           /* For functions, the vtn_type for each parameter */
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171211/17090941/attachment.sig>


More information about the mesa-dev mailing list