nir: Expose the packed attribute attached to glsl_type objects
authorBoris Brezillon <boris.brezillon@collabora.com>
Mon, 29 Jun 2020 07:29:09 +0000 (09:29 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 3 Sep 2020 18:02:50 +0000 (18:02 +0000)
This should help code calculating field offsets to get it right when
the structure is marked packed.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472>

src/compiler/nir_types.cpp
src/compiler/nir_types.h

index c7d07415cd200f91c6037c9de937c5dd609d7ead..9b4f9c5b0aacb6d1eba0dde92359ca28e99d2fee 100644 (file)
@@ -860,6 +860,12 @@ glsl_get_explicit_size(const struct glsl_type *type, bool align_to_stride)
    return type->explicit_size(align_to_stride);
 }
 
+bool
+glsl_type_is_packed(const struct glsl_type *type)
+{
+   return type->packed;
+}
+
 bool
 glsl_type_is_leaf(const struct glsl_type *type)
 {
index 8d82f492e02f9f1e91008d6b593cba164664e077..2df1e2c8b9b55d31ff112743dc6544e6ea00e955 100644 (file)
@@ -129,6 +129,7 @@ glsl_get_bit_size(const struct glsl_type *type)
    return glsl_base_type_get_bit_size(glsl_get_base_type(type));
 }
 
+bool glsl_type_is_packed(const struct glsl_type *type);
 bool glsl_type_is_16bit(const struct glsl_type *type);
 bool glsl_type_is_32bit(const struct glsl_type *type);
 bool glsl_type_is_64bit(const struct glsl_type *type);