Mesa (master): nvc0/ir: try to use the optimal texture op mode

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Sun Apr 29 16:06:52 UTC 2012


Module: Mesa
Branch: master
Commit: d6ab3106cf7475cdaddf788a3e650bdd5833f73c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6ab3106cf7475cdaddf788a3e650bdd5833f73c

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Fri Apr 27 23:27:34 2012 +0200

nvc0/ir: try to use the optimal texture op mode

Don't really know what they are yet but for groups of textures, the
last one should use mode "p" and the others "t".

---

 .../drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp     |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp
index c91c56c..026a6a0 100644
--- a/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp
+++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp
@@ -965,13 +965,25 @@ void CodeEmitterNVC0::emitTEXCSAA(const TexInstruction *i)
    srcId(i->src(0), 20);
 }
 
+static inline bool
+isNextIndependentTex(const TexInstruction *i)
+{
+   if (!i->next || !isTextureOp(i->next->op))
+      return false;
+   if (i->getDef(0)->interfers(i->next->getSrc(0)))
+      return false;
+   return !i->next->srcExists(1) || !i->getDef(0)->interfers(i->next->getSrc(1));
+}
+
 void
 CodeEmitterNVC0::emitTEX(const TexInstruction *i)
 {
    code[0] = 0x00000006;
 
-   if (1)
-      code[0] |= 0x80; // normal/t/p mode = t, XXX: what is this ?
+   if (isNextIndependentTex(i))
+      code[0] |= 0x080; // t mode
+   else
+      code[0] |= 0x100; // p mode
 
    if (i->tex.liveOnly)
       code[0] |= 1 << 9;
@@ -1021,7 +1033,7 @@ CodeEmitterNVC0::emitTEX(const TexInstruction *i)
    if (i->tex.target.isShadow())
       code[1] |= 1 << 24;
 
-   const int src1 = MAX2(i->predSrc + 1, 1); // if predSrc == 1, no 2nd src
+   const int src1 = (i->predSrc == 1) ? 2 : 1; // if predSrc == 1, !srcExists(2)
 
    if (i->srcExists(src1) && i->src(src1).getFile() == FILE_IMMEDIATE) {
       // lzero




More information about the mesa-commit mailing list