nvc0/ir: TXF array index already is an integer
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 8 Jan 2012 15:26:23 +0000 (16:26 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 9 Jan 2012 23:39:41 +0000 (00:39 +0100)
src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp

index e4d32d0a678107f46893c6449aef5b1f6006d84a..5f906e4ed150d293a3a10bd5f468ddb2fd1c6c0e 100644 (file)
@@ -322,10 +322,13 @@ NVC0LoweringPass::handleTEX(TexInstruction *i)
       Value *ticRel = i->getIndirectR();
       Value *tscRel = i->getIndirectS();
 
-      if (arrayIndex)
-         bld.mkCvt(OP_CVT, TYPE_U16, src, TYPE_F32, arrayIndex);
-      else
+      if (arrayIndex) {
+         int sat = (i->op == OP_TXF) ? 1 : 0;
+         DataType sTy = (i->op == OP_TXF) ? TYPE_U32 : TYPE_F32;
+         bld.mkCvt(OP_CVT, TYPE_U16, src, sTy, arrayIndex)->saturate = sat;
+      } else {
          bld.loadImm(src, 0);
+      }
 
       if (ticRel) {
          i->setSrc(i->tex.rIndirectSrc, NULL);