示例#1
0
void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, int depth)
{
    int size = node->getType().computeNumComponents();

    for (int i = 0; i < size; i++) {
        OutputTreeText(out, node, depth);
        switch (constUnion[i].getType()) {
        case EbtBool:
            if (constUnion[i].getBConst())
                out.debug << "true";
            else
                out.debug << "false";

            out.debug << " (" << "const bool" << ")";

            out.debug << "\n";
            break;
        case EbtFloat:
        case EbtDouble:
            {
                const double value = constUnion[i].getDConst();
                // Print infinity in a portable way, for test stability.
                // Other cases may be needed in the future: negative infinity,
                // and NaNs.
                if (is_positive_infinity(value))
                    out.debug << "inf\n";
                else {
                    const int maxSize = 300;
                    char buf[maxSize];
                    snprintf(buf, maxSize, "%f", value);

                    out.debug << buf << "\n";
                }
            }
            break;
        case EbtInt:
            {
                const int maxSize = 300;
                char buf[maxSize];
                snprintf(buf, maxSize, "%d (%s)", constUnion[i].getIConst(), "const int");

                out.debug << buf << "\n";
            }
            break;
        case EbtUint:
            {
                const int maxSize = 300;
                char buf[maxSize];
                snprintf(buf, maxSize, "%u (%s)", constUnion[i].getUConst(), "const uint");

                out.debug << buf << "\n";
            }
            break;
        default:
            out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc());
            break;
        }
    }
}
示例#2
0
bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop *node)
{
    TInfoSinkBase &out = sink;

    OutputTreeText(out, node, mDepth);

    out << "Loop with condition ";
    if (node->getType() == ELoopDoWhile)
        out << "not ";
    out << "tested first\n";

    ++mDepth;

    OutputTreeText(sink, node, mDepth);
    if (node->getCondition())
    {
        out << "Loop Condition\n";
        node->getCondition()->traverse(this);
    }
    else
    {
        out << "No loop condition\n";
    }

    OutputTreeText(sink, node, mDepth);
    if (node->getBody())
    {
        out << "Loop Body\n";
        node->getBody()->traverse(this);
    }
    else
    {
        out << "No loop body\n";
    }

    if (node->getExpression())
    {
        OutputTreeText(sink, node, mDepth);
        out << "Loop Terminal Expression\n";
        node->getExpression()->traverse(this);
    }

    --mDepth;

    return false;
}
示例#3
0
bool OutputCase(bool /* preVisit */, TIntermCase* node, TIntermTraverser* it)
{
    TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
    TInfoSink& out = oit->infoSink;

    OutputExtensionText(out, node);
    OutputTreeText(out, node, oit->depth);

    out.debug << "Case";
    out.debug << " (" << node->getCompleteString() << ")";
    OutputDebugText(out, node);
    out.debug << "\n";

#if DEBUG_SCOPE == 1
    OutputScopeText(oit->infoSink, node, oit->depth);
#endif
#if DEBUG_CHANGEABLE == 1
    OutputChangeableText(oit->infoSink, node, oit->depth, 0);
#endif

    ++oit->depth;
    if (node->getExpression()) {
        node->getExpression()->traverse(it);
    } else {
        OutputExtensionText(out, node);
        OutputTreeText(out, node, oit->depth);
        out.debug << "Default Case\n" ;
    }

    OutputExtensionText(out, node);
    OutputTreeText(out, node, oit->depth);
    out.debug << "Body\n";

    ++oit->depth;
    if (node->getCaseBody()) {
        node->getCaseBody()->traverse(it);
    }

    --oit->depth;
    --oit->depth;



    return false;
}
示例#4
0
void TOutputTraverser::visitSymbol(TIntermSymbol* node)
{
    OutputTreeText(infoSink, node, depth);

    infoSink.debug << "'" << node->getName() << "' (" << node->getCompleteString() << ")\n";

    if (! node->getConstArray().empty())
        OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1);
}
示例#5
0
bool OutputSwitch(bool /* preVisit */, TIntermSwitch* node, TIntermTraverser* it)
{
    TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
    TInfoSink& out = oit->infoSink;

    OutputExtensionText(out, node);
    OutputTreeText(out, node, oit->depth);

    out.debug << "Test condition and switch";
    out.debug << " (" << node->getCompleteString() << ")";
    OutputDebugText(out, node);
    out.debug << " <<";
    out.debug << getDbgSelectionStatus(node->getDbgInternalState());
    out.debug << ">>\n";

#if DEBUG_SCOPE == 1
    OutputScopeText(oit->infoSink, node, oit->depth);
#endif
#if DEBUG_CHANGEABLE == 1
    OutputChangeableText(oit->infoSink, node, oit->depth, 0);
#endif

    ++oit->depth;

    OutputExtensionText(out, node);
    OutputTreeText(oit->infoSink, node, oit->depth);
    out.debug << "Condition\n";
    ++oit->depth;
    node->getCondition()->traverse(it);
    --oit->depth;

    OutputExtensionText(out, node);
    OutputTreeText(oit->infoSink, node, oit->depth);
    out.debug << "Case List\n";
    ++oit->depth;
    if (node->getCaseList()) {
        node->getCaseList()->traverse(it);
    }
    --oit->depth;

    --oit->depth;

    return false;
}
示例#6
0
bool OutputLoop(bool, /* preVisit */ TIntermLoop* node, TIntermTraverser* it)
{
   TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
   TInfoSink& out = oit->infoSink;

   OutputTreeText(out, node, oit->depth);

   out.debug << "Loop with condition ";
   if (! node->testFirst())
      out.debug << "not ";
   out.debug << "tested first\n";

   ++oit->depth;

   OutputTreeText(oit->infoSink, node, oit->depth);
   if (node->getTest())
   {
      out.debug << "Loop Condition\n";
      node->getTest()->traverse(it);
   }
   else
      out.debug << "No loop condition\n";

   OutputTreeText(oit->infoSink, node, oit->depth);
   if (node->getBody())
   {
      out.debug << "Loop Body\n";
      node->getBody()->traverse(it);
   }
   else
      out.debug << "No loop body\n";

   if (node->getTerminal())
   {
      OutputTreeText(oit->infoSink, node, oit->depth);
      out.debug << "Loop Terminal Expression\n";
      node->getTerminal()->traverse(it);
   }

   --oit->depth;

   return false;
}
示例#7
0
void OutputFuncDeclaration(TIntermFuncDeclaration* node, TIntermTraverser* it)
{
    TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
    TInfoSink& out = oit->infoSink;

    OutputExtensionText(out, node);
    OutputTreeText(out, node, oit->depth);
    out.debug << "Function Declaration: " <<
              node->getFunction()->getMangledName() << "\n" ;
}
示例#8
0
void OutputSymbol(TIntermSymbol* node, TIntermTraverser* it)
{
   TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);

   OutputTreeText(oit->infoSink, node, oit->depth);

   char buf[100];
   sprintf(buf, "'%s' (%s)\n",
           node->getSymbol().c_str(),
           node->getCompleteString().c_str());

   oit->infoSink.debug << buf;
}
示例#9
0
bool TOutputTraverser::visitSwitch(TVisit /* visit */, TIntermSwitch* node)
{
    TInfoSink& out = infoSink;

    OutputTreeText(out, node, depth);
    out.debug << "switch\n";

    OutputTreeText(out, node, depth);
    out.debug << "condition\n";
    ++depth;
    node->getCondition()->traverse(this);

    --depth;
    OutputTreeText(out, node, depth);
    out.debug << "body\n";
    ++depth;
    node->getBody()->traverse(this);

    --depth;

    return false;
}
示例#10
0
void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, int depth)
{
    int size = node->getType().computeNumComponents();

    for (int i = 0; i < size; i++) {
        OutputTreeText(out, node, depth);
        switch (constUnion[i].getType()) {
        case EbtBool:
            if (constUnion[i].getBConst())
                out.debug << "true";
            else
                out.debug << "false";

            out.debug << " (" << "const bool" << ")";

            out.debug << "\n";
            break;
        case EbtFloat:
        case EbtDouble:
            {
                const int maxSize = 300;
                char buf[maxSize];
                snprintf(buf, maxSize, "%f", constUnion[i].getDConst());

                out.debug << buf << "\n";
            }
            break;
        case EbtInt:
            {
                const int maxSize = 300;
                char buf[maxSize];
                snprintf(buf, maxSize, "%d (%s)", constUnion[i].getIConst(), "const int");

                out.debug << buf << "\n";
            }
            break;
        case EbtUint:
            {
                const int maxSize = 300;
                char buf[maxSize];
                snprintf(buf, maxSize, "%u (%s)", constUnion[i].getUConst(), "const uint");

                out.debug << buf << "\n";
            }
            break;
        default:
            out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc());
            break;
        }
    }
}
bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
{
    TInfoSinkBase& out = sink;

    OutputTreeText(out, node, depth);

    switch (node->getOp()) {
        case EOpAssign:                   out << "move second child to first child";           break;
        case EOpInitialize:               out << "initialize first child with second child";   break;
        case EOpAddAssign:                out << "add second child into first child";          break;
        case EOpSubAssign:                out << "subtract second child into first child";     break;
        case EOpMulAssign:                out << "multiply second child into first child";     break;
        case EOpVectorTimesMatrixAssign:  out << "matrix mult second child into first child";  break;
        case EOpVectorTimesScalarAssign:  out << "vector scale second child into first child"; break;
        case EOpMatrixTimesScalarAssign:  out << "matrix scale second child into first child"; break;
        case EOpMatrixTimesMatrixAssign:  out << "matrix mult second child into first child"; break;
        case EOpDivAssign:                out << "divide second child into first child";       break;
        case EOpIndexDirect:   out << "direct index";   break;
        case EOpIndexIndirect: out << "indirect index"; break;
        case EOpIndexDirectStruct:   out << "direct index for structure";   break;
        case EOpVectorSwizzle: out << "vector swizzle"; break;

        case EOpAdd:    out << "add";                     break;
        case EOpSub:    out << "subtract";                break;
        case EOpMul:    out << "component-wise multiply"; break;
        case EOpDiv:    out << "divide";                  break;
        case EOpEqual:            out << "Compare Equal";                 break;
        case EOpNotEqual:         out << "Compare Not Equal";             break;
        case EOpLessThan:         out << "Compare Less Than";             break;
        case EOpGreaterThan:      out << "Compare Greater Than";          break;
        case EOpLessThanEqual:    out << "Compare Less Than or Equal";    break;
        case EOpGreaterThanEqual: out << "Compare Greater Than or Equal"; break;

        case EOpVectorTimesScalar: out << "vector-scale";          break;
        case EOpVectorTimesMatrix: out << "vector-times-matrix";   break;
        case EOpMatrixTimesVector: out << "matrix-times-vector";   break;
        case EOpMatrixTimesScalar: out << "matrix-scale";          break;
        case EOpMatrixTimesMatrix: out << "matrix-multiply";       break;

        case EOpLogicalOr:  out << "logical-or";   break;
        case EOpLogicalXor: out << "logical-xor"; break;
        case EOpLogicalAnd: out << "logical-and"; break;
        default: out << "<unknown op>";
    }

    out << " (" << node->getCompleteString() << ")";

    out << "\n";

    return true;
}
示例#12
0
void TOutputTraverser::visitSymbol(TIntermSymbol* node)
{
    OutputTreeText(infoSink, node, depth);

    infoSink.debug << "'" << node->getName() << "' (" << node->getCompleteString() << ")\n";

    if (! node->getConstArray().empty())
        OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1);
    else if (node->getConstSubtree()) {
        incrementDepth(node);
        node->getConstSubtree()->traverse(this);
        decrementDepth();
    }
}
示例#13
0
void TOutputTraverser::visitSymbol(TIntermSymbol* node)
{
    OutputTreeText(infoSink, node, depth);

    const int maxSize = GlslangMaxTypeLength + GlslangMaxTokenLength;
    char buf[maxSize];
    snprintf(buf, maxSize, "'%s' (%s)\n",
             node->getName().c_str(),
             node->getCompleteString().c_str());
    infoSink.debug << buf;

    if (! node->getConstArray().empty())
        OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1);
}
示例#14
0
bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection *node)
{
    TInfoSinkBase &out = sink;

    OutputTreeText(out, node, mDepth);

    out << "Test condition and select";
    out << " (" << node->getCompleteString() << ")\n";

    ++mDepth;

    OutputTreeText(sink, node, mDepth);
    out << "Condition\n";
    node->getCondition()->traverse(this);

    OutputTreeText(sink, node, mDepth);
    if (node->getTrueBlock())
    {
        out << "true case\n";
        node->getTrueBlock()->traverse(this);
    }
    else
    {
        out << "true case is null\n";
    }

    if (node->getFalseBlock())
    {
        OutputTreeText(sink, node, mDepth);
        out << "false case\n";
        node->getFalseBlock()->traverse(this);
    }

    --mDepth;

    return false;
}
示例#15
0
bool TOutputTraverser::visitLoop(TVisit /* visit */, TIntermLoop* node)
{
    TInfoSink& out = infoSink;

    OutputTreeText(out, node, depth);

    out.debug << "Loop with condition ";
    if (! node->testFirst())
        out.debug << "not ";
    out.debug << "tested first\n";

    ++depth;

    OutputTreeText(infoSink, node, depth);
    if (node->getTest()) {
        out.debug << "Loop Condition\n";
        node->getTest()->traverse(this);
    } else
        out.debug << "No loop condition\n";

    OutputTreeText(infoSink, node, depth);
    if (node->getBody()) {
        out.debug << "Loop Body\n";
        node->getBody()->traverse(this);
    } else
        out.debug << "No loop body\n";

    if (node->getTerminal()) {
        OutputTreeText(infoSink, node, depth);
        out.debug << "Loop Terminal Expression\n";
        node->getTerminal()->traverse(this);
    }

    --depth;

    return false;
}
示例#16
0
bool OutputSelection(bool, /* preVisit */ TIntermSelection* node, TIntermTraverser* it)
{
   TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
   TInfoSink& out = oit->infoSink;

   OutputTreeText(out, node, oit->depth);

   out.debug << "ternary ?:";
   out.debug << " (" << node->getCompleteString() << ")\n";

   ++oit->depth;

   OutputTreeText(oit->infoSink, node, oit->depth);
   out.debug << "Condition\n";
   node->getCondition()->traverse(it);

   OutputTreeText(oit->infoSink, node, oit->depth);
   if (node->getTrueBlock())
   {
      out.debug << "true case\n";
      node->getTrueBlock()->traverse(it);
   }
   else
      out.debug << "true case is null\n";

   if (node->getFalseBlock())
   {
      OutputTreeText(oit->infoSink, node, oit->depth);
      out.debug << "false case\n";
      node->getFalseBlock()->traverse(it);
   }

   --oit->depth;

   return false;
}
示例#17
0
文件: intermOut.cpp 项目: servo/angle
bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node)
{
    TInfoSinkBase &out = sink;

    OutputTreeText(out, node, mDepth);

    out << "If test\n";

    ++mDepth;

    OutputTreeText(sink, node, mDepth);
    out << "Condition\n";
    node->getCondition()->traverse(this);

    OutputTreeText(sink, node, mDepth);
    if (node->getTrueBlock())
    {
        out << "true case\n";
        node->getTrueBlock()->traverse(this);
    }
    else
    {
        out << "true case is null\n";
    }

    if (node->getFalseBlock())
    {
        OutputTreeText(sink, node, mDepth);
        out << "false case\n";
        node->getFalseBlock()->traverse(this);
    }

    --mDepth;

    return false;
}
示例#18
0
void OutputDummy(TIntermDummy* node, TIntermTraverser* it)
{
    TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
    TInfoSink& out = oit->infoSink;

    OutputExtensionText(out, node);
    OutputTreeText(out, node, oit->depth);

    out.debug << "dummy ";

    OutputDebugText(out, node);
    out.debug << "\n";

#if DEBUG_CHANGEABLE == 1
    OutputChangeableText(oit->infoSink, node, oit->depth, 0);
#endif
}
示例#19
0
void OutputFuncParam(TIntermFuncParam* node, TIntermTraverser* it)
{
    TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);

    OutputExtensionText(oit->infoSink, node);
    OutputTreeText(oit->infoSink, node, oit->depth);

    char buf[100];
    sprintf(buf, "fparam '%s' (%s)\n",
            node->getSymbol().c_str(),
            node->getCompleteString().c_str());

    oit->infoSink.debug << buf;

