diff --git a/.pick_status.json b/.pick_status.json index da6c906c796..4969a3cb2d1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1102,7 +1102,7 @@ "description": "r600/sfn: Don't clear clear group flag on vec4 that comes from TEX or FETCH", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f3415cb26a62289fed9cb5f202088168add43cfd" }, diff --git a/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp b/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp index f3ed26822a4..2e05c2c7af3 100644 --- a/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp @@ -733,6 +733,36 @@ public: bool progress; }; +class HasVecDestVisitor : public ConstInstrVisitor { +public: + HasVecDestVisitor(): + has_group_dest(false) + { + } + + void visit(const AluInstr& instr) override { (void)instr; } + void visit(const AluGroup& instr) override { (void)instr; } + void visit(const TexInstr& instr) override { (void)instr; has_group_dest = true; }; + void visit(const ExportInstr& instr) override { (void)instr; } + void visit(const FetchInstr& instr) override { (void)instr; has_group_dest = true; }; + void visit(const Block& instr) override { (void)instr; }; + void visit(const ControlFlowInstr& instr) override{ (void)instr; } + void visit(const IfInstr& instr) override{ (void)instr; } + void visit(const ScratchIOInstr& instr) override { (void)instr; }; + void visit(const StreamOutInstr& instr) override { (void)instr; } + void visit(const MemRingOutInstr& instr) override { (void)instr; } + void visit(const EmitVertexInstr& instr) override { (void)instr; } + void visit(const GDSInstr& instr) override { (void)instr; } + void visit(const WriteTFInstr& instr) override { (void)instr; }; + void visit(const LDSAtomicInstr& instr) override { (void)instr; }; + void visit(const LDSReadInstr& instr) override { (void)instr; }; + void visit(const RatInstr& instr) override { (void)instr; }; + + bool has_group_dest; +}; + + + bool simplify_source_vectors(Shader& sh) { @@ -758,6 +788,16 @@ SimplifySourceVecVisitor::visit(TexInstr *instr) if (nvals == 1) { for (int i = 0; i < 4; ++i) if (src[i]->chan() < 4) { + HasVecDestVisitor check_dests; + for (auto p : src[i]->parents()) { + p->accept(check_dests); + if (check_dests.has_group_dest) + break; + } + + if (check_dests.has_group_dest) + break; + if (src[i]->pin() == pin_group) src[i]->set_pin(pin_free); else if (src[i]->pin() == pin_chgr)