mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
glsl_to_tgsi: implement ir_binop_all_equal using DP4 w/SGE
This is a port of commit ba01df11c4 to glsl_to_tgsi with integer support
added.
This commit is contained in:
parent
f3dce133f0
commit
9098953ee6
1 changed files with 19 additions and 1 deletions
|
|
@ -1460,8 +1460,26 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
|
|||
glsl_type::vec4_type);
|
||||
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
|
||||
emit(ir, TGSI_OPCODE_SNE, st_dst_reg(temp), op[0], op[1]);
|
||||
|
||||
/* After the dot-product, the value will be an integer on the
|
||||
* range [0,4]. Zero becomes 1.0, and positive values become zero.
|
||||
*/
|
||||
emit_dp(ir, result_dst, temp, temp, vector_elements);
|
||||
emit(ir, TGSI_OPCODE_SEQ, result_dst, result_src, st_src_reg_for_float(0.0));
|
||||
|
||||
if (result_dst.type == GLSL_TYPE_FLOAT) {
|
||||
/* Negating the result of the dot-product gives values on the range
|
||||
* [-4, 0]. Zero becomes 1.0, and negative values become zero.
|
||||
* This is achieved using SGE.
|
||||
*/
|
||||
st_src_reg sge_src = result_src;
|
||||
sge_src.negate = ~sge_src.negate;
|
||||
emit(ir, TGSI_OPCODE_SGE, result_dst, sge_src, st_src_reg_for_float(0.0));
|
||||
} else {
|
||||
/* The TGSI negate flag doesn't work for integers, so use SEQ 0
|
||||
* instead.
|
||||
*/
|
||||
emit(ir, TGSI_OPCODE_SEQ, result_dst, result_src, st_src_reg_for_int(0));
|
||||
}
|
||||
} else {
|
||||
emit(ir, TGSI_OPCODE_SEQ, result_dst, op[0], op[1]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue