mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 22:00:13 +01:00
glsl_to_tgsi: improve assignment hack
Fixes StarCraft 2 and Fallout 3 in Wine.
This commit is contained in:
parent
32faaea743
commit
e6c64800cc
1 changed files with 5 additions and 3 deletions
|
|
@ -1994,15 +1994,17 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
|
||||||
} else if (ir->rhs->as_expression() &&
|
} else if (ir->rhs->as_expression() &&
|
||||||
this->instructions.get_tail() &&
|
this->instructions.get_tail() &&
|
||||||
ir->rhs == ((glsl_to_tgsi_instruction *)this->instructions.get_tail())->ir &&
|
ir->rhs == ((glsl_to_tgsi_instruction *)this->instructions.get_tail())->ir &&
|
||||||
type_size(ir->lhs->type) == 1) {
|
type_size(ir->lhs->type) == 1 &&
|
||||||
|
l.writemask == ((glsl_to_tgsi_instruction *)this->instructions.get_tail())->dst.writemask) {
|
||||||
/* To avoid emitting an extra MOV when assigning an expression to a
|
/* To avoid emitting an extra MOV when assigning an expression to a
|
||||||
* variable, emit the last instruction of the expression again, but
|
* variable, emit the last instruction of the expression again, but
|
||||||
* replace the destination register with the target of the assignment.
|
* replace the destination register with the target of the assignment.
|
||||||
* Dead code elimination will remove the original instruction.
|
* Dead code elimination will remove the original instruction.
|
||||||
*/
|
*/
|
||||||
glsl_to_tgsi_instruction *inst;
|
glsl_to_tgsi_instruction *inst, *new_inst;
|
||||||
inst = (glsl_to_tgsi_instruction *)this->instructions.get_tail();
|
inst = (glsl_to_tgsi_instruction *)this->instructions.get_tail();
|
||||||
emit(ir, inst->op, l, inst->src[0], inst->src[1], inst->src[2]);
|
new_inst = emit(ir, inst->op, l, inst->src[0], inst->src[1], inst->src[2]);
|
||||||
|
new_inst->saturate = inst->saturate;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < type_size(ir->lhs->type); i++) {
|
for (i = 0; i < type_size(ir->lhs->type); i++) {
|
||||||
emit(ir, TGSI_OPCODE_MOV, l, r);
|
emit(ir, TGSI_OPCODE_MOV, l, r);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue