Skip to contentSkip to conversation

nv50: TXF already has integer arguments, don't try to convert from f32

PATCH New Ilia Mirkin 1 participant 1 message Dec 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nv50: TXF already has integer arguments, don't try to convert from f32

Fixes the texelFetch piglit tests.

---

Verified a few things, but it's hard to check this fully. They array-texture piglit test fails if the conversion isn't done at all, and texelFetch starts passing if the conversion is removed.

Dunno if this is the sort of thing worth sticking a stable tag on, so leaving it out. Feel free to add on commit.

 .../drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp +9 -7
index caaf09f..07f3a21 100644
@@ -575,14 +575,16 @@ NV50LoweringPreSSA::handleTEX(TexInstruction *i)
       if (i->op == OP_TXB || i->op == OP_TXL)
          i->swapSources(dref, lod);
 
-   // array index must be converted to u32
    if (i->tex.target.isArray()) {
-      Value *layer = i->getSrc(arg - 1);
-      LValue *src = new_LValue(func, FILE_GPR);
-      bld.mkCvt(OP_CVT, TYPE_U32, src, TYPE_F32, layer);
-      bld.mkOp2(OP_MIN, TYPE_U32, src, src, bld.loadImm(NULL, 511));
-      i->setSrc(arg - 1, src);
-
+      if (i->op != OP_TXF) {
+         // array index must be converted to u32, but it's already an integer
+         // for TXF
+         Value *layer = i->getSrc(arg - 1);
+         LValue *src = new_LValue(func, FILE_GPR);
+         bld.mkCvt(OP_CVT, TYPE_U32, src, TYPE_F32, layer);
+         bld.mkOp2(OP_MIN, TYPE_U32, src, src, bld.loadImm(NULL, 511));
+         i->setSrc(arg - 1, src);
+      }
       if (i->tex.target.isCube()) {
          std::vector<Value *> acube, a2d;
          int c;
Signature · 1 line
1.8.3.2