X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcompiler%2Fnir_types.h;h=851096f9cc0ada4ea06e2e962001b80e7b8dd937;hb=d7cddbd6d66120899ffcb5735ee436f13432ed64;hp=18d64b768d4f967cc7d0e885de2d0e8855ab2d1f;hpb=7410c609882f490e62b86a261df860a56379be96;p=mesa.git diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h index 18d64b768d4..851096f9cc0 100644 --- a/src/compiler/nir_types.h +++ b/src/compiler/nir_types.h @@ -68,6 +68,9 @@ unsigned glsl_get_length(const struct glsl_type *type); unsigned glsl_get_aoa_size(const struct glsl_type *type); +unsigned glsl_count_attribute_slots(const struct glsl_type *type, + bool is_vertex_input); + const char *glsl_get_struct_elem_name(const struct glsl_type *type, unsigned index); @@ -77,6 +80,27 @@ enum glsl_base_type glsl_get_sampler_result_type(const struct glsl_type *type); unsigned glsl_get_record_location_offset(const struct glsl_type *type, unsigned length); +static inline unsigned +glsl_get_bit_size(enum glsl_base_type type) +{ + switch (type) { + case GLSL_TYPE_INT: + case GLSL_TYPE_UINT: + case GLSL_TYPE_BOOL: + case GLSL_TYPE_FLOAT: /* TODO handle mediump */ + case GLSL_TYPE_SUBROUTINE: + return 32; + + case GLSL_TYPE_DOUBLE: + return 64; + + default: + unreachable("unknown base type"); + } + + return 0; +} + bool glsl_type_is_void(const struct glsl_type *type); bool glsl_type_is_error(const struct glsl_type *type); bool glsl_type_is_vector(const struct glsl_type *type);