[Mesa-dev] [PATCH 5/7] glsl: remove the shader_group_vote and shader_ballot expression ops

Nicolai Hähnle nhaehnle at gmail.com
Wed Apr 19 08:56:51 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

They are now no longer used.
---
 src/compiler/glsl/ir.cpp                           | 18 -----------------
 src/compiler/glsl/ir_expression_operation.py       | 12 -----------
 src/compiler/glsl/ir_validate.cpp                  | 23 ----------------------
 .../dri/i965/brw_fs_channel_expressions.cpp        |  6 ------
 src/mesa/program/ir_to_mesa.cpp                    |  6 ------
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp         | 18 -----------------
 6 files changed, 83 deletions(-)

diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 2bbc7a1..bc4f787 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -374,34 +374,20 @@ ir_expression::ir_expression(int op, ir_rvalue *op0)
    case ir_unop_frexp_exp:
       this->type = glsl_type::get_instance(GLSL_TYPE_INT,
 					   op0->type->vector_elements, 1);
       break;
 
    case ir_unop_get_buffer_size:
    case ir_unop_ssbo_unsized_array_length:
       this->type = glsl_type::int_type;
       break;
 
-   case ir_unop_ballot:
-      this->type = glsl_type::uint64_t_type;
-      break;
-
-   case ir_unop_read_first_invocation:
-      this->type = op0->type;
-      break;
-
-   case ir_unop_vote_any:
-   case ir_unop_vote_all:
-   case ir_unop_vote_eq:
-      this->type = glsl_type::bool_type;
-      break;
-
    case ir_unop_bitcast_i642d:
    case ir_unop_bitcast_u642d:
       this->type = glsl_type::get_instance(GLSL_TYPE_DOUBLE,
                                            op0->type->vector_elements, 1);
       break;
 
    case ir_unop_bitcast_d2i64:
       this->type = glsl_type::get_instance(GLSL_TYPE_INT64,
                                            op0->type->vector_elements, 1);
       break;
@@ -497,24 +483,20 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1)
    case ir_binop_ldexp:
    case ir_binop_interpolate_at_offset:
    case ir_binop_interpolate_at_sample:
       this->type = op0->type;
       break;
 
    case ir_binop_vector_extract:
       this->type = op0->type->get_scalar_type();
       break;
 
