X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglsl%2Fnir%2Fnir_types.cpp;h=01f0e9b5abcc6a17bdd7fd47423a8349609f1175;hb=fc2a66cfcddea34af0e93dd2221ae1fd3fdd9e87;hp=a6d35fe617967715b357d5d3773a679ead799935;hpb=67af6c59f22cf5a223e539faa4215e7722bda75c;p=mesa.git diff --git a/src/glsl/nir/nir_types.cpp b/src/glsl/nir/nir_types.cpp index a6d35fe6179..01f0e9b5abc 100644 --- a/src/glsl/nir/nir_types.cpp +++ b/src/glsl/nir/nir_types.cpp @@ -124,6 +124,27 @@ glsl_get_struct_elem_name(const struct glsl_type *type, unsigned index) return type->fields.structure[index].name; } +glsl_sampler_dim +glsl_get_sampler_dim(const struct glsl_type *type) +{ + assert(glsl_type_is_sampler(type)); + return (glsl_sampler_dim)type->sampler_dimensionality; +} + +glsl_base_type +glsl_get_sampler_result_type(const struct glsl_type *type) +{ + assert(glsl_type_is_sampler(type)); + return (glsl_base_type)type->sampler_type; +} + +unsigned +glsl_get_record_location_offset(const struct glsl_type *type, + unsigned length) +{ + return type->record_location_offset(length); +} + bool glsl_type_is_void(const glsl_type *type) { @@ -154,6 +175,38 @@ glsl_type_is_matrix(const struct glsl_type *type) return type->is_matrix(); } +bool +glsl_type_is_array(const struct glsl_type *type) +{ + return type->is_array(); +} + +bool +glsl_type_is_struct(const struct glsl_type *type) +{ + return type->is_record() || type->is_interface(); +} + +bool +glsl_type_is_sampler(const struct glsl_type *type) +{ + return type->is_sampler(); +} + +bool +glsl_sampler_type_is_shadow(const struct glsl_type *type) +{ + assert(glsl_type_is_sampler(type)); + return type->sampler_shadow; +} + +bool +glsl_sampler_type_is_array(const struct glsl_type *type) +{ + assert(glsl_type_is_sampler(type)); + return type->sampler_array; +} + const glsl_type * glsl_void_type(void) { @@ -206,7 +259,7 @@ glsl_vector_type(enum glsl_base_type base_type, unsigned components) const glsl_type * glsl_matrix_type(enum glsl_base_type base_type, unsigned rows, unsigned columns) { - assert(rows > 1 && rows <= 4 && columns > 1 && columns <= 4); + assert(rows > 1 && rows <= 4 && columns >= 1 && columns <= 4); return glsl_type::get_instance(base_type, rows, columns); } @@ -223,9 +276,23 @@ glsl_struct_type(const glsl_struct_field *fields, return glsl_type::get_record_instance(fields, num_fields, name); } +const struct glsl_type * +glsl_sampler_type(enum glsl_sampler_dim dim, bool is_shadow, bool is_array, + enum glsl_base_type base_type) +{ + return glsl_type::get_sampler_instance(dim, is_shadow, is_array, base_type); +} + const glsl_type * glsl_function_type(const glsl_type *return_type, const glsl_function_param *params, unsigned num_params) { return glsl_type::get_function_instance(return_type, params, num_params); } + +const glsl_type * +glsl_transposed_type(const struct glsl_type *type) +{ + return glsl_type::get_instance(type->base_type, type->matrix_columns, + type->vector_elements); +}