glslang portability: Fixed a slew of OSX compilation warnings (but not all).

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31469 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-06-10 23:23:12 +00:00
parent 79eaa91e6f
commit fae38ee277
12 changed files with 83 additions and 75 deletions

View file

@ -132,6 +132,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* const
}
TConstUnionArray newConstArray(newComps);
TType constBool(EbtBool, EvqConst);
switch(op) {
case EOpAdd:
@ -265,27 +266,27 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* const
case EOpLessThan:
newConstArray[0].setBConst(unionArray[0] < rightUnionArray[0]);
returnType.shallowCopy(TType(EbtBool, EvqConst));
returnType.shallowCopy(constBool);
break;
case EOpGreaterThan:
newConstArray[0].setBConst(unionArray[0] > rightUnionArray[0]);
returnType.shallowCopy(TType(EbtBool, EvqConst));
returnType.shallowCopy(constBool);
break;
case EOpLessThanEqual:
newConstArray[0].setBConst(! (unionArray[0] > rightUnionArray[0]));
returnType.shallowCopy(TType(EbtBool, EvqConst));
returnType.shallowCopy(constBool);
break;
case EOpGreaterThanEqual:
newConstArray[0].setBConst(! (unionArray[0] < rightUnionArray[0]));
returnType.shallowCopy(TType(EbtBool, EvqConst));
returnType.shallowCopy(constBool);
break;
case EOpEqual:
newConstArray[0].setBConst(node->getConstArray() == unionArray);
returnType.shallowCopy(TType(EbtBool, EvqConst));
returnType.shallowCopy(constBool);
break;
case EOpNotEqual:
newConstArray[0].setBConst(node->getConstArray() != unionArray);
returnType.shallowCopy(TType(EbtBool, EvqConst));
returnType.shallowCopy(constBool);
break;
default:

View file

@ -416,8 +416,8 @@ void TBuiltIns::initialize(int version, EProfile profile)
"\n");
}
if (profile == EEsProfile && version >= 310 ||
profile != EEsProfile && version >= 430) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 430)) {
commonBuiltins.append(
"uint atomicAdd(coherent volatile inout uint, uint);"
" int atomicAdd(coherent volatile inout int, int);"
@ -446,8 +446,8 @@ void TBuiltIns::initialize(int version, EProfile profile)
"\n");
}
if (profile == EEsProfile && version >= 310 ||
profile != EEsProfile && version >= 450) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 450)) {
commonBuiltins.append(
"int mix(int x, int y, bool a);"
"ivec2 mix(ivec2 x, ivec2 y, bvec2 a);"
@ -1330,8 +1330,8 @@ void TBuiltIns::initialize(int version, EProfile profile)
//
//============================================================================
if (profile != EEsProfile && version >= 430 ||
profile == EEsProfile && version >= 310) {
if ((profile != EEsProfile && version >= 430) ||
(profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangCompute].append(
"in uvec3 gl_NumWorkGroups;"
"const uvec3 gl_WorkGroupSize = uvec3(1,1,1);"
@ -2491,7 +2491,8 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
}
// images (some in compute below)
if (profile == EEsProfile && version >= 310 || profile != EEsProfile && version >= 130) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 130)) {
snprintf(builtInConstant, maxSize, "const int gl_MaxImageUnits = %d;", resources.maxImageUnits);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedShaderOutputResources = %d;", resources.maxCombinedShaderOutputResources);
@ -2505,7 +2506,8 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
}
// atomic counters (some in compute below)
if (profile == EEsProfile && version >= 310 || profile != EEsProfile && version >= 420) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 420)) {
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAtomicCounters = %d;", resources. maxVertexAtomicCounters);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentAtomicCounters = %d;", resources. maxFragmentAtomicCounters);

View file

@ -2192,7 +2192,7 @@ void TParseContext::mergeQualifiers(TSourceLoc loc, TQualifier& dst, const TQual
// Ordering
if (! force && ((profile != EEsProfile && version < 420) ||
profile == EEsProfile && version < 310)
(profile == EEsProfile && version < 310))
&& ! extensionsTurnedOn(1, &GL_ARB_shading_language_420pack)) {
// non-function parameters
if (src.invariant && (dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone))
@ -4854,7 +4854,7 @@ void TParseContext::invariantCheck(TSourceLoc loc, const TQualifier& qualifier)
bool pipeOut = qualifier.isPipeOutput();
bool pipeIn = qualifier.isPipeInput();
if (version >= 300 || profile != EEsProfile && version >= 420) {
if (version >= 300 || (profile != EEsProfile && version >= 420)) {
if (! pipeOut)
error(loc, "can only apply to an output", "invariant", "");
} else {

View file

@ -1131,7 +1131,9 @@ int TScanContext::secondGenerationImage()
return keyword;
}
if (parseContext.symbolTable.atBuiltInLevel() || parseContext.profile != EEsProfile && (parseContext.version >= 420 || parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store)))
if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.profile != EEsProfile &&
(parseContext.version >= 420 || parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store))))
return keyword;
if (parseContext.forwardCompatible)