-   case ir_binop_read_invocation:
-      this->type = op0->type;
-      break;
-
    default:
       assert(!"not reached: missing automatic type setup for ir_expression");
       this->type = glsl_type::float_type;
    }
 }
 
 ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1,
                              ir_rvalue *op2)
    : ir_rvalue(ir_type_expression)
 {
diff --git a/src/compiler/glsl/ir_expression_operation.py b/src/compiler/glsl/ir_expression_operation.py
index 1d29560..59dcb30 100644
--- a/src/compiler/glsl/ir_expression_operation.py
+++ b/src/compiler/glsl/ir_expression_operation.py
@@ -563,29 +563,20 @@ ir_expression_operation = [
    operation("get_buffer_size", 1),
 
    # Calculate length of an unsized array inside a buffer block.
    # This opcode is going to be replaced in a lowering pass inside
    # the linker.
    #
    # operand0 is the unsized array's ir_value for the calculation
    # of its length.
    operation("ssbo_unsized_array_length", 1),
 
-   # ARB_shader_ballot operations
-   operation("ballot", 1, source_types=(bool_type,), dest_type=uint64_type),
-   operation("read_first_invocation", 1),
-
-   # Vote among threads on the value of the boolean argument.
-   operation("vote_any", 1),
-   operation("vote_all", 1),
-   operation("vote_eq", 1),
-
    # 64-bit integer packing ops.
    operation("pack_int_2x32", 1, printable_name="packInt2x32", source_types=(int_type,), dest_type=int64_type, c_expression="memcpy(&data.i64[0], &op[0]->value.i[0], sizeof(int64_t))", flags=frozenset((horizontal_operation, non_assign_operation))),
    operation("pack_uint_2x32", 1, printable_name="packUint2x32", source_types=(uint_type,), dest_type=uint64_type, c_expression="memcpy(&data.u64[0], &op[0]->value.u[0], sizeof(uint64_t))", flags=frozenset((horizontal_operation, non_assign_operation))),
    operation("unpack_int_2x32", 1, printable_name="unpackInt2x32", source_types=(int64_type,), dest_type=int_type, c_expression="memcpy(&data.i[0], &op[0]->value.i64[0], sizeof(int64_t))", flags=frozenset((horizontal_operation, non_assign_operation))),
    operation("unpack_uint_2x32", 1, printable_name="unpackUint2x32", source_types=(uint64_type,), dest_type=uint_type, c_expression="memcpy(&data.u[0], &op[0]->value.u64[0], sizeof(uint64_t))", flags=frozenset((horizontal_operation, non_assign_operation))),
 
    operation("add", 2, printable_name="+", source_types=numeric_types, c_expression="{src0} + {src1}", flags=vector_scalar_operation),
    operation("sub", 2, printable_name="-", source_types=numeric_types, c_expression="{src0} - {src1}", flags=vector_scalar_operation),
    # "Floating-point or low 32-bit integer multiply."
    operation("mul", 2, printable_name="*", source_types=numeric_types, c_expression="{src0} * {src1}"),
@@ -663,23 +654,20 @@ ir_expression_operation = [
    # operand0 is the fs input
    # operand1 is the offset from the pixel center
    operation("interpolate_at_offset", 2),
 
    # Interpolate fs input at sample position
    #
    # operand0 is the fs input
    # operand1 is the sample ID
    operation("interpolate_at_sample", 2),
 
-   # ARB_shader_ballot operation
-   operation("read_invocation", 2),
-
    # Fused floating-point multiply-add, part of ARB_gpu_shader5.
    operation("fma", 3, source_types=real_types, c_expression="{src0} * {src1} + {src2}"),
 
    operation("lrp", 3, source_types=real_types, c_expression={'f': "{src0} * (1.0f - {src2}) + ({src1} * {src2})", 'd': "{src0} * (1.0 - {src2}) + ({src1} * {src2})"}),
 
    # Conditional Select
    #
    # A vector conditional select instruction (like ?:, but operating per-
    # component on vectors).
    #
diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
index 76a4ed1..05609c9 100644
--- a/src/compiler/glsl/ir_validate.cpp
+++ b/src/compiler/glsl/ir_validate.cpp
@@ -575,43 +575,20 @@ ir_validate::visit_leave(ir_expression *ir)
    case ir_unop_frexp_exp:
       assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT ||
              ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
       assert(ir->type->base_type == GLSL_TYPE_INT);
       break;
    case ir_unop_subroutine_to_int:
       assert(ir->operands[0]->type->base_type == GLSL_TYPE_SUBROUTINE);
       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:
-      assert(ir->type == glsl_type::bool_type);
-      assert(ir->operands[0]->type == glsl_type::bool_type);
-      break;
-
    case ir_binop_add:
    case ir_binop_sub:
    case ir_binop_mul:
    case ir_binop_div:
    case ir_binop_mod:
    case ir_binop_min:
    case ir_binop_max:
    case ir_binop_pow:
       assert(ir->operands[0]->type->base_type ==
              ir->operands[1]->type->base_type);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
index 58fa207..fa95f8a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -458,26 +458,20 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
 
    case ir_unop_pack_double_2x32:
    case ir_unop_pack_int_2x32:
    case ir_unop_pack_uint_2x32:
       unreachable("not reached: to be lowered in NIR, should've been skipped");
 
    case ir_unop_frexp_sig:
    case ir_unop_frexp_exp:
       unreachable("should have been lowered by lower_instructions");
 
-   case ir_unop_vote_any:
-   case ir_unop_vote_all:
-   case ir_unop_vote_eq:
    case ir_unop_unpack_int_2x32:
    case ir_unop_unpack_uint_2x32:
-   case ir_unop_ballot:
-   case ir_unop_read_first_invocation:
-   case ir_binop_read_invocation:
       unreachable("unsupported");
    }
 
    ir->remove();
    this->progress = true;
 
    return visit_continue;
 }
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 6b33266..85478ca 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1382,26 +1382,20 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
    case ir_binop_imul_high:
    case ir_unop_interpolate_at_centroid:
    case ir_binop_interpolate_at_offset:
    case ir_binop_interpolate_at_sample:
    case ir_unop_dFdx_coarse:
    case ir_unop_dFdx_fine:
    case ir_unop_dFdy_coarse:
    case ir_unop_dFdy_fine:
    case ir_unop_subroutine_to_int:
    case ir_unop_get_buffer_size:
-   case ir_unop_ballot:
-   case ir_binop_read_invocation:
-   case ir_unop_read_first_invocation:
-   case ir_unop_vote_any:
-   case ir_unop_vote_all:
-   case ir_unop_vote_eq:
    case ir_unop_bitcast_u642d:
    case ir_unop_bitcast_i642d:
    case ir_unop_bitcast_d2u64:
    case ir_unop_bitcast_d2i64:
    case ir_unop_i642i:
    case ir_unop_u642i:
    case ir_unop_i642u:
    case ir_unop_u642u:
    case ir_unop_i642b:
    case ir_unop_i642f:
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 2517a05..dfcb622 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2354,38 +2354,20 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
             GLSL_TYPE_UINT);
       if (!const_offset) {
          buffer.reladdr = ralloc(mem_ctx, st_src_reg);
          *buffer.reladdr = op[0];
          emit_arl(ir, sampler_reladdr, op[0]);
       }
       emit_asm(ir, TGSI_OPCODE_RESQ, result_dst)->resource = buffer;
       break;
    }
 
-   case ir_unop_vote_any:
-      emit_asm(ir, TGSI_OPCODE_VOTE_ANY, result_dst, op[0]);
-      break;
-   case ir_unop_vote_all:
-      emit_asm(ir, TGSI_OPCODE_VOTE_ALL, result_dst, op[0]);
-      break;
-   case ir_unop_vote_eq:
-      emit_asm(ir, TGSI_OPCODE_VOTE_EQ, result_dst, op[0]);
-      break;
-   case ir_unop_ballot:
-      emit_asm(ir, TGSI_OPCODE_BALLOT, result_dst, op[0]);
-      break;
-   case ir_unop_read_first_invocation:
-      emit_asm(ir, TGSI_OPCODE_READ_FIRST, result_dst, op[0]);
-      break;
-   case ir_binop_read_invocation:
-      emit_asm(ir, TGSI_OPCODE_READ_INVOC, result_dst, op[0], op[1]);
-      break;
    case ir_unop_u2i64:
    case ir_unop_u2u64:
    case ir_unop_b2i64: {
       st_src_reg temp = get_temp(glsl_type::uvec4_type);
       st_dst_reg temp_dst = st_dst_reg(temp);
       unsigned orig_swz = op[0].swizzle;
       /* 
        * To convert unsigned to 64-bit:
        * zero Y channel, copy X channel.
        */
-- 
2.9.3



More information about the mesa-dev mailing list