Looks good to me! Reviewed-by: Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de>
On 7/30/17 5:51 PM, Karol Herbst wrote: > For mul(a, +-1) codegen could end up generating OP_MOV with a saturation flag > set which we got simply ignored. > > Adding an assert for detecting more of such issues. > > Fixes wrongly rendered water in Hitman Absolution running under wine. > Also a few shaders in Mad Max and Alien Isolation produce such MOVs. > > CC: <mesa-sta...@lists.freedesktop.org> > Signed-off-by: Karol Herbst <karolher...@gmail.com> > --- > src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp | 1 + > src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 4 ++++ > 2 files changed, 5 insertions(+) > > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp > index 14c00bd187..58594f02c7 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp > @@ -2006,6 +2006,7 @@ CodeEmitterNVC0::getSRegEncoding(const ValueRef& ref) > void > CodeEmitterNVC0::emitMOV(const Instruction *i) > { > + assert(!i->saturate); > if (i->def(0).getFile() == FILE_PREDICATE) { > if (i->src(0).getFile() == FILE_GPR) { > code[0] = 0xfc01c003; > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > index dac3e6f814..38fb542b74 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > @@ -1003,6 +1003,10 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue > &imm0, int s) > } > if (i->op != OP_CVT) > i->src(0).mod = 0; > + if (i->op == OP_MOV && i->saturate) { > + i->saturate = 0; > + i->op = OP_SAT; > + } > i->setSrc(1, NULL); > } else > if (!i->postFactor && (imm0.isInteger(2) || imm0.isInteger(-2))) { _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev