nv50/ir/gk110: implement partial txq support
authorIlia Mirkin <imirkin@alum.mit.edu>
Tue, 11 Mar 2014 12:30:49 +0000 (08:30 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 18 Mar 2014 09:56:53 +0000 (05:56 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp

index 6a24b0a229971655db4a27285235de78f07ff9f0..033104bff9bf3644fe0db274e81b75d4ff2ac2e4 100644 (file)
@@ -1059,7 +1059,33 @@ CodeEmitterGK110::emitTEX(const TexInstruction *i)
 void
 CodeEmitterGK110::emitTXQ(const TexInstruction *i)
 {
-   emitNOP(i); // TODO
+   code[0] = 0x00000002;
+   code[1] = 0x75400001;
+
+   switch (i->tex.query) {
+   case TXQ_DIMS:            code[0] |= 0x01 << 25; break;
+   case TXQ_TYPE:            code[0] |= 0x02 << 25; break;
+   case TXQ_SAMPLE_POSITION: code[0] |= 0x05 << 25; break;
+   case TXQ_FILTER:          code[0] |= 0x10 << 25; break;
+   case TXQ_LOD:             code[0] |= 0x12 << 25; break;
+   case TXQ_BORDER_COLOUR:   code[0] |= 0x16 << 25; break;
+   default:
+      assert(!"invalid texture query");
+      break;
+   }
+
+   // TODO:
+   // code[1] |= i->tex.mask << 14;
+   //
+   // code[1] |= i->tex.r << 9;
+   // code[1] |= i->tex.s << 2;
+   // if (i->tex.sIndirectSrc >= 0 || i->tex.rIndirectSrc >= 0)
+   //   ?
+
+   defId(i->def(0), 2);
+   srcId(i->src(0), 10);
+
+   emitPredicate(i);
 }
 
 void