From 3be890a3a6844292177b5524bd94b6c88fb5fb6e Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 29 Jun 2020 09:29:09 +0200 Subject: [PATCH] nir: Expose the packed attribute attached to glsl_type objects This should help code calculating field offsets to get it right when the structure is marked packed. Signed-off-by: Boris Brezillon Reviewed-by: Karol Herbst Reviewed-by: Jason Ekstrand Reviewed-by: Jesse Natalie Part-of: --- src/compiler/nir_types.cpp | 6 ++++++ src/compiler/nir_types.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index c7d07415cd2..9b4f9c5b0aa 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -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) { diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h index 8d82f492e02..2df1e2c8b9b 100644 --- a/src/compiler/nir_types.h +++ b/src/compiler/nir_types.h @@ -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); -- 2.30.2