From 64db02b5fabcf740b353904b05bd9b9e8c713b76 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 21 Apr 2017 10:32:39 +0200 Subject: [PATCH] glsl: make use of glsl_type::is_record() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Samuel Pitoiset Reviewed-by: Samuel Iglesias Gonsálvez Reviewed-by: Edward O'Callaghan --- src/compiler/glsl/hir_field_selection.cpp | 3 +-- src/compiler/glsl/ir.cpp | 2 +- src/compiler/glsl/ir_print_visitor.cpp | 3 +-- src/mesa/program/ir_to_mesa.cpp | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 ++-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/compiler/glsl/hir_field_selection.cpp b/src/compiler/glsl/hir_field_selection.cpp index aa1808afa15..9f23643fd02 100644 --- a/src/compiler/glsl/hir_field_selection.cpp +++ b/src/compiler/glsl/hir_field_selection.cpp @@ -46,8 +46,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, YYLTYPE loc = expr->get_location(); if (op->type->is_error()) { /* silently propagate the error */ - } else if (op->type->base_type == GLSL_TYPE_STRUCT - || op->type->is_interface()) { + } else if (op->type->is_record() || op->type->is_interface()) { result = new(ctx) ir_dereference_record(op, expr->primary_expression.identifier); diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index 2bbc7a1cf72..b5c1fa33919 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -1237,7 +1237,7 @@ ir_constant::has_value(const ir_constant *c) const return true; } - if (this->type->base_type == GLSL_TYPE_STRUCT) { + if (this->type->is_record()) { const exec_node *a_node = this->components.get_head_raw(); const exec_node *b_node = c->components.get_head_raw(); diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp index 0a39459c925..6c1c86a5828 100644 --- a/src/compiler/glsl/ir_print_visitor.cpp +++ b/src/compiler/glsl/ir_print_visitor.cpp @@ -149,8 +149,7 @@ print_type(FILE *f, const glsl_type *t) fprintf(f, "(array "); print_type(f, t->fields.array); fprintf(f, " %u)", t->length); - } else if ((t->base_type == GLSL_TYPE_STRUCT) - && !is_gl_identifier(t->name)) { + } else if (t->is_record() && !is_gl_identifier(t->name)) { fprintf(f, "%s@%p", t->name, (void *) t); } else { fprintf(f, "%s", t->name); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 6b33266f1b9..083591cc0fe 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1903,7 +1903,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir) * get lucky, copy propagation will eliminate the extra moves. */ - if (ir->type->base_type == GLSL_TYPE_STRUCT) { + if (ir->type->is_record()) { src_reg temp_base = get_temp(ir->type); dst_reg temp = dst_reg(temp_base); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 9a19167faa0..0c3ac8c7385 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3091,7 +3091,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type * st_dst_reg *l, st_src_reg *r, st_src_reg *cond, bool cond_swap) { - if (type->base_type == GLSL_TYPE_STRUCT) { + if (type->is_record()) { for (unsigned int i = 0; i < type->length; i++) { emit_block_mov(ir, type->fields.structure[i].type, l, r, cond, cond_swap); @@ -3264,7 +3264,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) * aggregate constant and move each constant value into it. If we * get lucky, copy propagation will eliminate the extra moves. */ - if (ir->type->base_type == GLSL_TYPE_STRUCT) { + if (ir->type->is_record()) { st_src_reg temp_base = get_temp(ir->type); st_dst_reg temp = st_dst_reg(temp_base); -- 2.30.2