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
|
||||
// statements between the last case and the end of the switch statement
|
||||
if ((int)codeSegments.size() == valueIndexToSegment[caseValues.size() - 1])
|
||||
codeSegments.push_back(0);
|
||||
codeSegments.push_back(nullptr);
|
||||
|
||||
// make the switch statement
|
||||
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)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
char** shaderStrings = ReadFileData(fileName);
|
||||
if (! shaderStrings) {
|
||||
usage();
|
||||
@ -826,12 +826,12 @@ void CompileFile(const char* fileName, ShHandle compiler)
|
||||
for (int i = 0; i < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++i) {
|
||||
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, 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",
|
||||
// "or should be l", "ine 1", "string 5\n", "float glo", "bal",
|
||||
// ";\n#error should be line 2\n void main() {", "global = 2.3;}" };
|
||||
//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)
|
||||
@ -919,28 +919,28 @@ char** ReadFileData(const char* fileName)
|
||||
FILE *in;
|
||||
int errorCode = fopen_s(&in, fileName, "r");
|
||||
|
||||
char *fdata;
|
||||
int count = 0;
|
||||
const int maxSourceStrings = 5;
|
||||
char** return_data = (char**)malloc(sizeof(char *) * (maxSourceStrings+1));
|
||||
|
||||
if (errorCode) {
|
||||
printf("Error: unable to open input file: %s\n", fileName);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
while (fgetc(in) != EOF)
|
||||
count++;
|
||||
|
||||
fseek(in, 0, SEEK_SET);
|
||||
|
||||
if (!(fdata = (char*)malloc(count+2))) {
|
||||
|
||||
char *fdata = (char*)malloc(count+2);
|
||||
if (! fdata) {
|
||||
printf("Error allocating memory\n");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if ((int)fread(fdata,1,count, in) != count) {
|
||||
printf("Error reading input file: %s\n", fileName);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
fdata[count] = '\0';
|
||||
fclose(in);
|
||||
|
||||
@ -486,7 +486,7 @@ TIntermTyped* TParseContext::handleBracketDereference(TSourceLoc loc, TIntermTyp
|
||||
else if (base->getBasicType() == EbtSampler && version >= 130) {
|
||||
const char* explanation = "variable indexing sampler array";
|
||||
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);
|
||||
@ -724,7 +724,7 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped*
|
||||
if (field == "length") {
|
||||
if (base->isArray()) {
|
||||
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()) {
|
||||
const char* feature = ".length() on vectors and matrices";
|
||||
requireProfile(loc, ~EEsProfile, feature);
|
||||
@ -841,7 +841,7 @@ TFunction* TParseContext::handleFunctionDeclarator(TSourceLoc loc, TFunction& fu
|
||||
const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0;
|
||||
if (prevDec) {
|
||||
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())
|
||||
error(loc, "overloaded functions must have the same return type", function.getType().getBasicTypeString().c_str(), "");
|
||||
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) {
|
||||
TString featureString = fnCandidate.getName() + "(...)";
|
||||
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
|
||||
if (fnCandidate.getName().compare("textureGatherOffset") == 0) {
|
||||
@ -1385,7 +1385,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, const TPublicTyp
|
||||
|
||||
if (type.isArray()) {
|
||||
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);
|
||||
@ -1577,7 +1577,7 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr)
|
||||
} else {
|
||||
switch (symbol->getQualifier().storage) {
|
||||
case EvqPointCoord:
|
||||
profileRequires(symbol->getLoc(), ENoProfile, 120, 0, "gl_PointCoord");
|
||||
profileRequires(symbol->getLoc(), ENoProfile, 120, nullptr, "gl_PointCoord");
|
||||
break;
|
||||
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, "");
|
||||
return true;
|
||||
} else {
|
||||
profileRequires(loc, EEsProfile, 300, 0, message);
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, 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()) {
|
||||
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,
|
||||
// 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
|
||||
switch (qualifier.storage) {
|
||||
case EvqIn:
|
||||
profileRequires(loc, ENoProfile, 130, 0, "in for stage inputs");
|
||||
profileRequires(loc, EEsProfile, 300, 0, "in for stage inputs");
|
||||
profileRequires(loc, ENoProfile, 130, nullptr, "in for stage inputs");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "in for stage inputs");
|
||||
qualifier.storage = EvqVaryingIn;
|
||||
break;
|
||||
case EvqOut:
|
||||
profileRequires(loc, ENoProfile, 130, 0, "out for stage outputs");
|
||||
profileRequires(loc, EEsProfile, 300, 0, "out for stage outputs");
|
||||
profileRequires(loc, ENoProfile, 130, nullptr, "out for stage outputs");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "out for stage outputs");
|
||||
qualifier.storage = EvqVaryingOut;
|
||||
break;
|
||||
case EvqInOut:
|
||||
@ -2066,7 +2066,7 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
|
||||
}
|
||||
|
||||
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.storage == EvqVaryingIn && language == EShLangFragment)
|
||||
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) {
|
||||
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)
|
||||
error(loc, "vertex input cannot be further qualified", "", "");
|
||||
@ -2106,8 +2106,8 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
|
||||
|
||||
case EShLangFragment:
|
||||
if (publicType.userDef) {
|
||||
profileRequires(loc, EEsProfile, 300, 0, "fragment-shader struct input");
|
||||
profileRequires(loc, ~EEsProfile, 150, 0, "fragment-shader struct input");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "fragment-shader struct input");
|
||||
profileRequires(loc, ~EEsProfile, 150, nullptr, "fragment-shader struct input");
|
||||
if (publicType.userDef->containsStructure())
|
||||
requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing structure");
|
||||
if (publicType.userDef->containsArray())
|
||||
@ -2128,8 +2128,8 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
|
||||
switch (language) {
|
||||
case EShLangVertex:
|
||||
if (publicType.userDef) {
|
||||
profileRequires(loc, EEsProfile, 300, 0, "vertex-shader struct output");
|
||||
profileRequires(loc, ~EEsProfile, 150, 0, "vertex-shader struct output");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "vertex-shader struct output");
|
||||
profileRequires(loc, ~EEsProfile, 150, nullptr, "vertex-shader struct output");
|
||||
if (publicType.userDef->containsStructure())
|
||||
requireProfile(loc, ~EEsProfile, "vertex-shader struct output containing structure");
|
||||
if (publicType.userDef->containsArray())
|
||||
@ -2150,7 +2150,7 @@ void TParseContext::globalQualifierTypeCheck(TSourceLoc loc, const TQualifier& q
|
||||
break;
|
||||
|
||||
case EShLangFragment:
|
||||
profileRequires(loc, EEsProfile, 300, 0, "fragment shader output");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "fragment shader output");
|
||||
if (publicType.basicType == EbtStruct) {
|
||||
error(loc, "cannot be a structure", GetStorageQualifierString(qualifier.storage), "");
|
||||
return;
|
||||
@ -2377,12 +2377,12 @@ bool TParseContext::arrayQualifierError(TSourceLoc loc, const TQualifier& qualif
|
||||
{
|
||||
if (qualifier.storage == EvqConst) {
|
||||
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) {
|
||||
requireProfile(loc, ~EEsProfile, "vertex input arrays");
|
||||
profileRequires(loc, ENoProfile, 150, 0, "vertex input arrays");
|
||||
profileRequires(loc, ENoProfile, 150, nullptr, "vertex input arrays");
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -2436,8 +2436,8 @@ void TParseContext::structArrayCheck(TSourceLoc /*loc*/, TType* type)
|
||||
void TParseContext::arrayDimError(TSourceLoc loc)
|
||||
{
|
||||
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "arrays of arrays");
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, "arrays of arrays");
|
||||
profileRequires(loc, EEsProfile, 310, 0, "arrays of arrays");
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "arrays of arrays");
|
||||
profileRequires(loc, EEsProfile, 310, nullptr, "arrays of arrays");
|
||||
}
|
||||
|
||||
void TParseContext::arrayDimCheck(TSourceLoc loc, TArraySizes* sizes1, TArraySizes* sizes2)
|
||||
@ -2465,7 +2465,7 @@ void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TTyp
|
||||
{
|
||||
if (! symbol) {
|
||||
bool currentScope;
|
||||
symbol = symbolTable.find(identifier, 0, ¤tScope);
|
||||
symbol = symbolTable.find(identifier, nullptr, ¤tScope);
|
||||
|
||||
if (symbol && builtInName(identifier) && ! symbolTable.atBuiltInLevel()) {
|
||||
// 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
|
||||
if (type.containsArray()) {
|
||||
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)) {
|
||||
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "std430");
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, "std430");
|
||||
profileRequires(loc, EEsProfile, 310, 0, "std430");
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "std430");
|
||||
profileRequires(loc, EEsProfile, 310, nullptr, "std430");
|
||||
publicType.qualifier.layoutPacking = ElpStd430;
|
||||
return;
|
||||
}
|
||||
@ -3247,14 +3247,14 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||
}
|
||||
if (id == "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;
|
||||
return;
|
||||
}
|
||||
for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth+1)) {
|
||||
if (id == TQualifier::getLayoutDepthString(depth)) {
|
||||
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;
|
||||
return;
|
||||
}
|
||||
@ -3296,7 +3296,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
|
||||
const char* exts[2] = { GL_ARB_enhanced_layouts, GL_ARB_shader_atomic_counters };
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature);
|
||||
profileRequires(loc, EEsProfile, 310, 0, feature);
|
||||
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
||||
publicType.qualifier.layoutOffset = value;
|
||||
return;
|
||||
} else if (id == "align") {
|
||||
@ -3310,7 +3310,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||
publicType.qualifier.layoutAlign = value;
|
||||
return;
|
||||
} 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 };
|
||||
profileRequires(loc, ~EEsProfile, 330, 2, exts, "location");
|
||||
if ((unsigned int)value >= TQualifier::layoutLocationEnd)
|
||||
@ -3326,7 +3326,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||
return;
|
||||
} else if (id == "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)
|
||||
error(loc, "binding is too large", id.c_str(), "");
|
||||
else
|
||||
@ -3395,7 +3395,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||
|
||||
case EShLangGeometry:
|
||||
if (id == "invocations") {
|
||||
profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, 0, "invocations");
|
||||
profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, nullptr, "invocations");
|
||||
publicType.shaderQualifiers.invocations = value;
|
||||
return;
|
||||
}
|
||||
@ -3709,10 +3709,10 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
|
||||
if (language == EShLangVertex) {
|
||||
const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
|
||||
profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
|
||||
profileRequires(loc, EEsProfile, 300, 0, feature);
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, feature);
|
||||
} else {
|
||||
profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
|
||||
profileRequires(loc, EEsProfile, 310, 0, feature);
|
||||
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3726,10 +3726,10 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
|
||||
if (language == EShLangFragment) {
|
||||
const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
|
||||
profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
|
||||
profileRequires(loc, EEsProfile, 300, 0, feature);
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, feature);
|
||||
} else {
|
||||
profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
|
||||
profileRequires(loc, EEsProfile, 310, 0, feature);
|
||||
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3738,8 +3738,8 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
|
||||
{
|
||||
const char* feature = "location qualifier on uniform or buffer";
|
||||
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, feature);
|
||||
profileRequires(loc, EEsProfile, 310, 0, feature);
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, feature);
|
||||
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -4011,7 +4011,7 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier,
|
||||
|
||||
if (initializer) {
|
||||
profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "initializer");
|
||||
profileRequires(loc, EEsProfile, 300, 0, "initializer");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "initializer");
|
||||
}
|
||||
} else {
|
||||
// non-array case
|
||||
@ -4463,13 +4463,13 @@ void TParseContext::declareBlock(TSourceLoc loc, TTypeList& typeList, const TStr
|
||||
|
||||
switch (currentBlockQualifier.storage) {
|
||||
case EvqUniform:
|
||||
profileRequires(loc, EEsProfile, 300, 0, "uniform block");
|
||||
profileRequires(loc, ENoProfile, 140, 0, "uniform block");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "uniform block");
|
||||
profileRequires(loc, ENoProfile, 140, nullptr, "uniform block");
|
||||
break;
|
||||
case EvqBuffer:
|
||||
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "buffer block");
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, "buffer block");
|
||||
profileRequires(loc, EEsProfile, 310, 0, "buffer block");
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "buffer block");
|
||||
profileRequires(loc, EEsProfile, 310, nullptr, "buffer block");
|
||||
break;
|
||||
case EvqVaryingIn:
|
||||
requireProfile(loc, ~EEsProfile, "input block");
|
||||
@ -5072,10 +5072,10 @@ void TParseContext::wrapupSwitchSubsequence(TIntermAggregate* statements, TInter
|
||||
//
|
||||
TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression, TIntermAggregate* lastStatements)
|
||||
{
|
||||
profileRequires(loc, EEsProfile, 300, 0, "switch statements");
|
||||
profileRequires(loc, ENoProfile, 130, 0, "switch statements");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "switch statements");
|
||||
profileRequires(loc, ENoProfile, 130, nullptr, "switch statements");
|
||||
|
||||
wrapupSwitchSubsequence(lastStatements, 0);
|
||||
wrapupSwitchSubsequence(lastStatements, nullptr);
|
||||
|
||||
if (expression == 0 ||
|
||||
(expression->getBasicType() != EbtInt && expression->getBasicType() != EbtUint) ||
|
||||
|
||||
@ -994,7 +994,7 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
|
||||
pool = new TPoolAllocator();
|
||||
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()
|
||||
|
||||
@ -481,8 +481,8 @@ void TParseContext::updateExtensionBehavior(const char* extension, const char* b
|
||||
//
|
||||
void TParseContext::fullIntegerCheck(TSourceLoc loc, const char* op)
|
||||
{
|
||||
profileRequires(loc, ENoProfile, 130, 0, op);
|
||||
profileRequires(loc, EEsProfile, 300, 0, op);
|
||||
profileRequires(loc, ENoProfile, 130, nullptr, 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)
|
||||
{
|
||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
|
||||
profileRequires(loc, ECoreProfile, 400, 0, op);
|
||||
profileRequires(loc, ECompatibilityProfile, 400, 0, op);
|
||||
profileRequires(loc, ECoreProfile, 400, nullptr, op);
|
||||
profileRequires(loc, ECompatibilityProfile, 400, nullptr, op);
|
||||
}
|
||||
|
||||
} // 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 yyerror(context, msg) context->parserError(msg)
|
||||
|
||||
@ -835,7 +835,7 @@ const int baseAlignmentVec4Std140 = 16;
|
||||
// Return the size and alignment of a scalar.
|
||||
// The size is returned in the 'size' parameter
|
||||
// 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()) {
|
||||
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
|
||||
// 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;
|
||||
|
||||
|
||||
@ -100,15 +100,15 @@ TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned in
|
||||
if (chunksize == 0)
|
||||
chunksize = CHUNKSIZE;
|
||||
if (align & (align - 1))
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (chunksize < sizeof(MemoryPool))
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (chunksize & (align - 1))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
MemoryPool *pool = (MemoryPool*)malloc(chunksize);
|
||||
if (! pool)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
pool->next = 0;
|
||||
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
|
||||
// a single chunk of the right size
|
||||
ch = (struct chunk*)malloc(minreq);
|
||||
if (!ch) return 0;
|
||||
if (! ch)
|
||||
return nullptr;
|
||||
} else {
|
||||
ch = (struct chunk*)malloc(pool->chunksize);
|
||||
if (!ch) return 0;
|
||||
if (! ch)
|
||||
return nullptr;
|
||||
pool->free = (uintptr_t)ch + minreq;
|
||||
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') {
|
||||
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)
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, 0, "floating-point suffix");
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
|
||||
if (! HasDecimalOrExponent)
|
||||
parseContext.error(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
@ -222,7 +222,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||
|
||||
str[len]='\0';
|
||||
|
||||
ppToken->dval = strtod(str, 0);
|
||||
ppToken->dval = strtod(str, nullptr);
|
||||
}
|
||||
|
||||
if (isDouble)
|
||||
@ -687,24 +687,24 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
|
||||
int token = '\n';
|
||||
|
||||
for(;;) {
|
||||
const char* tokenString = 0;
|
||||
const char* tokenString = nullptr;
|
||||
token = scanToken(ppToken);
|
||||
ppToken->token = token;
|
||||
if (token == EOF) {
|
||||
missingEndifCheck();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (token == '#') {
|
||||
if (previous_token == '\n') {
|
||||
token = readCPPline(ppToken);
|
||||
if (token == EOF) {
|
||||
missingEndifCheck();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
parseContext.error(ppToken->loc, "preprocessor directive cannot be preceded by another token", "#", "");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
previous_token = token;
|
||||
@ -723,10 +723,10 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
|
||||
tokenString = ppToken->name;
|
||||
else if (token == CPP_STRCONSTANT) {
|
||||
parseContext.error(ppToken->loc, "string literals not supported", "\"\"", "");
|
||||
tokenString = 0;
|
||||
tokenString = nullptr;
|
||||
} else if (token == '\'') {
|
||||
parseContext.error(ppToken->loc, "character literals not supported", "\'", "");
|
||||
tokenString = 0;
|
||||
tokenString = nullptr;
|
||||
} else
|
||||
tokenString = GetAtomString(token);
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ TPpContext::Symbol* TPpContext::LookUpSymbol(int atom)
|
||||
{
|
||||
TSymbolMap::iterator it = symbols.find(atom);
|
||||
if (it == symbols.end())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ public:
|
||||
return base;
|
||||
TIntermBinary* left = node->getLeft()->getAsBinaryNode();
|
||||
if (! left)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return findBase(left);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user