void EmulatePrecision::visitSymbol(TIntermSymbol *node) { TIntermNode *parent = getParentNode(); if (canRoundFloat(node->getType()) && ParentUsesResult(parent, node) && !ParentConstructorTakesCareOfRounding(parent, node) && !mDeclaringVariables && !isLValueRequiredHere()) { TIntermNode *replacement = createRoundingFunctionCallNode(node); queueReplacement(replacement, OriginalNode::BECOMES_CHILD); } }
void TLValueTrackingTraverser::traverseBinary(TIntermBinary *node) { bool visit = true; // // visit the node before children if pre-visiting. // if (preVisit) visit = visitBinary(PreVisit, node); // // Visit the children, in the right order. // if (visit) { incrementDepth(node); // Some binary operations like indexing can be inside an expression which must be an // l-value. bool parentOperatorRequiresLValue = operatorRequiresLValue(); bool parentInFunctionCallOutParameter = isInFunctionCallOutParameter(); if (node->isAssignment()) { ASSERT(!isLValueRequiredHere()); setOperatorRequiresLValue(true); } if (node->getLeft()) node->getLeft()->traverse(this); if (inVisit) visit = visitBinary(InVisit, node); if (node->isAssignment()) setOperatorRequiresLValue(false); // Index is not required to be an l-value even when the surrounding expression is required // to be an l-value. TOperator op = node->getOp(); if (op == EOpIndexDirect || op == EOpIndexDirectInterfaceBlock || op == EOpIndexDirectStruct || op == EOpIndexIndirect) { setOperatorRequiresLValue(false); setInFunctionCallOutParameter(false); } if (visit && node->getRight()) node->getRight()->traverse(this); setOperatorRequiresLValue(parentOperatorRequiresLValue); setInFunctionCallOutParameter(parentInFunctionCallOutParameter); decrementDepth(); } // // Visit the node after the children, if requested and the traversal // hasn't been cancelled yet. // if (visit && postVisit) visitBinary(PostVisit, node); }