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 <cwabbott0@gmail.com>
This commit is contained in:
Jason Ekstrand
2017-06-29 10:33:37 -07:00
committed by Jason Ekstrand
parent ad4519696d
commit 96f2439858
2 changed files with 59 additions and 28 deletions

View File

@@ -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;