#if DEBUG_CHANGEABLE == 1
    OutputChangeableText(oit->infoSink, node, oit->depth, 0);
#endif
}
示例#20
0
void OutputConstantUnion(TIntermConstantUnion* node, TIntermTraverser* it)
{
   TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
   TInfoSink& out = oit->infoSink;

   int size = node->getType().getObjectSize();

   for (int i = 0; i < size; i++)
   {
      OutputTreeText(out, node, oit->depth);
      switch (node->getUnionArrayPointer()[i].getType())
      {
      case EbtBool:
         if (node->getUnionArrayPointer()[i].getBConst())
            out.debug << "true";
         else
            out.debug << "false";

         out.debug << " (" << "const bool" << ")";

         out.debug << "\n";
         break;
      case EbtFloat:
         {
            char buf[300];
            sprintf(buf, "%f (%s)", node->getUnionArrayPointer()[i].getFConst(), "const float");

            out.debug << buf << "\n";           
         }
         break;
      case EbtInt:
         {
            char buf[300];
            sprintf(buf, "%d (%s)", node->getUnionArrayPointer()[i].getIConst(), "const int");

            out.debug << buf << "\n";
            break;
         }
      default: 
         out.info.message(EPrefixInternalError, "Unknown constant", node->getLine());
         break;
      }
   }
}
示例#21
0
void OutputConstant(TIntermConstant* node, TIntermTraverser* it)
{
   TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
   TInfoSink& out = oit->infoSink;

   int size = node->getCount();

   for (int i = 0; i < size; i++)
   {
      OutputTreeText(out, node, oit->depth);
      switch (node->getValue(i).type)
      {
      case EbtBool:
         if (node->toBool(i))
            out.debug << "true";
         else
            out.debug << "false";

         out.debug << " (" << "const bool" << ")";

         out.debug << "\n";
         break;
      case EbtFloat:
         {
            char buf[300];
            sprintf(buf, "%f (%s)", node->toFloat(i), "const float");

            out.debug << buf << "\n";
         }
         break;
      case EbtInt:
         {
            char buf[300];
            sprintf(buf, "%d (%s)", node->toInt(i), "const int");

            out.debug << buf << "\n";
            break;
         }
      default: 
         out.info.message(EPrefixInternalError, "Unknown constant", node->getLine());
         break;
      }
   }
}
示例#22
0
void OutputParameter(TIntermParameter* node, TIntermTraverser* it)
{
    TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
    TInfoSink& out = oit->infoSink;

    OutputExtensionText(out, node);
    OutputTreeText(out, node, oit->depth);

    TType* t = node->getType();

    if (t->getBasicType() != EbtStruct) {
        out.debug << "param '" << t->getFieldName() << "' (" <<
                  t->getCompleteString() << ")\n";
    } else {
        out.debug << "param '" << t->getFieldName() << "' (" <<
                  t->getCompleteString() << " '" <<
                  t->getTypeName() << "')\n";
    }
}
示例#23
0
bool OutputBranch(bool /* previsit*/, TIntermBranch* node, TIntermTraverser* it)
{
    TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
    TInfoSink& out = oit->infoSink;

    OutputExtensionText(out, node);
    OutputTreeText(out, node, oit->depth);

    switch (node->getFlowOp()) {
    case EOpKill:
        out.debug << "Branch: Kill";
        break;
    case EOpBreak:
        out.debug << "Branch: Break";
        break;
    case EOpContinue:
        out.debug << "Branch: Continue";
        break;
    case EOpReturn:
        out.debug << "Branch: Return";
        break;
    default:
        out.debug << "Branch: Unknown Branch";
        break;
    }

    if (node->getExpression()) {
        out.debug << " with expression";
        OutputDebugText(out, node);
        out.debug << "\n";

#if DEBUG_SCOPE == 1
        OutputScopeText(oit->infoSink, node, oit->depth);
#endif

        ++oit->depth;
        node->getExpression()->traverse(it);
        --oit->depth;
    } else
        out.debug << "\n";

    return false;
}
示例#24
0
bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch *node)
{
    TInfoSinkBase &out = sink;

    OutputTreeText(out, node, mDepth);

    switch (node->getFlowOp())
    {
    case EOpKill:
        out << "Branch: Kill";
        break;
    case EOpBreak:
        out << "Branch: Break";
        break;
    case EOpContinue:
        out << "Branch: Continue";
        break;
    case EOpReturn:
        out << "Branch: Return";
        break;
    default:
        out << "Branch: Unknown Branch";
        break;
    }

    if (node->getExpression())
    {
        out << " with expression\n";
        ++mDepth;
        node->getExpression()->traverse(this);
        --mDepth;
    }
    else
    {
        out << "\n";
    }

    return false;
}
示例#25
0
void TOutputTraverser::visitConstantUnion(TIntermConstantUnion *node)
{
    TInfoSinkBase &out = sink;

    size_t size = node->getType().getObjectSize();

    for (size_t i = 0; i < size; i++)
    {
        OutputTreeText(out, node, mDepth);
        switch (node->getUnionArrayPointer()[i].getType())
        {
        case EbtBool:
            if (node->getUnionArrayPointer()[i].getBConst())
                out << "true";
            else
                out << "false";

            out << " (" << "const bool" << ")";
            out << "\n";
            break;
        case EbtFloat:
            out << node->getUnionArrayPointer()[i].getFConst();
            out << " (const float)\n";
            break;
        case EbtInt:
            out << node->getUnionArrayPointer()[i].getIConst();
            out << " (const int)\n";
            break;
        case EbtUInt:
            out << node->getUnionArrayPointer()[i].getUConst();
            out << " (const uint)\n";
            break;
        default:
            out.message(EPrefixInternalError, node->getLine(), "Unknown constant");
            break;
        }
    }
}
示例#26
0
bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node)
{
    TInfoSinkBase& out = sink;

    OutputTreeText(out, node, mDepth);

    switch (node->getOp())
    {
    case EOpAssign:
        out << "move second child to first child";
        break;
    case EOpInitialize:
        out << "initialize first child with second child";
        break;
    case EOpAddAssign:
        out << "add second child into first child";
        break;
    case EOpSubAssign:
        out << "subtract second child into first child";
        break;
    case EOpMulAssign:
        out << "multiply second child into first child";
        break;
    case EOpVectorTimesMatrixAssign:
        out << "matrix mult second child into first child";
        break;
    case EOpVectorTimesScalarAssign:
        out << "vector scale second child into first child";
        break;
    case EOpMatrixTimesScalarAssign:
        out << "matrix scale second child into first child";
        break;
    case EOpMatrixTimesMatrixAssign:
        out << "matrix mult second child into first child";
        break;
    case EOpDivAssign:
        out << "divide second child into first child";
        break;
    case EOpIModAssign:
        out << "modulo second child into first child";
        break;
    case EOpBitShiftLeftAssign:
        out << "bit-wise shift first child left by second child";
        break;
    case EOpBitShiftRightAssign:
        out << "bit-wise shift first child right by second child";
        break;
    case EOpBitwiseAndAssign:
        out << "bit-wise and second child into first child";
        break;
    case EOpBitwiseXorAssign:
        out << "bit-wise xor second child into first child";
        break;
    case EOpBitwiseOrAssign:
        out << "bit-wise or second child into first child";
        break;

    case EOpIndexDirect:
        out << "direct index";
        break;
    case EOpIndexIndirect:
        out << "indirect index";
        break;
    case EOpIndexDirectStruct:
        out << "direct index for structure";
        break;
    case EOpIndexDirectInterfaceBlock:
        out << "direct index for interface block";
        break;
    case EOpVectorSwizzle:
        out << "vector swizzle";
        break;

    case EOpAdd:
        out << "add";
        break;
    case EOpSub:
        out << "subtract";
        break;
    case EOpMul:
        out << "component-wise multiply";
        break;
    case EOpDiv:
        out << "divide";
        break;
    case EOpIMod:
        out << "modulo";
        break;
    case EOpBitShiftLeft:
        out << "bit-wise shift left";
        break;
    case EOpBitShiftRight:
        out << "bit-wise shift right";
        break;
    case EOpBitwiseAnd:
        out << "bit-wise and";
        break;
    case EOpBitwiseXor:
        out << "bit-wise xor";
        break;
    case EOpBitwiseOr:
        out << "bit-wise or";
        break;

    case EOpEqual:
        out << "Compare Equal";
        break;
    case EOpNotEqual:
        out << "Compare Not Equal";
        break;
    case EOpLessThan:
        out << "Compare Less Than";
        break;
    case EOpGreaterThan:
        out << "Compare Greater Than";
        break;
    case EOpLessThanEqual:
        out << "Compare Less Than or Equal";
        break;
    case EOpGreaterThanEqual:
        out << "Compare Greater Than or Equal";
        break;

    case EOpVectorTimesScalar:
        out << "vector-scale";
        break;
    case EOpVectorTimesMatrix:
        out << "vector-times-matrix";
        break;
    case EOpMatrixTimesVector:
        out << "matrix-times-vector";
        break;
    case EOpMatrixTimesScalar:
        out << "matrix-scale";
        break;
    case EOpMatrixTimesMatrix:
        out << "matrix-multiply";
        break;

    case EOpLogicalOr:
        out << "logical-or";
        break;
    case EOpLogicalXor:
        out << "logical-xor";
        break;
    case EOpLogicalAnd:
        out << "logical-and";
        break;
    default:
        out << "<unknown op>";
    }

    out << " (" << node->getCompleteString() << ")";

    out << "\n";

    // Special handling for direct indexes. Because constant
    // unions are not aware they are struct indexes, treat them
    // here where we have that contextual knowledge.
    if (node->getOp() == EOpIndexDirectStruct ||
            node->getOp() == EOpIndexDirectInterfaceBlock)
    {
        mDepth++;
        node->getLeft()->traverse(this);
        mDepth--;

        TIntermConstantUnion *intermConstantUnion = node->getRight()->getAsConstantUnion();
        ASSERT(intermConstantUnion);

        OutputTreeText(out, intermConstantUnion, mDepth + 1);

        // The following code finds the field name from the constant union
        const ConstantUnion *constantUnion = intermConstantUnion->getUnionArrayPointer();
        const TStructure *structure = node->getLeft()->getType().getStruct();
        const TInterfaceBlock *interfaceBlock = node->getLeft()->getType().getInterfaceBlock();
        ASSERT(structure || interfaceBlock);

        const TFieldList &fields = structure ? structure->fields() : interfaceBlock->fields();

        const TField *field = fields[constantUnion->getIConst()];

        out << constantUnion->getIConst() << " (field '" << field->name() << "')";

        return false;
    }

    return true;
}
示例#27
0
bool OutputAggregate(bool, /* preVisit */ TIntermAggregate* node, TIntermTraverser* it)
{
   TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
   TInfoSink& out = oit->infoSink;

   if (node->getOp() == EOpNull)
   {
      out.debug.message(EPrefixError, "node is still EOpNull!");
      return true;
   }

   OutputTreeText(out, node, oit->depth);

   switch (node->getOp())
   {
   case EOpSequence:      out.debug << "Sequence\n"; return true;
   case EOpComma:         out.debug << "Comma\n"; return true;
   case EOpFunction:      out.debug << "Func Def: " << node->getName(); break;
   case EOpFunctionCall:  out.debug << "Func Call: " << node->getName(); break;
   case EOpParameters:    out.debug << "Func Params: ";              break;

   case EOpConstructFloat: out.debug << "Construct float"; break;
   case EOpConstructVec2:  out.debug << "Construct vec2";  break;
   case EOpConstructVec3:  out.debug << "Construct vec3";  break;
   case EOpConstructVec4:  out.debug << "Construct vec4";  break;
   case EOpConstructBool:  out.debug << "Construct bool";  break;
   case EOpConstructBVec2: out.debug << "Construct bvec2"; break;
   case EOpConstructBVec3: out.debug << "Construct bvec3"; break;
   case EOpConstructBVec4: out.debug << "Construct bvec4"; break;
   case EOpConstructInt:   out.debug << "Construct int";   break;
   case EOpConstructIVec2: out.debug << "Construct ivec2"; break;
   case EOpConstructIVec3: out.debug << "Construct ivec3"; break;
   case EOpConstructIVec4: out.debug << "Construct ivec4"; break;
   case EOpConstructMat2:  out.debug << "Construct mat2";  break;
   case EOpConstructMat3:  out.debug << "Construct mat3";  break;
   case EOpConstructMat4:  out.debug << "Construct mat4";  break;
   case EOpConstructStruct:  out.debug << "Construct struc";  break;

   case EOpLessThan:         out.debug << "Compare Less Than";             break;
   case EOpGreaterThan:      out.debug << "Compare Greater Than";          break;
   case EOpLessThanEqual:    out.debug << "Compare Less Than or Equal";    break;
   case EOpGreaterThanEqual: out.debug << "Compare Greater Than or Equal"; break;
   case EOpVectorEqual:      out.debug << "Equal";                         break;
   case EOpVectorNotEqual:   out.debug << "NotEqual";                      break;

   case EOpMod:           out.debug << "mod";         break;
   case EOpPow:           out.debug << "pow";         break;

   case EOpAtan:          out.debug << "atan"; break;
   case EOpAtan2:         out.debug << "atan2"; break;

   case EOpSinCos:        out.debug << "sincos";      break;

   case EOpMin:           out.debug << "min";         break;
   case EOpMax:           out.debug << "max";         break;
   case EOpClamp:         out.debug << "clamp";       break;
   case EOpMix:           out.debug << "mix";         break;
   case EOpStep:          out.debug << "step";        break;
   case EOpSmoothStep:    out.debug << "smoothstep";  break;
   case EOpLit:           out.debug << "lit";  break;

   case EOpDistance:      out.debug << "distance";                break;
   case EOpDot:           out.debug << "dot";             break;
   case EOpCross:         out.debug << "cross";           break;
   case EOpFaceForward:   out.debug << "faceforward";            break;
   case EOpReflect:       out.debug << "reflect";                 break;
   case EOpRefract:       out.debug << "refract";                 break;
   case EOpMul:           out.debug << "mul";                     break;

   case EOpItof:          out.debug << "itof";        break;
   case EOpFtoi:          out.debug << "ftoi";        break;
   case EOpSkipPixels:    out.debug << "skipPixels";  break;
   case EOpReadInput:     out.debug << "readInput";   break;
   case EOpWritePixel:    out.debug << "writePixel";  break;
   case EOpBitmapLsb:     out.debug << "bitmapLSB";   break;
   case EOpBitmapMsb:     out.debug << "bitmapMSB";   break;
   case EOpWriteOutput:   out.debug << "writeOutput"; break;
   case EOpReadPixel:     out.debug << "readPixel";   break;

   case EOpTex1D:		out.debug << "tex1D"; break;
   case EOpTex1DProj:	out.debug << "tex1Dproj"; break;
   case EOpTex1DLod:	out.debug << "tex1Dlod"; break;
   case EOpTex1DBias:	out.debug << "tex1Dbias"; break;
   case EOpTex1DGrad:	out.debug << "tex1Dgrad"; break;
   case EOpTex2D:		out.debug << "tex2D"; break;
   case EOpTex2DProj:	out.debug << "tex2Dproj"; break;
   case EOpTex2DLod:	out.debug << "tex2Dlod"; break;
   case EOpTex2DBias:	out.debug << "tex2Dbias"; break;
   case EOpTex2DGrad:	out.debug << "tex2Dgrad"; break;
   case EOpTex3D:		out.debug << "tex3D"; break;
   case EOpTex3DProj:	out.debug << "tex3Dproj"; break;
   case EOpTex3DLod:	out.debug << "tex3Dlod"; break;
   case EOpTex3DBias:	out.debug << "tex3Dbias"; break;
   case EOpTex3DGrad:	out.debug << "tex3Dgrad"; break;
   case EOpTexCube:		out.debug << "texCUBE"; break;
   case EOpTexCubeProj:	out.debug << "texCUBEproj"; break;
   case EOpTexCubeLod:	out.debug << "texCUBElod"; break;
   case EOpTexCubeBias:	out.debug << "texCUBEbias"; break;
   case EOpTexCubeGrad:	out.debug << "texCUBEgrad"; break;
   case EOpTexRect:		out.debug << "texRECT"; break;
   case EOpTexRectProj:	out.debug << "texRECTproj"; break;
 
   default: out.debug.message(EPrefixError, "Bad aggregation op");
   }

   if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
      out.debug << " (" << node->getCompleteString() << ")";

   out.debug << "\n";

   return true;
}
示例#28
0
bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
{
    TInfoSinkBase &out = sink;

    if (node->getOp() == EOpNull)
    {
        out.prefix(EPrefixError);
        out << "node is still EOpNull!";
        return true;
    }

    OutputTreeText(out, node, mDepth);

    switch (node->getOp())
    {
    case EOpSequence:
        out << "Sequence\n";
        return true;
    case EOpComma:
        out << "Comma\n";
        return true;
    case EOpFunction:
        out << "Function Definition: " << node->getName();
        break;
    case EOpFunctionCall:
        out << "Function Call: " << node->getName();
        break;
    case EOpParameters:
        out << "Function Parameters: ";
        break;
    case EOpPrototype:
        out << "Function Prototype: " << node->getName();
        break;

    case EOpConstructFloat:
        out << "Construct float";
        break;
    case EOpConstructVec2:
        out << "Construct vec2";
        break;
    case EOpConstructVec3:
        out << "Construct vec3";
        break;
    case EOpConstructVec4:
        out << "Construct vec4";
        break;
    case EOpConstructBool:
        out << "Construct bool";
        break;
    case EOpConstructBVec2:
        out << "Construct bvec2";
        break;
    case EOpConstructBVec3:
        out << "Construct bvec3";
        break;
    case EOpConstructBVec4:
        out << "Construct bvec4";
        break;
    case EOpConstructInt:
        out << "Construct int";
        break;
    case EOpConstructIVec2:
        out << "Construct ivec2";
        break;
    case EOpConstructIVec3:
        out << "Construct ivec3";
        break;
    case EOpConstructIVec4:
        out << "Construct ivec4";
        break;
    case EOpConstructUInt:
        out << "Construct uint";
        break;
    case EOpConstructUVec2:
        out << "Construct uvec2";
        break;
    case EOpConstructUVec3:
        out << "Construct uvec3";
        break;
    case EOpConstructUVec4:
        out << "Construct uvec4";
        break;
    case EOpConstructMat2:
        out << "Construct mat2";
        break;
    case EOpConstructMat3:
        out << "Construct mat3";
        break;
    case EOpConstructMat4:
        out << "Construct mat4";
        break;
    case EOpConstructStruct:
        out << "Construct structure";
        break;

    case EOpLessThan:
        out << "Compare Less Than";
        break;
    case EOpGreaterThan:
        out << "Compare Greater Than";
        break;
    case EOpLessThanEqual:
        out << "Compare Less Than or Equal";
        break;
    case EOpGreaterThanEqual:
        out << "Compare Greater Than or Equal";
        break;
    case EOpVectorEqual:
        out << "Equal";
        break;
    case EOpVectorNotEqual:
        out << "NotEqual";
        break;

    case EOpMod:
        out << "mod";
        break;
    case EOpModf:
        out << "modf";
        break;
    case EOpPow:
        out << "pow";
        break;

    case EOpAtan:
        out << "arc tangent";
        break;

    case EOpMin:
        out << "min";
        break;
    case EOpMax:
        out << "max";
        break;
    case EOpClamp:
        out << "clamp";
        break;
    case EOpMix:
        out << "mix";
        break;
    case EOpStep:
        out << "step";
        break;
    case EOpSmoothStep:
        out << "smoothstep";
        break;

    case EOpDistance:
        out << "distance";
        break;
    case EOpDot:
        out << "dot-product";
        break;
    case EOpCross:
        out << "cross-product";
        break;
    case EOpFaceForward:
        out << "face-forward";
        break;
    case EOpReflect:
        out << "reflect";
        break;
    case EOpRefract:
        out << "refract";
        break;
    case EOpMul:
        out << "component-wise multiply";
        break;

    case EOpOuterProduct:
        out << "outer product";
        break;

    case EOpDeclaration:
        out << "Declaration: ";
        break;
    case EOpInvariantDeclaration:
        out << "Invariant Declaration: ";
        break;

    default:
        out.prefix(EPrefixError);
        out << "Bad aggregation op";
    }

    if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
        out << " (" << node->getCompleteString() << ")";

    out << "\n";

    return true;
}
示例#29
0
bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary *node)
{
    TInfoSinkBase& out = sink;

    OutputTreeText(out, node, mDepth);

    switch (node->getOp())
    {
    case EOpNegative:
        out << "Negate value";
        break;
    case EOpPositive:
        out << "Positive sign";
        break;
    case EOpVectorLogicalNot:
    case EOpLogicalNot:
        out << "Negate conditional";
        break;
    case EOpBitwiseNot:
        out << "bit-wise not";
        break;

    case EOpPostIncrement:
        out << "Post-Increment";
        break;
    case EOpPostDecrement:
        out << "Post-Decrement";
        break;
    case EOpPreIncrement:
        out << "Pre-Increment";
        break;
    case EOpPreDecrement:
        out << "Pre-Decrement";
        break;

    case EOpRadians:
        out << "radians";
        break;
    case EOpDegrees:
        out << "degrees";
        break;
    case EOpSin:
        out << "sine";
        break;
    case EOpCos:
        out << "cosine";
        break;
    case EOpTan:
        out << "tangent";
        break;
    case EOpAsin:
        out << "arc sine";
        break;
    case EOpAcos:
        out << "arc cosine";
        break;
    case EOpAtan:
        out << "arc tangent";
        break;

    case EOpSinh:
        out << "hyperbolic sine";
        break;
    case EOpCosh:
        out << "hyperbolic cosine";
        break;
    case EOpTanh:
        out << "hyperbolic tangent";
        break;
    case EOpAsinh:
        out << "arc hyperbolic sine";
        break;
    case EOpAcosh:
        out << "arc hyperbolic cosine";
        break;
    case EOpAtanh:
        out << "arc hyperbolic tangent";
        break;

    case EOpExp:
        out << "exp";
        break;
    case EOpLog:
        out << "log";
        break;
    case EOpExp2:
        out << "exp2";
        break;
    case EOpLog2:
        out << "log2";
        break;
    case EOpSqrt:
        out << "sqrt";
        break;
    case EOpInverseSqrt:
        out << "inverse sqrt";
        break;

    case EOpAbs:
        out << "Absolute value";
        break;
    case EOpSign:
        out << "Sign";
        break;
    case EOpFloor:
        out << "Floor";
        break;
    case EOpCeil:
        out << "Ceiling";
        break;
    case EOpFract:
        out << "Fraction";
        break;
    case EOpIsNan:
        out << "Is not a number";
        break;
    case EOpIsInf:
        out << "Is infinity";
        break;

    case EOpFloatBitsToInt:
        out << "float bits to int";
        break;
    case EOpFloatBitsToUint:
        out << "float bits to uint";
        break;
    case EOpIntBitsToFloat:
        out << "int bits to float";
        break;
    case EOpUintBitsToFloat:
        out << "uint bits to float";
        break;

    case EOpPackSnorm2x16:
        out << "pack Snorm 2x16";
        break;
    case EOpPackUnorm2x16:
        out << "pack Unorm 2x16";
        break;
    case EOpPackHalf2x16:
        out << "pack half 2x16";
        break;

    case EOpUnpackSnorm2x16:
        out << "unpack Snorm 2x16";
        break;
    case EOpUnpackUnorm2x16:
        out << "unpack Unorm 2x16";
        break;
    case EOpUnpackHalf2x16:
        out << "unpack half 2x16";
        break;

    case EOpLength:
        out << "length";
        break;
    case EOpNormalize:
        out << "normalize";
        break;
    // case EOpDPdx:           out << "dPdx";                 break;
    // case EOpDPdy:           out << "dPdy";                 break;
    // case EOpFwidth:         out << "fwidth";               break;

    case EOpDeterminant:
        out << "determinant";
        break;
    case EOpTranspose:
        out << "transpose";
        break;
    case EOpInverse:
        out << "inverse";
        break;

    case EOpAny:
        out << "any";
        break;
    case EOpAll:
        out << "all";
        break;

    default:
        out.prefix(EPrefixError);
        out << "Bad unary op";
    }

    out << " (" << node->getCompleteString() << ")";

    out << "\n";

    return true;
}
示例#30
0
bool OutputBinary(bool, /* preVisit */ TIntermBinary* node, TIntermTraverser* it)
{
   TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
   TInfoSink& out = oit->infoSink;

   OutputTreeText(out, node, oit->depth);

   switch (node->getOp())
   {
   case EOpAssign:                   out.debug << "=";      break;
   case EOpAddAssign:                out.debug << "+=";     break;
   case EOpSubAssign:                out.debug << "-=";     break;
   case EOpMulAssign:                out.debug << "*=";     break;
   case EOpVectorTimesMatrixAssign:  out.debug << "vec *= matrix";  break;
   case EOpVectorTimesScalarAssign:  out.debug << "vec *= scalar"; break;
   case EOpMatrixTimesScalarAssign:  out.debug << "matrix *= scalar"; break;
   case EOpMatrixTimesMatrixAssign:  out.debug << "matrix *= matrix"; break;
   case EOpDivAssign:                out.debug << "/=";  break;
   case EOpModAssign:                out.debug << "%=";  break;
   case EOpAndAssign:                out.debug << "&=";  break;
   case EOpInclusiveOrAssign:        out.debug << "|=";  break;
   case EOpExclusiveOrAssign:        out.debug << "^=";  break;
   case EOpLeftShiftAssign:          out.debug << "<<="; break;
   case EOpRightShiftAssign:         out.debug << ">>="; break;

   case EOpIndexDirect:   out.debug << "index";   break;
   case EOpIndexIndirect: out.debug << "indirect index"; break;
   case EOpIndexDirectStruct:   out.debug << "struct index";   break;
   case EOpVectorSwizzle: out.debug << "swizzle"; break;

   case EOpAdd:    out.debug << "+"; break;
   case EOpSub:    out.debug << "-"; break;
   case EOpMul:    out.debug << "*"; break;
   case EOpDiv:    out.debug << "/"; break;
   case EOpMod:    out.debug << "%"; break;
   case EOpRightShift:  out.debug << ">>";  break;
   case EOpLeftShift:   out.debug << "<<";  break;
   case EOpAnd:         out.debug << "&"; break;
   case EOpInclusiveOr: out.debug << "|"; break;
   case EOpExclusiveOr: out.debug << "^"; break;
   case EOpEqual:            out.debug << "=="; break;
   case EOpNotEqual:         out.debug << "!="; break;
   case EOpLessThan:         out.debug << "<";  break;
   case EOpGreaterThan:      out.debug << ">";  break;
   case EOpLessThanEqual:    out.debug << "<="; break;
   case EOpGreaterThanEqual: out.debug << ">="; break;

   case EOpVectorTimesScalar: out.debug << "vec*scalar";    break;
   case EOpVectorTimesMatrix: out.debug << "vec*matrix";    break;
   case EOpMatrixTimesVector: out.debug << "matrix*vec";    break;
   case EOpMatrixTimesScalar: out.debug << "matrix*scalar"; break;
   case EOpMatrixTimesMatrix: out.debug << "matrix*matrix"; break;

   case EOpLogicalOr:  out.debug << "||";   break;
   case EOpLogicalXor: out.debug << "^^"; break;
   case EOpLogicalAnd: out.debug << "&&"; break;
   case EOpInitialize: out.debug << "init"; break;
   default: out.debug << "<unknown op>";
   }

   out.debug << " (" << node->getCompleteString() << ")";

   out.debug << "\n";

   return true;
}