glslang: Fix a few more warnings, and see it using nullptr causes anyone problems (testing c++11 portability).
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31218 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
		
							parent
							
								
									b06127c513
								
							
						
					
					
						commit
						ca3457f1a7
					
				@ -1119,7 +1119,7 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T
 | 
				
			|||||||
    // handle the case where the last code segment is missing, due to no code 
 | 
					    // handle the case where the last code segment is missing, due to no code 
 | 
				
			||||||
    // statements between the last case and the end of the switch statement
 | 
					    // statements between the last case and the end of the switch statement
 | 
				
			||||||
    if ((int)codeSegments.size() == valueIndexToSegment[caseValues.size() - 1])
 | 
					    if ((int)codeSegments.size() == valueIndexToSegment[caseValues.size() - 1])
 | 
				
			||||||
        codeSegments.push_back(0);
 | 
					        codeSegments.push_back(nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // make the switch statement
 | 
					    // make the switch statement
 | 
				
			||||||
    std::vector<spv::Block*> segmentBlocks; // returned, as the blocks allocated in the call
 | 
					    std::vector<spv::Block*> segmentBlocks; // returned, as the blocks allocated in the call
 | 
				
			||||||
 | 
				
			|||||||
@ -801,7 +801,7 @@ EShLanguage FindLanguage(const std::string& name)
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
void CompileFile(const char* fileName, ShHandle compiler)
 | 
					void CompileFile(const char* fileName, ShHandle compiler)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int ret;
 | 
					    int ret = 0;
 | 
				
			||||||
    char** shaderStrings = ReadFileData(fileName);
 | 
					    char** shaderStrings = ReadFileData(fileName);
 | 
				
			||||||
    if (! shaderStrings) {
 | 
					    if (! shaderStrings) {
 | 
				
			||||||
        usage();
 | 
					        usage();
 | 
				
			||||||
@ -826,12 +826,12 @@ void CompileFile(const char* fileName, ShHandle compiler)
 | 
				
			|||||||
    for (int i = 0; i < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++i) {
 | 
					    for (int i = 0; i < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++i) {
 | 
				
			||||||
        for (int j = 0; j < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++j) {
 | 
					        for (int j = 0; j < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++j) {
 | 
				
			||||||
            //ret = ShCompile(compiler, shaderStrings, NumShaderStrings, lengths, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages);
 | 
					            //ret = ShCompile(compiler, shaderStrings, NumShaderStrings, lengths, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages);
 | 
				
			||||||
            ret = ShCompile(compiler, shaderStrings, NumShaderStrings, 0, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages);
 | 
					            ret = ShCompile(compiler, shaderStrings, NumShaderStrings, nullptr, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages);
 | 
				
			||||||
            //const char* multi[12] = { "# ve", "rsion", " 300 e", "s", "\n#err", 
 | 
					            //const char* multi[12] = { "# ve", "rsion", " 300 e", "s", "\n#err", 
 | 
				
			||||||
            //                         "or should be l", "ine 1", "string 5\n", "float glo", "bal", 
 | 
					            //                         "or should be l", "ine 1", "string 5\n", "float glo", "bal", 
 | 
				
			||||||
            //                         ";\n#error should be line 2\n void main() {", "global = 2.3;}" };
 | 
					            //                         ";\n#error should be line 2\n void main() {", "global = 2.3;}" };
 | 
				
			||||||
            //const char* multi[7] = { "/", "/", "\\", "\n", "\n", "#", "version 300 es" };
 | 
					            //const char* multi[7] = { "/", "/", "\\", "\n", "\n", "#", "version 300 es" };
 | 
				
			||||||
            //ret = ShCompile(compiler, multi, 7, 0, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages);
 | 
					            //ret = ShCompile(compiler, multi, 7, nullptr, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (Options & EOptionMemoryLeakMode)
 | 
					        if (Options & EOptionMemoryLeakMode)
 | 
				
			||||||
@ -919,28 +919,28 @@ char** ReadFileData(const char* fileName)
 | 
				
			|||||||
    FILE *in;
 | 
					    FILE *in;
 | 
				
			||||||
    int errorCode = fopen_s(&in, fileName, "r");
 | 
					    int errorCode = fopen_s(&in, fileName, "r");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    char *fdata;
 | 
					 | 
				
			||||||
    int count = 0;
 | 
					    int count = 0;
 | 
				
			||||||
    const int maxSourceStrings = 5;
 | 
					    const int maxSourceStrings = 5;
 | 
				
			||||||
    char** return_data = (char**)malloc(sizeof(char *) * (maxSourceStrings+1));
 | 
					    char** return_data = (char**)malloc(sizeof(char *) * (maxSourceStrings+1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (errorCode) {
 | 
					    if (errorCode) {
 | 
				
			||||||
        printf("Error: unable to open input file: %s\n", fileName);
 | 
					        printf("Error: unable to open input file: %s\n", fileName);
 | 
				
			||||||
        return 0;
 | 
					        return nullptr;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    while (fgetc(in) != EOF)
 | 
					    while (fgetc(in) != EOF)
 | 
				
			||||||
        count++;
 | 
					        count++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fseek(in, 0, SEEK_SET);
 | 
					    fseek(in, 0, SEEK_SET);
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
    if (!(fdata = (char*)malloc(count+2))) {
 | 
					    char *fdata = (char*)malloc(count+2);
 | 
				
			||||||
 | 
					    if (! fdata) {
 | 
				
			||||||
        printf("Error allocating memory\n");
 | 
					        printf("Error allocating memory\n");
 | 
				
			||||||
        return 0;
 | 
					        return nullptr;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ((int)fread(fdata,1,count, in) != count) {
 | 
					    if ((int)fread(fdata,1,count, in) != count) {
 | 
				
			||||||
            printf("Error reading input file: %s\n", fileName);
 | 
					            printf("Error reading input file: %s\n", fileName);
 | 
				
			||||||
            return 0;
 | 
					            return nullptr;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    fdata[count] = '\0';
 | 
					    fdata[count] = '\0';
 | 
				
			||||||
    fclose(in);
 | 
					    fclose(in);
 | 
				
			||||||
 | 
				
			|||||||
@ -486,7 +486,7 @@ TIntermTyped* TParseContext::handleBracketDereference(TSourceLoc loc, TIntermTyp
 | 
				
			|||||||
            else if (base->getBasicType() == EbtSampler && version >= 130) {
 | 
					            else if (base->getBasicType() == EbtSampler && version >= 130) {
 | 
				
			||||||
                const char* explanation = "variable indexing sampler array";
 | 
					                const char* explanation = "variable indexing sampler array";
 | 
				
			||||||
                requireProfile(base->getLoc(), ECoreProfile | ECompatibilityProfile, explanation);
 | 
					                requireProfile(base->getLoc(), ECoreProfile | ECompatibilityProfile, explanation);
 | 
				
			||||||
                profileRequires(base->getLoc(), ECoreProfile | ECompatibilityProfile, 400, 0, explanation);
 | 
					                profileRequires(base->getLoc(), ECoreProfile | ECompatibilityProfile, 400, nullptr, explanation);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            result = intermediate.addIndex(EOpIndexIndirect, base, index, loc);
 | 
					            result = intermediate.addIndex(EOpIndexIndirect, base, index, loc);
 | 
				
			||||||
@ -724,7 +724,7 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped*
 | 
				
			|||||||
    if (field == "length") {
 | 
					    if (field == "length") {
 | 
				
			||||||
        if (base->isArray()) {
 | 
					        if (base->isArray()) {
 | 
				
			||||||
            profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, ".length");
 | 
					            profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, ".length");
 | 
				
			||||||
            profileRequires(loc, EEsProfile, 300, 0, ".length");
 | 
					            profileRequires(loc, EEsProfile, 300, nullptr, ".length");
 | 
				
			||||||
        } else if (base->isVector() || base->isMatrix()) {
 | 
					        } else if (base->isVector() || base->isMatrix()) {
 | 
				
			||||||
            const char* feature = ".length() on vectors and matrices";
 | 
					            const char* feature = ".length() on vectors and matrices";
 | 
				
			||||||
            requireProfile(loc, ~EEsProfile, feature);
 | 
					            requireProfile(loc, ~EEsProfile, feature);
 | 
				
			||||||
@ -841,7 +841,7 @@ TFunction* TParseContext::handleFunctionDeclarator(TSourceLoc loc, TFunction& fu
 | 
				
			|||||||
    const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0;
 | 
					    const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0;
 | 
				
			||||||
    if (prevDec) {
 | 
					    if (prevDec) {
 | 
				
			||||||
        if (prevDec->isPrototyped() && prototype)
 | 
					        if (prevDec->isPrototyped() && prototype)
 | 
				
			||||||
            profileRequires(loc, EEsProfile, 300, 0, "multiple prototypes for same function");
 | 
					            profileRequires(loc, EEsProfile, 300, nullptr, "multiple prototypes for same function");
 | 
				
			||||||
        if (prevDec->getType() != function.getType())
 | 
					        if (prevDec->getType() != function.getType())
 | 
				
			||||||
            error(loc, "overloaded functions must have the same return type", function.getType().getBasicTypeString().c_str(), "");
 | 
					            error(loc, "overloaded functions must have the same return type", function.getType().getBasicTypeString().c_str(), "");
 | 
				
			||||||
        for (int i = 0; i < prevDec->getParamCount(); ++i) {
 | 
					        for (int i = 0; i < prevDec->getParamCount(); ++i) {
 | 
				
			||||||
@ -1286,7 +1286,7 @@ void TParseContext::nonOpBuiltInCheck(TSourceLoc loc, const TFunction& fnCandida
 | 
				
			|||||||
        if (fnCandidate.getName().compare(0, 13, "textureGather") == 0) {
 | 
					        if (fnCandidate.getName().compare(0, 13, "textureGather") == 0) {
 | 
				
			||||||
            TString featureString = fnCandidate.getName() + "(...)";
 | 
					            TString featureString = fnCandidate.getName() + "(...)";
 | 
				
			||||||
            const char* feature = featureString.c_str();
 | 
					            const char* feature = featureString.c_str();
 | 
				
			||||||
            profileRequires(loc, EEsProfile, 310, 0, feature);
 | 
					            profileRequires(loc, EEsProfile, 310, nullptr, feature);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            int compArg = -1;  // track which argument, if any, is the constant component argument
 | 
					            int compArg = -1;  // track which argument, if any, is the constant component argument
 | 
				
			||||||
            if (fnCandidate.getName().compare("textureGatherOffset") == 0) {
 | 
					            if (fnCandidate.getName().compare("textureGatherOffset") == 0) {
 | 
				
			||||||
@ -1385,7 +1385,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, const TPublicTyp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (type.isArray()) {
 | 
					    if (type.isArray()) {
 | 
				
			||||||
        profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed constructor");
 | 
					        profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed constructor");
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, "arrayed constructor");
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, "arrayed constructor");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TOperator op = mapTypeToConstructorOp(type);
 | 
					    TOperator op = mapTypeToConstructorOp(type);
 | 
				
			||||||
@ -1577,7 +1577,7 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr)
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        switch (symbol->getQualifier().storage) {
 | 
					        switch (symbol->getQualifier().storage) {
 | 
				
			||||||
        case EvqPointCoord:
 | 
					        case EvqPointCoord:
 | 
				
			||||||
            profileRequires(symbol->getLoc(), ENoProfile, 120, 0, "gl_PointCoord");
 | 
					            profileRequires(symbol->getLoc(), ENoProfile, 120, nullptr, "gl_PointCoord");
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        default: break; // some compilers want this
 | 
					        default: break; // some compilers want this
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -1822,7 +1822,7 @@ bool TParseContext::lineContinuationCheck(TSourceLoc loc, bool endOfComment)
 | 
				
			|||||||
            warn(loc, "not allowed in this version", message, "");
 | 
					            warn(loc, "not allowed in this version", message, "");
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, message);
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, message);
 | 
				
			||||||
        profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, message);
 | 
					        profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1917,7 +1917,7 @@ bool TParseContext::constructorError(TSourceLoc loc, TIntermNode* node, TFunctio
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (matrixInMatrix && ! type.isArray()) {
 | 
					    if (matrixInMatrix && ! type.isArray()) {
 | 
				
			||||||
        profileRequires(loc, ENoProfile, 120, 0, "constructing matrix from matrix");
 | 
					        profileRequires(loc, ENoProfile, 120, nullptr, "constructing matrix from matrix");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // "If a matrix argument is given to a matrix constructor,
 | 
					        // "If a matrix argument is given to a matrix constructor,
 | 
				
			||||||
        // it is a compile-time error to have any other arguments."
 | 
					        // it is a compile-time error to have any other arguments."
 | 
				
			||||||
@ -2021,13 +2021,13 @@ void TParseContext::globalQualifierFixCheck(TSourceLoc loc, TQualifier& qualifie
 | 
				
			|||||||
    // move from parameter/unknown qualifiers to pipeline in/out qualifiers
 | 
					    // move from parameter/unknown qualifiers to pipeline in/out qualifiers
 | 
				
			||||||
    switch (qualifier.storage) {
 | 
					    switch (qualifier.storage) {
 | 
				
			||||||
    case EvqIn:
 | 
					    case EvqIn:
 | 
				
			||||||
        profileRequires(loc, ENoProfile, 130, 0, "in for stage inputs");
 | 
					        profileRequires(loc, ENoProfile, 130, nullptr, "in for stage inputs");
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, "in for stage inputs");
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, "in for stage inputs");
 | 
				
			||||||
        qualifier.storage = EvqVaryingIn;
 | 
					        qualifier.storage = EvqVaryingIn;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case EvqOut:
 | 
					    case EvqOut:
 | 
				
			||||||
        profileRequires(loc, ENoProfile, 130, 0, "out for stage outputs");
 | 
					        profileRequires(loc, ENoProfile, 130, nullptr, "out for stage outputs");
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, "out for stage outputs");
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, "out for stage outputs");
 | 
				
			||||||
        qualifier.storage = EvqVaryingOut;
 | 
					        qualifier.storage = EvqVaryingOut;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case EvqInOut:
 | 
					    case EvqInOut:
 | 
				
			||||||
@ -2066,7 +2066,7 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble) {
 | 
					    if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble) {
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, "shader input/output");
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output");
 | 
				
			||||||
        if (! qualifier.flat) {
 | 
					        if (! qualifier.flat) {
 | 
				
			||||||
            if (qualifier.storage == EvqVaryingIn && language == EShLangFragment)
 | 
					            if (qualifier.storage == EvqVaryingIn && language == EShLangFragment)
 | 
				
			||||||
                error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage));
 | 
					                error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage));
 | 
				
			||||||
@ -2087,7 +2087,7 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            if (publicType.arraySizes) {
 | 
					            if (publicType.arraySizes) {
 | 
				
			||||||
                requireProfile(loc, ~EEsProfile, "vertex input arrays");
 | 
					                requireProfile(loc, ~EEsProfile, "vertex input arrays");
 | 
				
			||||||
                profileRequires(loc, ENoProfile, 150, 0, "vertex input arrays");
 | 
					                profileRequires(loc, ENoProfile, 150, nullptr, "vertex input arrays");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (qualifier.isAuxiliary() || qualifier.isInterpolation() || qualifier.isMemory() || qualifier.invariant)
 | 
					            if (qualifier.isAuxiliary() || qualifier.isInterpolation() || qualifier.isMemory() || qualifier.invariant)
 | 
				
			||||||
                error(loc, "vertex input cannot be further qualified", "", "");
 | 
					                error(loc, "vertex input cannot be further qualified", "", "");
 | 
				
			||||||
@ -2106,8 +2106,8 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        case EShLangFragment:
 | 
					        case EShLangFragment:
 | 
				
			||||||
            if (publicType.userDef) {
 | 
					            if (publicType.userDef) {
 | 
				
			||||||
                profileRequires(loc, EEsProfile, 300, 0, "fragment-shader struct input");
 | 
					                profileRequires(loc, EEsProfile, 300, nullptr, "fragment-shader struct input");
 | 
				
			||||||
                profileRequires(loc, ~EEsProfile, 150, 0, "fragment-shader struct input");
 | 
					                profileRequires(loc, ~EEsProfile, 150, nullptr, "fragment-shader struct input");
 | 
				
			||||||
                if (publicType.userDef->containsStructure())
 | 
					                if (publicType.userDef->containsStructure())
 | 
				
			||||||
                    requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing structure");
 | 
					                    requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing structure");
 | 
				
			||||||
                if (publicType.userDef->containsArray())
 | 
					                if (publicType.userDef->containsArray())
 | 
				
			||||||
@ -2128,8 +2128,8 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
 | 
				
			|||||||
        switch (language) {
 | 
					        switch (language) {
 | 
				
			||||||
        case EShLangVertex:
 | 
					        case EShLangVertex:
 | 
				
			||||||
            if (publicType.userDef) {
 | 
					            if (publicType.userDef) {
 | 
				
			||||||
                profileRequires(loc, EEsProfile, 300, 0, "vertex-shader struct output");
 | 
					                profileRequires(loc, EEsProfile, 300, nullptr, "vertex-shader struct output");
 | 
				
			||||||
                profileRequires(loc, ~EEsProfile, 150, 0, "vertex-shader struct output");
 | 
					                profileRequires(loc, ~EEsProfile, 150, nullptr, "vertex-shader struct output");
 | 
				
			||||||
                if (publicType.userDef->containsStructure())
 | 
					                if (publicType.userDef->containsStructure())
 | 
				
			||||||
                    requireProfile(loc, ~EEsProfile, "vertex-shader struct output containing structure");
 | 
					                    requireProfile(loc, ~EEsProfile, "vertex-shader struct output containing structure");
 | 
				
			||||||
                if (publicType.userDef->containsArray())
 | 
					                if (publicType.userDef->containsArray())
 | 
				
			||||||
@ -2150,7 +2150,7 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case EShLangFragment:
 | 
					        case EShLangFragment:
 | 
				
			||||||
            profileRequires(loc, EEsProfile, 300, 0, "fragment shader output");
 | 
					            profileRequires(loc, EEsProfile, 300, nullptr, "fragment shader output");
 | 
				
			||||||
            if (publicType.basicType == EbtStruct) {
 | 
					            if (publicType.basicType == EbtStruct) {
 | 
				
			||||||
                error(loc, "cannot be a structure", GetStorageQualifierString(qualifier.storage), "");
 | 
					                error(loc, "cannot be a structure", GetStorageQualifierString(qualifier.storage), "");
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
@ -2377,12 +2377,12 @@ bool TParseContext::arrayQualifierError(TSourceLoc loc, const TQualifier& qualif
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (qualifier.storage == EvqConst) {
 | 
					    if (qualifier.storage == EvqConst) {
 | 
				
			||||||
        profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "const array");
 | 
					        profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "const array");
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, "const array");
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, "const array");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (qualifier.storage == EvqVaryingIn && language == EShLangVertex) {
 | 
					    if (qualifier.storage == EvqVaryingIn && language == EShLangVertex) {
 | 
				
			||||||
        requireProfile(loc, ~EEsProfile, "vertex input arrays");
 | 
					        requireProfile(loc, ~EEsProfile, "vertex input arrays");
 | 
				
			||||||
        profileRequires(loc, ENoProfile, 150, 0, "vertex input arrays");
 | 
					        profileRequires(loc, ENoProfile, 150, nullptr, "vertex input arrays");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
@ -2436,8 +2436,8 @@ void TParseContext::structArrayCheck(TSourceLoc /*loc*/, TType* type)
 | 
				
			|||||||
void TParseContext::arrayDimError(TSourceLoc loc)
 | 
					void TParseContext::arrayDimError(TSourceLoc loc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "arrays of arrays");
 | 
					    requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "arrays of arrays");
 | 
				
			||||||
    profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, "arrays of arrays");
 | 
					    profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "arrays of arrays");
 | 
				
			||||||
    profileRequires(loc, EEsProfile, 310, 0, "arrays of arrays");
 | 
					    profileRequires(loc, EEsProfile, 310, nullptr, "arrays of arrays");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TParseContext::arrayDimCheck(TSourceLoc loc, TArraySizes* sizes1, TArraySizes* sizes2)
 | 
					void TParseContext::arrayDimCheck(TSourceLoc loc, TArraySizes* sizes1, TArraySizes* sizes2)
 | 
				
			||||||
@ -2465,7 +2465,7 @@ void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TTyp
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (! symbol) {
 | 
					    if (! symbol) {
 | 
				
			||||||
        bool currentScope;
 | 
					        bool currentScope;
 | 
				
			||||||
        symbol = symbolTable.find(identifier, 0, ¤tScope);
 | 
					        symbol = symbolTable.find(identifier, nullptr, ¤tScope);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (symbol && builtInName(identifier) && ! symbolTable.atBuiltInLevel()) {
 | 
					        if (symbol && builtInName(identifier) && ! symbolTable.atBuiltInLevel()) {
 | 
				
			||||||
            // bad shader (errors already reported) trying to redeclare a built-in name as an array
 | 
					            // bad shader (errors already reported) trying to redeclare a built-in name as an array
 | 
				
			||||||
@ -2926,7 +2926,7 @@ void TParseContext::arrayObjectCheck(TSourceLoc loc, const TType& type, const ch
 | 
				
			|||||||
    // Some versions don't allow comparing arrays or structures containing arrays
 | 
					    // Some versions don't allow comparing arrays or structures containing arrays
 | 
				
			||||||
    if (type.containsArray()) {
 | 
					    if (type.containsArray()) {
 | 
				
			||||||
        profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, op);
 | 
					        profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, op);
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, op);
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, op);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3139,8 +3139,8 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    if (id == TQualifier::getLayoutPackingString(ElpStd430)) {
 | 
					    if (id == TQualifier::getLayoutPackingString(ElpStd430)) {
 | 
				
			||||||
        requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "std430");
 | 
					        requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "std430");
 | 
				
			||||||
        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, "std430");
 | 
					        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "std430");
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 310, 0, "std430");
 | 
					        profileRequires(loc, EEsProfile, 310, nullptr, "std430");
 | 
				
			||||||
        publicType.qualifier.layoutPacking = ElpStd430;
 | 
					        publicType.qualifier.layoutPacking = ElpStd430;
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -3247,14 +3247,14 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        if (id == "early_fragment_tests") {
 | 
					        if (id == "early_fragment_tests") {
 | 
				
			||||||
            profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, GL_ARB_shader_image_load_store, "early_fragment_tests");
 | 
					            profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, GL_ARB_shader_image_load_store, "early_fragment_tests");
 | 
				
			||||||
            profileRequires(loc, EEsProfile, 310, 0, "early_fragment_tests");
 | 
					            profileRequires(loc, EEsProfile, 310, nullptr, "early_fragment_tests");
 | 
				
			||||||
            publicType.shaderQualifiers.earlyFragmentTests = true;
 | 
					            publicType.shaderQualifiers.earlyFragmentTests = true;
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth+1)) {
 | 
					        for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth+1)) {
 | 
				
			||||||
            if (id == TQualifier::getLayoutDepthString(depth)) {
 | 
					            if (id == TQualifier::getLayoutDepthString(depth)) {
 | 
				
			||||||
                requireProfile(loc, ECoreProfile | ECompatibilityProfile, "depth layout qualifier");
 | 
					                requireProfile(loc, ECoreProfile | ECompatibilityProfile, "depth layout qualifier");
 | 
				
			||||||
                profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 0, "depth layout qualifier");
 | 
					                profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, nullptr, "depth layout qualifier");
 | 
				
			||||||
                publicType.shaderQualifiers.layoutDepth = depth;
 | 
					                publicType.shaderQualifiers.layoutDepth = depth;
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -3296,7 +3296,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
 | 
				
			|||||||
        requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
 | 
					        requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
 | 
				
			||||||
        const char* exts[2] = { GL_ARB_enhanced_layouts, GL_ARB_shader_atomic_counters };
 | 
					        const char* exts[2] = { GL_ARB_enhanced_layouts, GL_ARB_shader_atomic_counters };
 | 
				
			||||||
        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature);
 | 
					        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature);
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 310, 0, feature);
 | 
					        profileRequires(loc, EEsProfile, 310, nullptr, feature);
 | 
				
			||||||
        publicType.qualifier.layoutOffset = value;
 | 
					        publicType.qualifier.layoutOffset = value;
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    } else if (id == "align") {
 | 
					    } else if (id == "align") {
 | 
				
			||||||
@ -3310,7 +3310,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
 | 
				
			|||||||
            publicType.qualifier.layoutAlign = value;
 | 
					            publicType.qualifier.layoutAlign = value;
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    } else if (id == "location") {
 | 
					    } else if (id == "location") {
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, "location");
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, "location");
 | 
				
			||||||
        const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
 | 
					        const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
 | 
				
			||||||
        profileRequires(loc, ~EEsProfile, 330, 2, exts, "location");
 | 
					        profileRequires(loc, ~EEsProfile, 330, 2, exts, "location");
 | 
				
			||||||
        if ((unsigned int)value >= TQualifier::layoutLocationEnd)
 | 
					        if ((unsigned int)value >= TQualifier::layoutLocationEnd)
 | 
				
			||||||
@ -3326,7 +3326,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
    } else if (id == "binding") {
 | 
					    } else if (id == "binding") {
 | 
				
			||||||
        profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, "binding");
 | 
					        profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, "binding");
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 310, 0, "binding");
 | 
					        profileRequires(loc, EEsProfile, 310, nullptr, "binding");
 | 
				
			||||||
        if ((unsigned int)value >= TQualifier::layoutBindingEnd)
 | 
					        if ((unsigned int)value >= TQualifier::layoutBindingEnd)
 | 
				
			||||||
            error(loc, "binding is too large", id.c_str(), "");
 | 
					            error(loc, "binding is too large", id.c_str(), "");
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
@ -3395,7 +3395,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    case EShLangGeometry:
 | 
					    case EShLangGeometry:
 | 
				
			||||||
        if (id == "invocations") {
 | 
					        if (id == "invocations") {
 | 
				
			||||||
            profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, 0, "invocations");
 | 
					            profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, nullptr, "invocations");
 | 
				
			||||||
            publicType.shaderQualifiers.invocations = value;
 | 
					            publicType.shaderQualifiers.invocations = value;
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -3709,10 +3709,10 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
 | 
				
			|||||||
            if (language == EShLangVertex) {
 | 
					            if (language == EShLangVertex) {
 | 
				
			||||||
                const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
 | 
					                const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
 | 
				
			||||||
                profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
 | 
					                profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
 | 
				
			||||||
                profileRequires(loc, EEsProfile, 300, 0, feature);
 | 
					                profileRequires(loc, EEsProfile, 300, nullptr, feature);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
 | 
					                profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
 | 
				
			||||||
                profileRequires(loc, EEsProfile, 310, 0, feature);
 | 
					                profileRequires(loc, EEsProfile, 310, nullptr, feature);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -3726,10 +3726,10 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
 | 
				
			|||||||
            if (language == EShLangFragment) {
 | 
					            if (language == EShLangFragment) {
 | 
				
			||||||
                const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
 | 
					                const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
 | 
				
			||||||
                profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
 | 
					                profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
 | 
				
			||||||
                profileRequires(loc, EEsProfile, 300, 0, feature);
 | 
					                profileRequires(loc, EEsProfile, 300, nullptr, feature);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
 | 
					                profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
 | 
				
			||||||
                profileRequires(loc, EEsProfile, 310, 0, feature);
 | 
					                profileRequires(loc, EEsProfile, 310, nullptr, feature);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -3738,8 +3738,8 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            const char* feature = "location qualifier on uniform or buffer";
 | 
					            const char* feature = "location qualifier on uniform or buffer";
 | 
				
			||||||
            requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
 | 
					            requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
 | 
				
			||||||
            profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, feature);
 | 
					            profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, feature);
 | 
				
			||||||
            profileRequires(loc, EEsProfile, 310, 0, feature);
 | 
					            profileRequires(loc, EEsProfile, 310, nullptr, feature);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
@ -4011,7 +4011,7 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (initializer) {
 | 
					        if (initializer) {
 | 
				
			||||||
            profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "initializer");
 | 
					            profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "initializer");
 | 
				
			||||||
            profileRequires(loc, EEsProfile, 300, 0, "initializer");
 | 
					            profileRequires(loc, EEsProfile, 300, nullptr, "initializer");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        // non-array case
 | 
					        // non-array case
 | 
				
			||||||
@ -4463,13 +4463,13 @@ void TParseContext::declareBlock(TSourceLoc loc, TTypeList& typeList, const TStr
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    switch (currentBlockQualifier.storage) {
 | 
					    switch (currentBlockQualifier.storage) {
 | 
				
			||||||
    case EvqUniform:
 | 
					    case EvqUniform:
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 300, 0, "uniform block");
 | 
					        profileRequires(loc, EEsProfile, 300, nullptr, "uniform block");
 | 
				
			||||||
        profileRequires(loc, ENoProfile, 140, 0, "uniform block");
 | 
					        profileRequires(loc, ENoProfile, 140, nullptr, "uniform block");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case EvqBuffer:
 | 
					    case EvqBuffer:
 | 
				
			||||||
        requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "buffer block");
 | 
					        requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "buffer block");
 | 
				
			||||||
        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, "buffer block");
 | 
					        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "buffer block");
 | 
				
			||||||
        profileRequires(loc, EEsProfile, 310, 0, "buffer block");
 | 
					        profileRequires(loc, EEsProfile, 310, nullptr, "buffer block");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case EvqVaryingIn:
 | 
					    case EvqVaryingIn:
 | 
				
			||||||
        requireProfile(loc, ~EEsProfile, "input block");
 | 
					        requireProfile(loc, ~EEsProfile, "input block");
 | 
				
			||||||
@ -5072,10 +5072,10 @@ void TParseContext::wrapupSwitchSubsequence(TIntermAggregate* statements, TInter
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression, TIntermAggregate* lastStatements)
 | 
					TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression, TIntermAggregate* lastStatements)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    profileRequires(loc, EEsProfile, 300, 0, "switch statements");
 | 
					    profileRequires(loc, EEsProfile, 300, nullptr, "switch statements");
 | 
				
			||||||
    profileRequires(loc, ENoProfile, 130, 0, "switch statements");
 | 
					    profileRequires(loc, ENoProfile, 130, nullptr, "switch statements");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wrapupSwitchSubsequence(lastStatements, 0);
 | 
					    wrapupSwitchSubsequence(lastStatements, nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (expression == 0 ||
 | 
					    if (expression == 0 ||
 | 
				
			||||||
        (expression->getBasicType() != EbtInt && expression->getBasicType() != EbtUint) ||
 | 
					        (expression->getBasicType() != EbtInt && expression->getBasicType() != EbtUint) ||
 | 
				
			||||||
 | 
				
			|||||||
@ -994,7 +994,7 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
 | 
				
			|||||||
    pool = new TPoolAllocator();
 | 
					    pool = new TPoolAllocator();
 | 
				
			||||||
    SetThreadPoolAllocator(*pool);
 | 
					    SetThreadPoolAllocator(*pool);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return CompileDeferred(compiler, strings, numStrings, 0, EShOptNone, builtInResources, defaultVersion, forwardCompatible, messages, *intermediate);
 | 
					    return CompileDeferred(compiler, strings, numStrings, nullptr, EShOptNone, builtInResources, defaultVersion, forwardCompatible, messages, *intermediate);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* TShader::getInfoLog()
 | 
					const char* TShader::getInfoLog()
 | 
				
			||||||
 | 
				
			|||||||
@ -481,8 +481,8 @@ void TParseContext::updateExtensionBehavior(const char* extension, const char* b
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
void TParseContext::fullIntegerCheck(TSourceLoc loc, const char* op)
 | 
					void TParseContext::fullIntegerCheck(TSourceLoc loc, const char* op)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    profileRequires(loc, ENoProfile, 130, 0, op); 
 | 
					    profileRequires(loc, ENoProfile, 130, nullptr, op); 
 | 
				
			||||||
    profileRequires(loc, EEsProfile, 300, 0, op);
 | 
					    profileRequires(loc, EEsProfile, 300, nullptr, op);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@ -491,8 +491,8 @@ void TParseContext::fullIntegerCheck(TSourceLoc loc, const char* op)
 | 
				
			|||||||
void TParseContext::doubleCheck(TSourceLoc loc, const char* op)
 | 
					void TParseContext::doubleCheck(TSourceLoc loc, const char* op)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
 | 
					    requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
 | 
				
			||||||
    profileRequires(loc, ECoreProfile, 400, 0, op);
 | 
					    profileRequires(loc, ECoreProfile, 400, nullptr, op);
 | 
				
			||||||
    profileRequires(loc, ECompatibilityProfile, 400, 0, op);
 | 
					    profileRequires(loc, ECompatibilityProfile, 400, nullptr, op);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // end namespace glslang
 | 
					} // end namespace glslang
 | 
				
			||||||
 | 
				
			|||||||
@ -96,6 +96,10 @@ using namespace glslang;
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%{
 | 
					%{
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					#pragma warning(disable : 4065)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4127)
 | 
				
			||||||
 | 
					#pragma warning(disable : 4244)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define parseContext (*pParseContext)
 | 
					#define parseContext (*pParseContext)
 | 
				
			||||||
#define yyerror(context, msg) context->parserError(msg)
 | 
					#define yyerror(context, msg) context->parserError(msg)
 | 
				
			||||||
 | 
				
			|||||||
@ -835,7 +835,7 @@ const int baseAlignmentVec4Std140 = 16;
 | 
				
			|||||||
// Return the size and alignment of a scalar.
 | 
					// Return the size and alignment of a scalar.
 | 
				
			||||||
// The size is returned in the 'size' parameter
 | 
					// The size is returned in the 'size' parameter
 | 
				
			||||||
// Return value is the alignment of the type.
 | 
					// Return value is the alignment of the type.
 | 
				
			||||||
int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
 | 
					int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    switch (type.getBasicType()) {
 | 
					    switch (type.getBasicType()) {
 | 
				
			||||||
    case EbtDouble:  size = 8; return 8;
 | 
					    case EbtDouble:  size = 8; return 8;
 | 
				
			||||||
@ -851,7 +851,7 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
// The size is returned in the 'size' parameter
 | 
					// The size is returned in the 'size' parameter
 | 
				
			||||||
// Return value is the alignment of the type.
 | 
					// Return value is the alignment of the type.
 | 
				
			||||||
int TIntermediate::getBaseAlignment(const TType& type, int& size, bool std140)
 | 
					int TIntermediate::getBaseAlignment(const TType& type, int& size, bool std140)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int alignment;
 | 
					    int alignment;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -100,15 +100,15 @@ TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned in
 | 
				
			|||||||
    if (chunksize == 0)
 | 
					    if (chunksize == 0)
 | 
				
			||||||
        chunksize = CHUNKSIZE;
 | 
					        chunksize = CHUNKSIZE;
 | 
				
			||||||
    if (align & (align - 1))
 | 
					    if (align & (align - 1))
 | 
				
			||||||
        return 0;
 | 
					        return nullptr;
 | 
				
			||||||
    if (chunksize < sizeof(MemoryPool))
 | 
					    if (chunksize < sizeof(MemoryPool))
 | 
				
			||||||
        return 0;
 | 
					        return nullptr;
 | 
				
			||||||
    if (chunksize & (align - 1))
 | 
					    if (chunksize & (align - 1))
 | 
				
			||||||
        return 0;
 | 
					        return nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    MemoryPool *pool = (MemoryPool*)malloc(chunksize);
 | 
					    MemoryPool *pool = (MemoryPool*)malloc(chunksize);
 | 
				
			||||||
    if (! pool)
 | 
					    if (! pool)
 | 
				
			||||||
        return 0;
 | 
					        return nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pool->next = 0;
 | 
					    pool->next = 0;
 | 
				
			||||||
    pool->chunksize = chunksize;
 | 
					    pool->chunksize = chunksize;
 | 
				
			||||||
@ -143,10 +143,12 @@ void* TPpContext::mem_Alloc(MemoryPool *pool, size_t size)
 | 
				
			|||||||
            // request size is too big for the chunksize, so allocate it as
 | 
					            // request size is too big for the chunksize, so allocate it as
 | 
				
			||||||
            // a single chunk of the right size
 | 
					            // a single chunk of the right size
 | 
				
			||||||
            ch = (struct chunk*)malloc(minreq);
 | 
					            ch = (struct chunk*)malloc(minreq);
 | 
				
			||||||
            if (!ch) return 0;
 | 
					            if (! ch)
 | 
				
			||||||
 | 
					                return nullptr;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            ch = (struct chunk*)malloc(pool->chunksize);
 | 
					            ch = (struct chunk*)malloc(pool->chunksize);
 | 
				
			||||||
            if (!ch) return 0;
 | 
					            if (! ch)
 | 
				
			||||||
 | 
					                return nullptr;
 | 
				
			||||||
            pool->free = (uintptr_t)ch + minreq;
 | 
					            pool->free = (uintptr_t)ch + minreq;
 | 
				
			||||||
            pool->end = (uintptr_t)ch + pool->chunksize;
 | 
					            pool->end = (uintptr_t)ch + pool->chunksize;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -206,9 +206,9 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else if (ch == 'f' || ch == 'F') {
 | 
					        } else if (ch == 'f' || ch == 'F') {
 | 
				
			||||||
            parseContext.profileRequires(ppToken->loc,  EEsProfile, 300, 0, "floating-point suffix");
 | 
					            parseContext.profileRequires(ppToken->loc,  EEsProfile, 300, nullptr, "floating-point suffix");
 | 
				
			||||||
            if ((parseContext.messages & EShMsgRelaxedErrors) == 0)
 | 
					            if ((parseContext.messages & EShMsgRelaxedErrors) == 0)
 | 
				
			||||||
                parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, 0, "floating-point suffix");
 | 
					                parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
 | 
				
			||||||
            if (! HasDecimalOrExponent)
 | 
					            if (! HasDecimalOrExponent)
 | 
				
			||||||
                parseContext.error(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
 | 
					                parseContext.error(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
 | 
				
			||||||
            if (len < TPpToken::maxTokenLength)
 | 
					            if (len < TPpToken::maxTokenLength)
 | 
				
			||||||
@ -222,7 +222,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        str[len]='\0';
 | 
					        str[len]='\0';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ppToken->dval = strtod(str, 0);
 | 
					        ppToken->dval = strtod(str, nullptr);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (isDouble)
 | 
					    if (isDouble)
 | 
				
			||||||
@ -687,24 +687,24 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
 | 
				
			|||||||
    int token = '\n';
 | 
					    int token = '\n';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for(;;) {
 | 
					    for(;;) {
 | 
				
			||||||
        const char* tokenString = 0;
 | 
					        const char* tokenString = nullptr;
 | 
				
			||||||
        token = scanToken(ppToken);
 | 
					        token = scanToken(ppToken);
 | 
				
			||||||
        ppToken->token = token;
 | 
					        ppToken->token = token;
 | 
				
			||||||
        if (token == EOF) {
 | 
					        if (token == EOF) {
 | 
				
			||||||
            missingEndifCheck();
 | 
					            missingEndifCheck();
 | 
				
			||||||
            return 0;
 | 
					            return nullptr;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (token == '#') {
 | 
					        if (token == '#') {
 | 
				
			||||||
            if (previous_token == '\n') {
 | 
					            if (previous_token == '\n') {
 | 
				
			||||||
                token = readCPPline(ppToken);
 | 
					                token = readCPPline(ppToken);
 | 
				
			||||||
                if (token == EOF) {
 | 
					                if (token == EOF) {
 | 
				
			||||||
                    missingEndifCheck();
 | 
					                    missingEndifCheck();
 | 
				
			||||||
                    return 0;
 | 
					                    return nullptr;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                parseContext.error(ppToken->loc, "preprocessor directive cannot be preceded by another token", "#", "");
 | 
					                parseContext.error(ppToken->loc, "preprocessor directive cannot be preceded by another token", "#", "");
 | 
				
			||||||
                return 0;
 | 
					                return nullptr;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        previous_token = token;
 | 
					        previous_token = token;
 | 
				
			||||||
@ -723,10 +723,10 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
 | 
				
			|||||||
            tokenString = ppToken->name;
 | 
					            tokenString = ppToken->name;
 | 
				
			||||||
        else if (token == CPP_STRCONSTANT) {
 | 
					        else if (token == CPP_STRCONSTANT) {
 | 
				
			||||||
            parseContext.error(ppToken->loc, "string literals not supported", "\"\"", "");
 | 
					            parseContext.error(ppToken->loc, "string literals not supported", "\"\"", "");
 | 
				
			||||||
            tokenString = 0;
 | 
					            tokenString = nullptr;
 | 
				
			||||||
        } else if (token == '\'') {
 | 
					        } else if (token == '\'') {
 | 
				
			||||||
            parseContext.error(ppToken->loc, "character literals not supported", "\'", "");
 | 
					            parseContext.error(ppToken->loc, "character literals not supported", "\'", "");
 | 
				
			||||||
            tokenString = 0;
 | 
					            tokenString = nullptr;
 | 
				
			||||||
        } else
 | 
					        } else
 | 
				
			||||||
            tokenString = GetAtomString(token);
 | 
					            tokenString = GetAtomString(token);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -127,7 +127,7 @@ TPpContext::Symbol* TPpContext::LookUpSymbol(int atom)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    TSymbolMap::iterator it = symbols.find(atom);
 | 
					    TSymbolMap::iterator it = symbols.find(atom);
 | 
				
			||||||
    if (it == symbols.end())
 | 
					    if (it == symbols.end())
 | 
				
			||||||
        return 0;
 | 
					        return nullptr;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        return it->second;
 | 
					        return it->second;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -367,7 +367,7 @@ public:
 | 
				
			|||||||
            return base;
 | 
					            return base;
 | 
				
			||||||
        TIntermBinary* left = node->getLeft()->getAsBinaryNode();
 | 
					        TIntermBinary* left = node->getLeft()->getAsBinaryNode();
 | 
				
			||||||
        if (! left)
 | 
					        if (! left)
 | 
				
			||||||
            return 0;
 | 
					            return nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return findBase(left);
 | 
					        return findBase(left);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user