intel/compiler: Use glsl_type C helpers

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26707>
This commit is contained in:
Caio Oliveira 2023-12-14 22:14:03 -08:00
parent 1e6fcd6a61
commit 55cde229d5
5 changed files with 13 additions and 13 deletions

View file

@ -1333,9 +1333,9 @@ brw_can_pack_primitive_indices(nir_shader *nir, struct index_packing_state *stat
return true;
ASSERTED const struct glsl_type *type = state->original_prim_indices->type;
assert(type->is_array());
assert(type->without_array()->is_vector());
assert(type->without_array()->vector_elements == state->vertices_per_primitive);
assert(glsl_type_is_array(type));
assert(glsl_type_is_vector(glsl_without_array(type)));
assert(glsl_without_array(type)->vector_elements == state->vertices_per_primitive);
nir_foreach_function_impl(impl, nir) {
nir_foreach_block(block, impl) {

View file

@ -53,7 +53,7 @@ src_reg::src_reg(enum brw_reg_file file, int nr, const glsl_type *type)
this->file = file;
this->nr = nr;
if (type && (type->is_scalar() || type->is_vector() || type->is_matrix()))
if (type && (glsl_type_is_scalar(type) || glsl_type_is_vector(type) || glsl_type_is_matrix(type)))
this->swizzle = brw_swizzle_for_size(type->vector_elements);
else
this->swizzle = BRW_SWIZZLE_XYZW;

View file

@ -43,7 +43,7 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
const unsigned input_array_stride = prog_data->urb_read_length * 2;
/* Make up a type...we have no way of knowing... */
const glsl_type *const type = glsl_type::ivec(instr->num_components);
const glsl_type *const type = glsl_ivec_type(instr->num_components);
src = src_reg(ATTR, input_array_stride * vertex +
nir_intrinsic_base(instr) + offset_reg,

View file

@ -1908,13 +1908,13 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
case nir_texop_samples_identical:
coordinate = get_nir_src(instr->src[i].src, BRW_REGISTER_TYPE_D,
src_size);
coord_type = glsl_type::ivec(src_size);
coord_type = glsl_ivec_type(src_size);
break;
default:
coordinate = get_nir_src(instr->src[i].src, BRW_REGISTER_TYPE_F,
src_size);
coord_type = glsl_type::vec(src_size);
coord_type = glsl_vec_type(src_size);
break;
}
break;

View file

@ -582,10 +582,10 @@ type_size_xvec4(const struct glsl_type *type, bool as_vec4, bool bindless)
case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
if (type->is_matrix()) {
const glsl_type *col_type = type->column_type();
if (glsl_type_is_matrix(type)) {
const glsl_type *col_type = glsl_get_column_type(type);
unsigned col_slots =
(as_vec4 && col_type->is_dual_slot()) ? 2 : 1;
(as_vec4 && glsl_type_is_dual_slot(col_type)) ? 2 : 1;
return type->matrix_columns * col_slots;
} else {
/* Regardless of size of vector, it gets a vec4. This is bad
@ -593,7 +593,7 @@ type_size_xvec4(const struct glsl_type *type, bool as_vec4, bool bindless)
* mess. Hopefully a later pass over the code can pack scalars
* down if appropriate.
*/
return (as_vec4 && type->is_dual_slot()) ? 2 : 1;
return (as_vec4 && glsl_type_is_dual_slot(type)) ? 2 : 1;
}
case GLSL_TYPE_ARRAY:
assert(type->length > 0);
@ -677,7 +677,7 @@ src_reg::src_reg(class vec4_visitor *v, const struct glsl_type *type)
this->file = VGRF;
this->nr = v->alloc.allocate(type_size_vec4(type, false));
if (type->is_array() || type->is_struct()) {
if (glsl_type_is_array(type) || glsl_type_is_struct(type)) {
this->swizzle = BRW_SWIZZLE_NOOP;
} else {
this->swizzle = brw_swizzle_for_size(type->vector_elements);
@ -707,7 +707,7 @@ dst_reg::dst_reg(class vec4_visitor *v, const struct glsl_type *type)
this->file = VGRF;
this->nr = v->alloc.allocate(type_size_vec4(type, false));
if (type->is_array() || type->is_struct()) {
if (glsl_type_is_array(type) || glsl_type_is_struct(type)) {
this->writemask = WRITEMASK_XYZW;
} else {
this->writemask = (1 << type->vector_elements) - 1;