From f98a221f2d1dc250cbba8c8944c5db623c4ada0b Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 23 Jun 2017 20:30:29 +0200 Subject: [PATCH] nv50/ir: disable mul+add to mad for precise instructions fixes missrendering in TombRaider KHR-GL44.gpu_shader5.precise_qualifier KHR-GL45.gpu_shader5.precise_qualifier v4: disable opt only for MAD, it's fine for SAD Signed-off-by: Karol Herbst Reviewed-by: Pierre Moreau --- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp index df83f18ae83..dac3e6f814c 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp @@ -1677,7 +1677,8 @@ AlgebraicOpt::handleADD(Instruction *add) return false; bool changed = false; - if (!changed && prog->getTarget()->isOpSupported(OP_MAD, add->dType)) + // we can't optimize to MAD if the add is precise + if (!add->precise && prog->getTarget()->isOpSupported(OP_MAD, add->dType)) changed = tryADDToMADOrSAD(add, OP_MAD); if (!changed && prog->getTarget()->isOpSupported(OP_SAD, add->dType)) changed = tryADDToMADOrSAD(add, OP_SAD); @@ -1713,7 +1714,7 @@ AlgebraicOpt::tryADDToMADOrSAD(Instruction *add, operation toOp) return false; if (src->getInsn()->saturate || src->getInsn()->postFactor || - src->getInsn()->dnz) + src->getInsn()->dnz || src->getInsn()->precise) return false; if (toOp == OP_SAD) { -- 2.30.2