diff options
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp index fb9bed4454c..8f266454f6d 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp @@ -1464,14 +1464,21 @@ NVC0LoweringPass::handleEXPORT(Instruction *i) bool NVC0LoweringPass::handleOUT(Instruction *i) { - if (i->op == OP_RESTART && i->prev && i->prev->op == OP_EMIT) { + Instruction *prev = i->prev; + ImmediateValue stream, prevStream; + + // Only merge if the stream ids match. Also, note that the previous + // instruction would have already been lowered, so we take arg1 from it. + if (i->op == OP_RESTART && prev && prev->op == OP_EMIT && + i->src(0).getImmediate(stream) && + prev->src(1).getImmediate(prevStream) && + stream.reg.data.u32 == prevStream.reg.data.u32) { i->prev->subOp = NV50_IR_SUBOP_EMIT_RESTART; delete_Instruction(prog, i); } else { assert(gpEmitAddress); i->setDef(0, gpEmitAddress); - if (i->srcExists(0)) - i->setSrc(1, i->getSrc(0)); + i->setSrc(1, i->getSrc(0)); i->setSrc(0, gpEmitAddress); } return true; |