X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcompiler%2Fglsl%2Fir_validate.cpp;h=76a4ed17e775d7e7325aaaf8e74d21a876649d84;hb=6e3265eae533a1bff4f23a4508c5d8e9ab23164d;hp=126f9bf227a6adac764557c39c88506498d04cf8;hpb=5189f0243a3dd8698c645bbe762b8a1a3caaf1a9;p=mesa.git diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp index 126f9bf227a..76a4ed17e77 100644 --- a/src/compiler/glsl/ir_validate.cpp +++ b/src/compiler/glsl/ir_validate.cpp @@ -246,11 +246,23 @@ ir_validate::visit_leave(ir_expression *ir) break; case ir_unop_neg: + assert(ir->type == ir->operands[0]->type); + break; + case ir_unop_abs: case ir_unop_sign: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT || + ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT || + ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE || + ir->operands[0]->type->base_type == GLSL_TYPE_INT64); + assert(ir->type == ir->operands[0]->type); + break; + case ir_unop_rcp: case ir_unop_rsq: case ir_unop_sqrt: + assert(ir->type->base_type == GLSL_TYPE_FLOAT || + ir->type->base_type == GLSL_TYPE_DOUBLE); assert(ir->type == ir->operands[0]->type); break; @@ -320,6 +332,102 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->type->base_type == GLSL_TYPE_UINT); break; + case ir_unop_bitcast_u642d: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64); + assert(ir->type->base_type == GLSL_TYPE_DOUBLE); + break; + case ir_unop_bitcast_i642d: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64); + assert(ir->type->base_type == GLSL_TYPE_DOUBLE); + break; + case ir_unop_bitcast_d2u64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE); + assert(ir->type->base_type == GLSL_TYPE_UINT64); + break; + case ir_unop_bitcast_d2i64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE); + assert(ir->type->base_type == GLSL_TYPE_INT64); + break; + case ir_unop_i642i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; + case ir_unop_u642i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; + case ir_unop_i642u: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64); + assert(ir->type->base_type == GLSL_TYPE_UINT); + break; + case ir_unop_u642u: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64); + assert(ir->type->base_type == GLSL_TYPE_UINT); + break; + case ir_unop_i642b: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64); + assert(ir->type->base_type == GLSL_TYPE_BOOL); + break; + case ir_unop_i642f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + case ir_unop_u642f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + case ir_unop_i642d: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64); + assert(ir->type->base_type == GLSL_TYPE_DOUBLE); + break; + case ir_unop_u642d: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64); + assert(ir->type->base_type == GLSL_TYPE_DOUBLE); + break; + case ir_unop_i2i64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_INT64); + break; + case ir_unop_u2i64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); + 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->type->base_type == GLSL_TYPE_INT64); + break; + case ir_unop_f2i64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_INT64); + break; + case ir_unop_d2i64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE); + assert(ir->type->base_type == GLSL_TYPE_INT64); + break; + case ir_unop_i2u64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_UINT64); + break; + case ir_unop_u2u64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); + assert(ir->type->base_type == GLSL_TYPE_UINT64); + break; + case ir_unop_f2u64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_UINT64); + break; + case ir_unop_d2u64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE); + assert(ir->type->base_type == GLSL_TYPE_UINT64); + break; + case ir_unop_u642i64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64); + assert(ir->type->base_type == GLSL_TYPE_INT64); + break; + case ir_unop_i642u64: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64); + assert(ir->type->base_type == GLSL_TYPE_UINT64); + break; case ir_unop_trunc: case ir_unop_round_even: case ir_unop_ceil: @@ -359,6 +467,16 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[0]->type == glsl_type::uvec2_type); break; + case ir_unop_pack_int_2x32: + assert(ir->type == glsl_type::int64_t_type); + assert(ir->operands[0]->type == glsl_type::ivec2_type); + break; + + case ir_unop_pack_uint_2x32: + assert(ir->type == glsl_type::uint64_t_type); + assert(ir->operands[0]->type == glsl_type::uvec2_type); + break; + case ir_unop_unpack_snorm_2x16: case ir_unop_unpack_unorm_2x16: case ir_unop_unpack_half_2x16: @@ -377,6 +495,16 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[0]->type == glsl_type::double_type); break; + case ir_unop_unpack_int_2x32: + assert(ir->type == glsl_type::ivec2_type); + assert(ir->operands[0]->type == glsl_type::int64_t_type); + break; + + case ir_unop_unpack_uint_2x32: + assert(ir->type == glsl_type::uvec2_type); + assert(ir->operands[0]->type == glsl_type::uint64_t_type); + break; + case ir_unop_bitfield_reverse: assert(ir->operands[0]->type == ir->type); assert(ir->type->is_integer()); @@ -454,6 +582,22 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->type->base_type == GLSL_TYPE_INT); break; + case ir_unop_ballot: + assert(ir->type == glsl_type::uint64_t_type); + assert(ir->operands[0]->type == glsl_type::bool_type); + break; + + case ir_binop_read_invocation: + assert(ir->operands[1]->type == glsl_type::uint_type); + /* fall-through */ + case ir_unop_read_first_invocation: + assert(ir->type == ir->operands[0]->type); + assert(ir->type->is_scalar() || ir->type->is_vector()); + assert(ir->type->base_type == GLSL_TYPE_FLOAT || + ir->type->base_type == GLSL_TYPE_INT || + ir->type->base_type == GLSL_TYPE_UINT); + break; + case ir_unop_vote_any: case ir_unop_vote_all: case ir_unop_vote_eq: @@ -526,7 +670,7 @@ ir_validate::visit_leave(ir_expression *ir) case ir_binop_lshift: case ir_binop_rshift: - assert(ir->operands[0]->type->is_integer() && + assert(ir->operands[0]->type->is_integer_32_64() && ir->operands[1]->type->is_integer()); if (ir->operands[0]->type->is_scalar()) { assert(ir->operands[1]->type->is_scalar()); @@ -544,7 +688,7 @@ ir_validate::visit_leave(ir_expression *ir) case ir_binop_bit_or: assert(ir->operands[0]->type->base_type == ir->operands[1]->type->base_type); - assert(ir->type->is_integer()); + assert(ir->type->is_integer_32_64()); if (ir->operands[0]->type->is_vector() && ir->operands[1]->type->is_vector()) { assert(ir->operands[0]->type->vector_elements == @@ -840,8 +984,8 @@ ir_validate::visit_enter(ir_call *ir) abort(); } - const exec_node *formal_param_node = callee->parameters.head; - const exec_node *actual_param_node = ir->actual_parameters.head; + const exec_node *formal_param_node = callee->parameters.get_head_raw(); + const exec_node *actual_param_node = ir->actual_parameters.get_head_raw(); while (true) { if (formal_param_node->is_tail_sentinel() != actual_param_node->is_tail_sentinel()) {