View file

@ -432,6 +432,9 @@ void TIntermediate::finalCheck(TInfoSink& infoSink)
break;
case EShLangCompute:
break;
default:
error(infoSink, "Unknown Stage.");
break;
}
// Process the tree for any node-specific work.

View file

@ -285,9 +285,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ch = pp->getChar();
}
} while ((ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9') ||
ch == '_');
(ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9') ||
ch == '_');
// line continuation with no token before or after makes len == 0, and need to start over skipping white space, etc.
if (len == 0)
@ -333,8 +333,8 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
}
ch = pp->getChar();
} while ((ch >= '0' && ch <= '9') ||
(ch >= 'A' && ch <= 'F') ||
(ch >= 'a' && ch <= 'f'));
(ch >= 'A' && ch <= 'F') ||
(ch >= 'a' && ch <= 'f'));
} else {
pp->parseContext.error(ppToken->loc, "bad digit in hexidecimal literal", "", "");
}

View file

@ -381,16 +381,16 @@ public:
// a sampler...
switch (sampler.type) {
case EbtFloat:
switch (sampler.dim) {
switch ((int)sampler.dim) {
case Esd1D:
switch (sampler.shadow) {
switch ((int)sampler.shadow) {
case false: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY : GL_SAMPLER_1D;
case true: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY_SHADOW : GL_SAMPLER_1D_SHADOW;
}
case Esd2D:
switch (sampler.ms) {
switch ((int)sampler.ms) {
case false:
switch (sampler.shadow) {
switch ((int)sampler.shadow) {
case false: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY : GL_SAMPLER_2D;
case true: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY_SHADOW : GL_SAMPLER_2D_SHADOW;
}
@ -399,7 +399,7 @@ public:
case Esd3D:
return GL_SAMPLER_3D;
case EsdCube:
switch (sampler.shadow) {
switch ((int)sampler.shadow) {
case false: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY : GL_SAMPLER_CUBE;
case true: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW : GL_SAMPLER_CUBE_SHADOW;
}
@ -409,11 +409,11 @@ public:
return GL_SAMPLER_BUFFER;
}
case EbtInt:
switch (sampler.dim) {
switch ((int)sampler.dim) {
case Esd1D:
return sampler.arrayed ? GL_INT_SAMPLER_1D_ARRAY : GL_INT_SAMPLER_1D;
case Esd2D:
switch (sampler.ms) {
switch ((int)sampler.ms) {
case false: return sampler.arrayed ? GL_INT_SAMPLER_2D_ARRAY : GL_INT_SAMPLER_2D;
case true: return sampler.arrayed ? GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_INT_SAMPLER_2D_MULTISAMPLE;
}
@ -427,11 +427,11 @@ public:
return GL_INT_SAMPLER_BUFFER;
}
case EbtUint:
switch (sampler.dim) {
switch ((int)sampler.dim) {
case Esd1D:
return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_1D_ARRAY : GL_UNSIGNED_INT_SAMPLER_1D;
case Esd2D:
switch (sampler.ms) {
switch ((int)sampler.ms) {
case false: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D;
case true: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE;
}
@ -451,11 +451,11 @@ public:
// an image...
switch (sampler.type) {
case EbtFloat:
switch (sampler.dim) {
switch ((int)sampler.dim) {
case Esd1D:
return sampler.arrayed ? GL_IMAGE_1D_ARRAY : GL_IMAGE_1D;
case Esd2D:
switch (sampler.ms) {
switch ((int)sampler.ms) {
case false: return sampler.arrayed ? GL_IMAGE_2D_ARRAY : GL_IMAGE_2D;
case true: return sampler.arrayed ? GL_IMAGE_2D_MULTISAMPLE_ARRAY : GL_IMAGE_2D_MULTISAMPLE;
}
@ -469,11 +469,11 @@ public:
return GL_IMAGE_BUFFER;
}
case EbtInt:
switch (sampler.dim) {
switch ((int)sampler.dim) {
case Esd1D:
return sampler.arrayed ? GL_INT_IMAGE_1D_ARRAY : GL_INT_IMAGE_1D;
case Esd2D:
switch (sampler.ms) {
switch ((int)sampler.ms) {
case false: return sampler.arrayed ? GL_INT_IMAGE_2D_ARRAY : GL_INT_IMAGE_2D;
case true: return sampler.arrayed ? GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY : GL_INT_IMAGE_2D_MULTISAMPLE;
}
@ -487,11 +487,11 @@ public:
return GL_INT_IMAGE_BUFFER;
}
case EbtUint:
switch (sampler.dim) {
switch ((int)sampler.dim) {
case Esd1D:
return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_1D_ARRAY : GL_UNSIGNED_INT_IMAGE_1D;
case Esd2D:
switch (sampler.ms) {
switch ((int)sampler.ms) {
case false: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_ARRAY : GL_UNSIGNED_INT_IMAGE_2D;
case true: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY : GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE;
}