From 96f243985802281b3c6f1ca91e996d41ffef49f6 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 29 Jun 2017 10:33:37 -0700 Subject: nir/spirv: Beef up the type system a bit This adds a vtn concept of base_type as well as a couple of other fields. This lets us be a tiny bit more efficient in some cases but, more importantly, it will eventually let us express things the GLSL type system can't. Reviewed-by: Connor Abbott --- src/compiler/spirv/vtn_private.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/compiler/spirv/vtn_private.h') diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 3c048fa327d..48156fac4bd 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -196,12 +196,29 @@ struct vtn_ssa_value { const struct glsl_type *type; }; +enum vtn_base_type { + vtn_base_type_void, + vtn_base_type_scalar, + vtn_base_type_vector, + vtn_base_type_matrix, + vtn_base_type_array, + vtn_base_type_struct, + vtn_base_type_image, + vtn_base_type_sampler, + vtn_base_type_function, +}; + struct vtn_type { + enum vtn_base_type base_type; + const struct glsl_type *type; /* The value that declares this type. Used for finding decorations */ struct vtn_value *val; + /* Specifies the length of complex types. */ + unsigned length; + union { /* Members for scalar, vector, and array-like types */ struct { @@ -245,6 +262,9 @@ struct vtn_type { /* Members for image types */ struct { + /* For images, indicates whether it's sampled or storage */ + bool sampled; + /* Image format for image_load_store type images */ unsigned image_format; -- cgit v1.2.3