Several fixes to make glslang compile with higher warning levels.
This commit is contained in:
parent
be564292f0
commit
8f0a4c64db
@ -181,6 +181,7 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
|
||||
else if (width == 8)
|
||||
addCapability(CapabilityInt8);
|
||||
}
|
||||
[[fallthrough]]; // @MEWIN - 2022-12-07 - Added this to get rid of implicit-fallthrough warning.
|
||||
default:
|
||||
if (basicTypeOp == OpTypeInt) {
|
||||
if (width == 16)
|
||||
|
@ -240,8 +240,8 @@ public:
|
||||
OperandParameters operands;
|
||||
|
||||
protected:
|
||||
int typePresent : 1;
|
||||
int resultPresent : 1;
|
||||
unsigned typePresent : 1; // @MEWIN - 2022-12-07 - Changed to unsigned to get rid of -Woverflow warnings.
|
||||
unsigned resultPresent : 1; // @MEWIN - 2022-12-07 - Changed to unsigned to get rid of -Woverflow warnings.
|
||||
};
|
||||
|
||||
// The set of objects that hold all the instruction/operand
|
||||
|
@ -141,17 +141,17 @@ EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECo
|
||||
// Declare pointers to put into the table for versioning.
|
||||
const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr },
|
||||
{ EDesktopProfile, 0, 130, 0, nullptr },
|
||||
{ EBadProfile } };
|
||||
{ EBadProfile, 0, 0, 0, nullptr } }; // @MEWIN - 2022-12-07 - Added missing initializers.
|
||||
const Versioning* Es300Desktop130 = &Es300Desktop130Version[0];
|
||||
|
||||
const Versioning Es310Desktop420Version[] = { { EEsProfile, 0, 310, 0, nullptr },
|
||||
{ EDesktopProfile, 0, 420, 0, nullptr },
|
||||
{ EBadProfile } };
|
||||
{ EBadProfile, 0, 0, 0, nullptr } }; // @MEWIN - 2022-12-07 - Added missing initializers.
|
||||
const Versioning* Es310Desktop420 = &Es310Desktop420Version[0];
|
||||
|
||||
const Versioning Es310Desktop450Version[] = { { EEsProfile, 0, 310, 0, nullptr },
|
||||
{ EDesktopProfile, 0, 450, 0, nullptr },
|
||||
{ EBadProfile } };
|
||||
{ EBadProfile, 0, 0, 0, nullptr } }; // @MEWIN - 2022-12-07 - Added missing initializers.
|
||||
const Versioning* Es310Desktop450 = &Es310Desktop450Version[0];
|
||||
|
||||
// The main descriptor of what a set of function prototypes can look like, and
|
||||
@ -257,14 +257,14 @@ const BuiltInFunction BaseFunctions[] = {
|
||||
{ EOpMix, "mix", 3, TypeB, ClassRegular, Es310Desktop450 },
|
||||
{ EOpMix, "mix", 3, TypeIU, ClassLB, Es310Desktop450 },
|
||||
|
||||
{ EOpNull }
|
||||
{ EOpNull, nullptr, 0, TypeB, ClassRegular, nullptr } // @MEWIN - 2022-12-08 - Added missing initializers.
|
||||
};
|
||||
|
||||
const BuiltInFunction DerivativeFunctions[] = {
|
||||
{ EOpDPdx, "dFdx", 1, TypeF, ClassRegular, nullptr },
|
||||
{ EOpDPdy, "dFdy", 1, TypeF, ClassRegular, nullptr },
|
||||
{ EOpFwidth, "fwidth", 1, TypeF, ClassRegular, nullptr },
|
||||
{ EOpNull }
|
||||
{ EOpNull, nullptr, 0, TypeB, ClassRegular, nullptr } // @MEWIN - 2022-12-08 - Added missing initializers.
|
||||
};
|
||||
|
||||
// For functions declared some other way, but still use the table to relate to operator.
|
||||
@ -318,7 +318,7 @@ const CustomFunction CustomFunctions[] = {
|
||||
{ EOpTextureProjGrad, "textureProjGrad", nullptr },
|
||||
{ EOpTextureProjGradOffset, "textureProjGradOffset", nullptr },
|
||||
|
||||
{ EOpNull }
|
||||
{ EOpNull, nullptr, nullptr } // @MEWIN - 2022-12-08 - Added missing initializers.
|
||||
};
|
||||
|
||||
// For the given table of functions, add all the indicated prototypes for each
|
||||
|
@ -1277,6 +1277,7 @@ void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, T
|
||||
// matrix multiply does not change shapes
|
||||
if (lhsNode->isMatrix() && rhsNode->isMatrix())
|
||||
return;
|
||||
[[fallthrough]]; // @MEWIN - 2022-12-08 - Added fallthrough to fix compiler warnings.
|
||||
case EOpAdd:
|
||||
case EOpSub:
|
||||
case EOpDiv:
|
||||
|
@ -7227,7 +7227,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T
|
||||
realFunc.addParameter(TParameter().copyParam((*function)[i]));
|
||||
}
|
||||
|
||||
TParameter tmpP = { nullptr, &uintType };
|
||||
TParameter tmpP = { nullptr, &uintType, nullptr }; // @MEWIN - 2022-12-08 - Added missing initializer.
|
||||
realFunc.addParameter(TParameter().copyParam(tmpP));
|
||||
arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(1, loc, true));
|
||||
|
||||
@ -7244,7 +7244,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T
|
||||
realFunc.addParameter(TParameter().copyParam((*function)[i]));
|
||||
}
|
||||
|
||||
TParameter tmpP = { nullptr, &uintType };
|
||||
TParameter tmpP = { nullptr, &uintType, nullptr }; // @MEWIN - 2022-12-08 - Added missing initializer.
|
||||
realFunc.addParameter(TParameter().copyParam(tmpP));
|
||||
arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(-1, loc, true));
|
||||
|
||||
@ -8078,6 +8078,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
||||
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructUVec2, false, newSrcNode, type);
|
||||
return newNode;
|
||||
}
|
||||
[[fallthrough]]; // @MEWIN - 2022-12-08 - Added fallthrough.
|
||||
case EOpConstructUVec3:
|
||||
case EOpConstructUVec4:
|
||||
case EOpConstructUint:
|
||||
@ -8099,6 +8100,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
||||
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type);
|
||||
return newNode;
|
||||
}
|
||||
[[fallthrough]]; // @MEWIN - 2022-12-08 - Added fallthrough.
|
||||
case EOpConstructDVec2:
|
||||
case EOpConstructDVec3:
|
||||
case EOpConstructDVec4:
|
||||
|
@ -168,7 +168,7 @@ void TType::buildMangledName(TString& mangledName) const
|
||||
if (arraySizes->getDimNode(i)->getAsSymbolNode())
|
||||
snprintf(buf, maxSize, "s%lld", arraySizes->getDimNode(i)->getAsSymbolNode()->getId());
|
||||
else
|
||||
snprintf(buf, maxSize, "s%p", arraySizes->getDimNode(i));
|
||||
snprintf(buf, maxSize, "s%p", static_cast<void*>(arraySizes->getDimNode(i))); // @MEWIN - 2022-12-08 - Added cast to void* to fix warning about wrong format.
|
||||
} else
|
||||
snprintf(buf, maxSize, "%d", arraySizes->getDimSize(i));
|
||||
mangledName += '[';
|
||||
|
@ -49,17 +49,17 @@ class TInfoSink;
|
||||
namespace glslang {
|
||||
|
||||
class TIntermediate;
|
||||
struct TVarEntryInfo {
|
||||
long long id;
|
||||
TIntermSymbol* symbol;
|
||||
bool live;
|
||||
bool upgradedToPushConstant;
|
||||
int newBinding;
|
||||
int newSet;
|
||||
int newLocation;
|
||||
int newComponent;
|
||||
int newIndex;
|
||||
EShLanguage stage;
|
||||
struct TVarEntryInfo { // @MEWIN - 2022-12-08 - Added initializers to fix compiler warnings.
|
||||
long long id = 0;
|
||||
TIntermSymbol* symbol = nullptr;
|
||||
bool live = false;
|
||||
bool upgradedToPushConstant = false;
|
||||
int newBinding = 0;
|
||||
int newSet = 0;
|
||||
int newLocation = 0;
|
||||
int newComponent = 0;
|
||||
int newIndex = 0;
|
||||
EShLanguage stage = EShLangVertex;
|
||||
|
||||
void clearNewAssignments() {
|
||||
upgradedToPushConstant = false;
|
||||
|
@ -707,6 +707,7 @@ public:
|
||||
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;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
@ -714,8 +715,10 @@ public:
|
||||
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;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case true: return sampler.arrayed ? GL_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_SAMPLER_2D_MULTISAMPLE;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_SAMPLER_3D;
|
||||
@ -723,11 +726,13 @@ public:
|
||||
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;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EsdRect:
|
||||
return sampler.shadow ? GL_SAMPLER_2D_RECT_SHADOW : GL_SAMPLER_2D_RECT;
|
||||
case EsdBuffer:
|
||||
return GL_SAMPLER_BUFFER;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EbtFloat16:
|
||||
switch ((int)sampler.dim) {
|
||||
@ -735,6 +740,7 @@ public:
|
||||
switch ((int)sampler.shadow) {
|
||||
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_AMD : GL_FLOAT16_SAMPLER_1D_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_1D_SHADOW_AMD;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd2D:
|
||||
switch ((int)sampler.ms) {
|
||||
@ -742,8 +748,10 @@ public:
|
||||
switch ((int)sampler.shadow) {
|
||||
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_SHADOW_AMD;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_FLOAT16_SAMPLER_3D_AMD;
|
||||
@ -751,11 +759,13 @@ public:
|
||||
switch ((int)sampler.shadow) {
|
||||
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD : GL_FLOAT16_SAMPLER_CUBE_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EsdRect:
|
||||
return sampler.shadow ? GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_RECT_AMD;
|
||||
case EsdBuffer:
|
||||
return GL_FLOAT16_SAMPLER_BUFFER_AMD;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EbtInt:
|
||||
switch ((int)sampler.dim) {
|
||||
@ -766,6 +776,7 @@ public:
|
||||
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;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_INT_SAMPLER_3D;
|
||||
@ -775,6 +786,7 @@ public:
|
||||
return GL_INT_SAMPLER_2D_RECT;
|
||||
case EsdBuffer:
|
||||
return GL_INT_SAMPLER_BUFFER;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EbtUint:
|
||||
switch ((int)sampler.dim) {
|
||||
@ -785,6 +797,7 @@ public:
|
||||
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;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_UNSIGNED_INT_SAMPLER_3D;
|
||||
@ -794,6 +807,7 @@ public:
|
||||
return GL_UNSIGNED_INT_SAMPLER_2D_RECT;
|
||||
case EsdBuffer:
|
||||
return GL_UNSIGNED_INT_SAMPLER_BUFFER;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
@ -809,6 +823,7 @@ public:
|
||||
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;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_IMAGE_3D;
|
||||
@ -818,6 +833,8 @@ public:
|
||||
return GL_IMAGE_2D_RECT;
|
||||
case EsdBuffer:
|
||||
return GL_IMAGE_BUFFER;
|
||||
default:
|
||||
return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EbtFloat16:
|
||||
switch ((int)sampler.dim) {
|
||||
@ -827,6 +844,7 @@ public:
|
||||
switch ((int)sampler.ms) {
|
||||
case false: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_AMD;
|
||||
case true: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_FLOAT16_IMAGE_3D_AMD;
|
||||
@ -836,6 +854,8 @@ public:
|
||||
return GL_FLOAT16_IMAGE_2D_RECT_AMD;
|
||||
case EsdBuffer:
|
||||
return GL_FLOAT16_IMAGE_BUFFER_AMD;
|
||||
default:
|
||||
return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EbtInt:
|
||||
switch ((int)sampler.dim) {
|
||||
@ -845,6 +865,7 @@ public:
|
||||
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;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_INT_IMAGE_3D;
|
||||
@ -854,6 +875,8 @@ public:
|
||||
return GL_INT_IMAGE_2D_RECT;
|
||||
case EsdBuffer:
|
||||
return GL_INT_IMAGE_BUFFER;
|
||||
default:
|
||||
return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EbtUint:
|
||||
switch ((int)sampler.dim) {
|
||||
@ -864,6 +887,7 @@ public:
|
||||
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;
|
||||
default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case Esd3D:
|
||||
return GL_UNSIGNED_INT_IMAGE_3D;
|
||||
@ -873,6 +897,8 @@ public:
|
||||
return GL_UNSIGNED_INT_IMAGE_2D_RECT;
|
||||
case EsdBuffer:
|
||||
return GL_UNSIGNED_INT_IMAGE_BUFFER;
|
||||
default:
|
||||
return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
@ -937,6 +963,8 @@ public:
|
||||
case 4: return GL_FLOAT_MAT4;
|
||||
default: return 0;
|
||||
}
|
||||
default:
|
||||
return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EbtDouble:
|
||||
switch (type.getMatrixCols()) {
|
||||
@ -961,6 +989,8 @@ public:
|
||||
case 4: return GL_DOUBLE_MAT4;
|
||||
default: return 0;
|
||||
}
|
||||
default:
|
||||
return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
case EbtFloat16:
|
||||
switch (type.getMatrixCols()) {
|
||||
@ -985,6 +1015,8 @@ public:
|
||||
case 4: return GL_FLOAT16_MAT4_AMD;
|
||||
default: return 0;
|
||||
}
|
||||
default:
|
||||
return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings.
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user