bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node) { // Check if loop index is modified in the loop body. validateOperation(node, node->getLeft()); // Check indexing. switch (node->getOp()) { case EOpIndexDirect: validateIndexing(node); break; case EOpIndexIndirect: validateIndexing(node); break; default: break; } return true; }
bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node) { // Check if loop index is modified in the loop body. validateOperation(node, node->getLeft()); // Check indexing. switch (node->getOp()) { case EOpIndexDirect: validateIndexing(node); break; case EOpIndexIndirect: #if defined(__APPLE__) // Loop unrolling is a work-around for a Mac Cg compiler bug where it // crashes when a sampler array's index is also the loop index. // Once Apple fixes this bug, we should remove the code in this CL. // See http://codereview.appspot.com/4331048/. if ((node->getLeft() != NULL) && (node->getRight() != NULL) && (node->getLeft()->getAsSymbolNode())) { TIntermSymbol* symbol = node->getLeft()->getAsSymbolNode(); if (IsSampler(symbol->getBasicType()) && symbol->isArray()) { ValidateLoopIndexExpr validate(mLoopStack); node->getRight()->traverse(&validate); if (validate.usesFloatLoopIndex()) { error(node->getLine(), "sampler array index is float loop index", "for"); } } } #endif validateIndexing(node); break; default: break; } return true; }