bool TParseContext::arraySetMaxSize(TIntermSymbol *node, TType* type, int size, bool updateFlag, TSourceLoc line) { bool builtIn = false; TSymbol* symbol = symbolTable.find(node->getSymbol(), &builtIn); if (symbol == 0) { error(line, " undeclared identifier", node->getSymbol().c_str(), ""); return true; } TVariable* variable = static_cast<TVariable*>(symbol); type->setArrayInformationType(variable->getArrayInformationType()); variable->updateArrayInformationType(type); // special casing to test index value of gl_FragData. If the accessed index is >= gl_MaxDrawBuffers // its an error if (node->getSymbol() == "gl_FragData") { TSymbol* fragData = symbolTable.find("gl_MaxDrawBuffers", &builtIn); if (fragData == 0) { infoSink.info.message(EPrefixInternalError, "gl_MaxDrawBuffers not defined", line); return true; } int fragDataValue = static_cast<TVariable*>(fragData)->getConstPointer()[0].getIConst(); if (fragDataValue <= size) { error(line, "", "[", "gl_FragData can only have a max array size of up to gl_MaxDrawBuffers", ""); return true; } } // we dont want to update the maxArraySize when this flag is not set, we just want to include this // node type in the chain of node types so that its updated when a higher maxArraySize comes in. if (!updateFlag) return false; size++; variable->getType().setMaxArraySize(size); type->setMaxArraySize(size); TType* tt = type; while(tt->getArrayInformationType() != 0) { tt = tt->getArrayInformationType(); tt->setMaxArraySize(size); } return false; }