shader-packing
[mesa.git] / src / gallium / drivers / nouveau / codegen / nv50_ir_print.cpp
index ab39f9fdf6302a46d042f986855a42ef7bf07c63..5dcbf3c3e0c2449682dabb3489db5076ae0408cb 100644 (file)
@@ -86,6 +86,7 @@ const char *operationStr[OP_LAST + 1] =
    "fma",
    "sad",
    "shladd",
+   "xmad",
    "abs",
    "neg",
    "not",
@@ -217,7 +218,7 @@ static const char *shflOpStr[] =
 
 static const char *pixldOpStr[] =
 {
-   "count", "covmask", "offset", "cent_offset", "sampleid"
+   "count", "covmask", "covered", "offset", "cent_offset", "sampleid"
 };
 
 static const char *rcprsqOpStr[] =
@@ -240,6 +241,11 @@ static const char *barOpStr[] =
    "sync", "arrive", "red and", "red or", "red popc"
 };
 
+static const char *xmadOpCModeStr[] =
+{
+   "clo", "chi", "csfu", "cbcc"
+};
+
 static const char *DataTypeStr[] =
 {
    "-",
@@ -306,6 +312,7 @@ static const char *SemanticStr[SV_LAST + 1] =
    "TESS_INNER",
    "TESS_COORD",
    "TID",
+   "COMBINED_TID",
    "CTAID",
    "NTID",
    "GRIDID",
@@ -352,6 +359,31 @@ static const char *interpStr[16] =
    "samp sc"
 };
 
+static const char *texMaskStr[16] =
+{
+   "____",
+   "r___",
+   "_g__",
+   "rg__",
+   "__b_",
+   "r_b_",
+   "_gb_",
+   "rgb_",
+   "___a",
+   "r__a",
+   "_g_a",
+   "rg_a",
+   "__ba",
+   "r_ba",
+   "_gba",
+   "rgba",
+};
+
+static const char *gatherCompStr[4] =
+{
+   "r", "g", "b", "a",
+};
+
 #define PRINT(args...)                                \
    do {                                               \
       pos += snprintf(&buf[pos], size - pos, args);   \
@@ -580,7 +612,10 @@ void Instruction::print() const
       if (asFlow()->target.bb)
          PRINT(" %sBB:%i", colour[TXT_BRA], asFlow()->target.bb->getId());
    } else {
-      PRINT("%s ", operationStr[op]);
+      if (asTex())
+         PRINT("%s%s ", operationStr[op], asTex()->tex.scalar ? "s" : "");
+      else
+         PRINT("%s ", operationStr[op]);
       if (op == OP_LINTERP || op == OP_PINTERP)
          PRINT("%s ", interpStr[ipa]);
       switch (op) {
@@ -624,6 +659,19 @@ void Instruction::print() const
          if (subOp < ARRAY_SIZE(barOpStr))
             PRINT("%s ", barOpStr[subOp]);
          break;
+      case OP_XMAD: {
+         if (subOp & NV50_IR_SUBOP_XMAD_PSL)
+            PRINT("psl ");
+         if (subOp & NV50_IR_SUBOP_XMAD_MRG)
+            PRINT("mrg ");
+         unsigned cmode = (subOp & NV50_IR_SUBOP_XMAD_CMODE_MASK);
+         cmode >>= NV50_IR_SUBOP_XMAD_CMODE_SHIFT;
+         if (cmode && cmode <= ARRAY_SIZE(xmadOpCModeStr))
+            PRINT("%s ", xmadOpCModeStr[cmode - 1]);
+         for (int i = 0; i < 2; i++)
+            PRINT("h%d ", (subOp & NV50_IR_SUBOP_XMAD_H1(i)) ? 1 : 0);
+         break;
+      }
       default:
          if (subOp)
             PRINT("(SUBOP:%u) ", subOp);
@@ -631,10 +679,14 @@ void Instruction::print() const
       }
       if (perPatch)
          PRINT("patch ");
-      if (asTex())
-         PRINT("%s %s$r%u $s%u %s", asTex()->tex.target.getName(),
-               colour[TXT_MEM], asTex()->tex.r, asTex()->tex.s,
-               colour[TXT_INSN]);
+      if (asTex()) {
+         PRINT("%s %s$r%u $s%u ", asTex()->tex.target.getName(),
+               colour[TXT_MEM], asTex()->tex.r, asTex()->tex.s);
+         if (op == OP_TXG)
+            PRINT("%s ", gatherCompStr[asTex()->tex.gatherComp]);
+         PRINT("%s %s", texMaskStr[asTex()->tex.mask], colour[TXT_INSN]);
+      }
+
       if (postFactor)
          PRINT("x2^%i ", postFactor);
       PRINT("%s%s", dnz ? "dnz " : (ftz ? "ftz " : ""),  DataTypeStr[dType]);