nv50/ir: fix argument count for CUBE_ARRAY texture target
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 14 Oct 2011 17:58:04 +0000 (19:58 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 21 Oct 2011 21:00:38 +0000 (23:00 +0200)
src/gallium/drivers/nv50/codegen/nv50_ir.cpp
src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp

index 15625a97b9b0787a1b685d1eabd9fe720fa629e1..a8f05290df2b6e8f447d451de3962767c1954a64 100644 (file)
@@ -819,7 +819,7 @@ const struct TexInstruction::Target::Desc TexInstruction::Target::descTable[] =
    { "1D_ARRAY",          1, 2, true,  false, false },
    { "2D_ARRAY",          2, 3, true,  false, false },
    { "2D_MS_ARRAY",       2, 3, true,  false, false },
-   { "CUBE_ARRAY",        2, 3, true,  true,  false },
+   { "CUBE_ARRAY",        2, 4, true,  true,  false },
    { "1D_ARRAY_SHADOW",   1, 2, true,  false, true  },
    { "2D_ARRAY_SHADOW",   2, 3, true,  false, true  },
    { "RECT",              2, 2, false, false, false },
index 4b448c6900f06c895da76d314374101dcae77c31..2ef5a87c47d132931f89d67cb33155e4dd5ea269 100644 (file)
@@ -307,14 +307,14 @@ NVC0LoweringPass::visit(BasicBlock *bb)
 bool
 NVC0LoweringPass::handleTEX(TexInstruction *i)
 {
-   const int dim = i->tex.target.getDim();
-   const int arg = i->tex.target.getDim() + i->tex.target.isArray();
+   const int dim = i->tex.target.getDim() + i->tex.target.isCube();
+   const int arg = i->tex.target.getArgCount();
 
    // generate and move the tsc/tic/array source to the front
    if (dim != arg || i->tex.rIndirectSrc >= 0 || i->tex.sIndirectSrc >= 0) {
       LValue *src = new_LValue(func, FILE_GPR); // 0xttxsaaaa
 
-      Value *arrayIndex = i->tex.target.isArray() ? i->getSrc(dim) : NULL;
+      Value *arrayIndex = i->tex.target.isArray() ? i->getSrc(arg - 1) : NULL;
       for (int s = dim; s >= 1; --s)
          i->setSrc(s, i->getSrc(s - 1));
       i->setSrc(0, arrayIndex);