nv50/ir: force-enable derivatives on TXD ops
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 19 Mar 2016 15:46:11 +0000 (11:46 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 19 Mar 2016 17:09:49 +0000 (13:09 -0400)
This matters especially in vertex shaders, where derivatives are
disabled by default. This fixes textureGrad in vertex shaders on nv50.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp

index 682a19d6d781edd89d86ae71cc7a47a21ef14deb..bd6200687ed8479b0e3bcbdb0086c76912aa288b 100644 (file)
@@ -1634,7 +1634,9 @@ CodeEmitterNV50::emitTEX(const TexInstruction *i)
    code[1] |= (i->tex.mask & 0xc) << 12;
 
    if (i->tex.liveOnly)
-      code[1] |= 4;
+      code[1] |= 1 << 2;
+   if (i->tex.derivAll)
+      code[1] |= 1 << 3;
 
    defId(i->def(0), 2);
 
index 5a46ede852840efd788f1936c864a25d489928a2..6987503f9ce9dabada884dff01a0410f84eaffab 100644 (file)
@@ -934,6 +934,7 @@ NV50LoweringPreSSA::handleTXD(TexInstruction *i)
 
    handleTEX(i);
    i->op = OP_TEX; // no need to clone dPdx/dPdy later
+   i->tex.derivAll = true;
 
    for (c = 0; c < dim; ++c)
       crd[c] = bld.getScratch();