mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-13 13:30:29 +01:00
glsl: make use of glsl_type::is_boolean()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
This commit is contained in:
parent
64db02b5fa
commit
60caca3019
4 changed files with 18 additions and 19 deletions
|
|
@ -1487,8 +1487,7 @@ ast_expression::do_hir(exec_list *instructions,
|
|||
* in a scalar boolean. See page 57 of the GLSL 1.50 spec.
|
||||
*/
|
||||
assert(type->is_error()
|
||||
|| ((type->base_type == GLSL_TYPE_BOOL)
|
||||
&& type->is_scalar()));
|
||||
|| (type->is_boolean() && type->is_scalar()));
|
||||
|
||||
result = new(ctx) ir_expression(operations[this->oper], type,
|
||||
op[0], op[1]);
|
||||
|
|
|
|||
|
|
@ -985,7 +985,7 @@ nir_visitor::visit(ir_call *ir)
|
|||
* consider a true boolean to be ~0. Fix this up with a != 0
|
||||
* comparison.
|
||||
*/
|
||||
if (type->base_type == GLSL_TYPE_BOOL) {
|
||||
if (type->is_boolean()) {
|
||||
nir_alu_instr *load_ssbo_compare =
|
||||
nir_alu_instr_create(shader, nir_op_ine);
|
||||
load_ssbo_compare->src[0].src.is_ssa = true;
|
||||
|
|
@ -1334,7 +1334,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
* a true boolean to be ~0. Fix this up with a != 0 comparison.
|
||||
*/
|
||||
|
||||
if (ir->type->base_type == GLSL_TYPE_BOOL)
|
||||
if (ir->type->is_boolean())
|
||||
this->result = nir_ine(&b, &load->dest.ssa, nir_imm_int(&b, 0));
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -241,8 +241,8 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
assert(ir->operands[0]->type == ir->type);
|
||||
break;
|
||||
case ir_unop_logic_not:
|
||||
assert(ir->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->type->is_boolean());
|
||||
assert(ir->operands[0]->type->is_boolean());
|
||||
break;
|
||||
|
||||
case ir_unop_neg:
|
||||
|
|
@ -289,18 +289,18 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
break;
|
||||
case ir_unop_f2b:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
|
||||
assert(ir->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->type->is_boolean());
|
||||
break;
|
||||
case ir_unop_b2f:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->operands[0]->type->is_boolean());
|
||||
assert(ir->type->base_type == GLSL_TYPE_FLOAT);
|
||||
break;
|
||||
case ir_unop_i2b:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
|
||||
assert(ir->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->type->is_boolean());
|
||||
break;
|
||||
case ir_unop_b2i:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->operands[0]->type->is_boolean());
|
||||
assert(ir->type->base_type == GLSL_TYPE_INT);
|
||||
break;
|
||||
case ir_unop_u2f:
|
||||
|
|
@ -366,7 +366,7 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
break;
|
||||
case ir_unop_i642b:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
|
||||
assert(ir->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->type->is_boolean());
|
||||
break;
|
||||
case ir_unop_i642f:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
|
||||
|
|
@ -393,7 +393,7 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
assert(ir->type->base_type == GLSL_TYPE_INT64);
|
||||
break;
|
||||
case ir_unop_b2i64:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->operands[0]->type->is_boolean());
|
||||
assert(ir->type->base_type == GLSL_TYPE_INT64);
|
||||
break;
|
||||
case ir_unop_f2i64:
|
||||
|
|
@ -564,7 +564,7 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
break;
|
||||
case ir_unop_d2b:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
|
||||
assert(ir->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->type->is_boolean());
|
||||
break;
|
||||
|
||||
case ir_unop_frexp_sig:
|
||||
|
|
@ -651,7 +651,7 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
* comparison on scalar or vector types and return a boolean scalar or
|
||||
* vector type of the same size.
|
||||
*/
|
||||
assert(ir->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->type->is_boolean());
|
||||
assert(ir->operands[0]->type == ir->operands[1]->type);
|
||||
assert(ir->operands[0]->type->is_vector()
|
||||
|| ir->operands[0]->type->is_scalar());
|
||||
|
|
@ -699,9 +699,9 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
case ir_binop_logic_and:
|
||||
case ir_binop_logic_xor:
|
||||
case ir_binop_logic_or:
|
||||
assert(ir->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->operands[1]->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->type->is_boolean());
|
||||
assert(ir->operands[0]->type->is_boolean());
|
||||
assert(ir->operands[1]->type->is_boolean());
|
||||
break;
|
||||
|
||||
case ir_binop_dot:
|
||||
|
|
@ -765,7 +765,7 @@ ir_validate::visit_leave(ir_expression *ir)
|
|||
break;
|
||||
|
||||
case ir_triop_csel:
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
|
||||
assert(ir->operands[0]->type->is_boolean());
|
||||
assert(ir->type->vector_elements == ir->operands[0]->type->vector_elements);
|
||||
assert(ir->type == ir->operands[1]->type);
|
||||
assert(ir->type == ir->operands[2]->type);
|
||||
|
|
|
|||
|
|
@ -2225,7 +2225,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
|
|||
const_offset % 16 / 4,
|
||||
const_offset % 16 / 4);
|
||||
|
||||
if (ir->type->base_type == GLSL_TYPE_BOOL) {
|
||||
if (ir->type->is_boolean()) {
|
||||
emit_asm(ir, TGSI_OPCODE_USNE, result_dst, cbuf, st_src_reg_for_int(0));
|
||||
} else {
|
||||
emit_asm(ir, TGSI_OPCODE_MOV, result_dst, cbuf);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue