Fixed MSVC build warnings.

This commit is contained in:
Patrick 2024-06-26 10:02:58 +02:00
parent 6cccd7458d
commit c622ed7f86
15 changed files with 239 additions and 183 deletions

8
.gitignore vendored
View File

@ -12,6 +12,7 @@ External/googletest
External/spirv-tools External/spirv-tools
out/ out/
CMakeUserPresets.json CMakeUserPresets.json
*.obj
# GN generated files # GN generated files
.cipd/ .cipd/
@ -20,6 +21,13 @@ third_party/
buildtools/ buildtools/
tools/ tools/
# S++ generated files
.spp_script_run
# Random OS stuff # Random OS stuff
.DS_Store .DS_Store
._* ._*
# Generated files
include/
glslang/build_info.h

View File

@ -1944,14 +1944,16 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
const glslang::TSpirvExecutionMode spirvExecutionMode = glslangIntermediate->getSpirvExecutionMode(); const glslang::TSpirvExecutionMode spirvExecutionMode = glslangIntermediate->getSpirvExecutionMode();
// Add spirv_execution_mode // Add spirv_execution_mode
for (auto& mode : spirvExecutionMode.modes) { // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (!mode.second.empty()) { for (auto& spvMode : spirvExecutionMode.modes) {
if (!spvMode.second.empty()) {
std::vector<unsigned> literals; std::vector<unsigned> literals;
TranslateLiterals(mode.second, literals); TranslateLiterals(spvMode.second, literals);
builder.addExecutionMode(shaderEntry, static_cast<spv::ExecutionMode>(mode.first), literals); builder.addExecutionMode(shaderEntry, static_cast<spv::ExecutionMode>(spvMode.first), literals);
} else } else
builder.addExecutionMode(shaderEntry, static_cast<spv::ExecutionMode>(mode.first)); builder.addExecutionMode(shaderEntry, static_cast<spv::ExecutionMode>(spvMode.first));
} }
// END @MEWIN
// Add spirv_execution_mode_id // Add spirv_execution_mode_id
for (auto& modeId : spirvExecutionMode.modeIds) { for (auto& modeId : spirvExecutionMode.modeIds) {
@ -2741,19 +2743,19 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
else else
op = glslang::EOpSub; op = glslang::EOpSub;
spv::Id result = createBinaryOperation(op, decorations, spv::Id opResult = createBinaryOperation(op, decorations, // @MEWIN - 2024-06-26 - Fixed shadowing warning.
convertGlslangToSpvType(node->getType()), operand, one, convertGlslangToSpvType(node->getType()), operand, one,
node->getType().getBasicType()); node->getType().getBasicType());
assert(result != spv::NoResult); assert(opResult != spv::NoResult); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
// The result of operation is always stored, but conditionally the // The result of operation is always stored, but conditionally the
// consumed result. The consumed result is always an r-value. // consumed result. The consumed result is always an r-value.
builder.accessChainStore(result, builder.accessChainStore(opResult, // @MEWIN - 2024-06-26 - Fixed shadowing warning.
TranslateNonUniformDecoration(builder.getAccessChain().coherentFlags)); TranslateNonUniformDecoration(builder.getAccessChain().coherentFlags));
builder.clearAccessChain(); builder.clearAccessChain();
if (node->getOp() == glslang::EOpPreIncrement || if (node->getOp() == glslang::EOpPreIncrement ||
node->getOp() == glslang::EOpPreDecrement) node->getOp() == glslang::EOpPreDecrement)
builder.setAccessChainRValue(result); builder.setAccessChainRValue(opResult); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
else else
builder.setAccessChainRValue(operand); builder.setAccessChainRValue(operand);
} }
@ -3663,11 +3665,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
spv::Id typeId = builder.getContainedTypeId(builder.getTypeId(operands[0])); spv::Id typeId = builder.getContainedTypeId(builder.getTypeId(operands[0]));
assert(builder.isCooperativeMatrixType(typeId)); assert(builder.isCooperativeMatrixType(typeId));
// do the op // do the op
spv::Id result = node->getOp() == glslang::EOpCooperativeMatrixLoad spv::Id opResult = node->getOp() == glslang::EOpCooperativeMatrixLoad // @MEWIN - 2024-06-26 - Fixed shadowing warning.
? builder.createOp(spv::OpCooperativeMatrixLoadKHR, typeId, idImmOps) ? builder.createOp(spv::OpCooperativeMatrixLoadKHR, typeId, idImmOps)
: builder.createOp(spv::OpCooperativeMatrixLoadNV, typeId, idImmOps); : builder.createOp(spv::OpCooperativeMatrixLoadNV, typeId, idImmOps);
// store the result to the pointer (out param 'm') // store the result to the pointer (out param 'm')
builder.createStore(result, operands[0]); builder.createStore(opResult, operands[0]); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
result = 0; result = 0;
} else if (node->getOp() == glslang::EOpCooperativeMatrixStore || } else if (node->getOp() == glslang::EOpCooperativeMatrixStore ||
node->getOp() == glslang::EOpCooperativeMatrixStoreNV) { node->getOp() == glslang::EOpCooperativeMatrixStoreNV) {
@ -3701,9 +3703,9 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
spv::Op spvOp = spv::OpRayQueryGetIntersectionTriangleVertexPositionsKHR; spv::Op spvOp = spv::OpRayQueryGetIntersectionTriangleVertexPositionsKHR;
spv::Id result = builder.createOp(spvOp, typeId, idImmOps); spv::Id opResult = builder.createOp(spvOp, typeId, idImmOps); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
// store the result to the pointer (out param 'm') // store the result to the pointer (out param 'm')
builder.createStore(result, operands[2]); builder.createStore(opResult, operands[2]); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
result = 0; result = 0;
} else if (node->getOp() == glslang::EOpCooperativeMatrixMulAdd) { } else if (node->getOp() == glslang::EOpCooperativeMatrixMulAdd) {
uint32_t matrixOperands = 0; uint32_t matrixOperands = 0;
@ -4877,8 +4879,10 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
// Add memory decorations only to top-level members of shader storage block // Add memory decorations only to top-level members of shader storage block
std::vector<spv::Decoration> memory; std::vector<spv::Decoration> memory;
TranslateMemoryDecoration(memberQualifier, memory, glslangIntermediate->usingVulkanMemoryModel()); TranslateMemoryDecoration(memberQualifier, memory, glslangIntermediate->usingVulkanMemoryModel());
for (unsigned int i = 0; i < memory.size(); ++i) // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
builder.addMemberDecoration(spvType, member, memory[i]); for (unsigned int j = 0; i < memory.size(); ++j)
builder.addMemberDecoration(spvType, member, memory[j]);
// END @MEWIN
} }
// Location assignment was already completed correctly by the front end, // Location assignment was already completed correctly by the front end,
@ -5992,13 +5996,15 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
builder.addDecoration(pointer, spv::DecorationNonUniformEXT); builder.addDecoration(pointer, spv::DecorationNonUniformEXT);
} }
std::vector<spv::Id> operands; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
operands.push_back(pointer); std::vector<spv::Id> opOperands;
opOperands.push_back(pointer);
for (; opIt != arguments.end(); ++opIt) for (; opIt != arguments.end(); ++opIt)
operands.push_back(*opIt); opOperands.push_back(*opIt);
return createAtomicOperation(node->getOp(), precision, resultType(), operands, typeProxy, return createAtomicOperation(node->getOp(), precision, resultType(), opOperands, typeProxy,
lvalueCoherentFlags); lvalueCoherentFlags);
// END @MEWIN
} }
} }
@ -8023,8 +8029,10 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
} }
for (auto opIt = operands.begin(); opIt != operands.end(); ++opIt) { for (auto opIt = operands.begin(); opIt != operands.end(); ++opIt) {
spv::IdImmediate op = { true, *opIt }; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
spvGroupOperands.push_back(op); spv::IdImmediate opImmediate = { true, *opIt };
spvGroupOperands.push_back(opImmediate);
// END @MEWIN
} }
switch (op) { switch (op) {
@ -9375,24 +9383,24 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
{ {
builder.addExtension(spv::E_SPV_EXT_shader_tile_image); builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
spv::Decoration precision; spv::Decoration precisionDec; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
spv::Op spv_op; spv::Op spv_op;
if (op == glslang::EOpStencilAttachmentReadEXT) if (op == glslang::EOpStencilAttachmentReadEXT)
{ {
precision = spv::DecorationRelaxedPrecision; precisionDec = spv::DecorationRelaxedPrecision; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
spv_op = spv::OpStencilAttachmentReadEXT; spv_op = spv::OpStencilAttachmentReadEXT;
builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT); builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT);
} }
else else
{ {
precision = spv::NoPrecision; precisionDec = spv::NoPrecision; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
spv_op = spv::OpDepthAttachmentReadEXT; spv_op = spv::OpDepthAttachmentReadEXT;
builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT); builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT);
} }
std::vector<spv::Id> args; // Dummy args std::vector<spv::Id> args; // Dummy args
spv::Id result = builder.createOp(spv_op, typeId, args); spv::Id result = builder.createOp(spv_op, typeId, args);
return builder.setPrecision(result, precision); return builder.setPrecision(result, precisionDec); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
} }
default: default:
break; break;
@ -9425,9 +9433,11 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
builtIn == spv::BuiltInWorldToObjectKHR; builtIn == spv::BuiltInWorldToObjectKHR;
if (mayNeedToReuseBuiltIn) { if (mayNeedToReuseBuiltIn) {
auto iter = builtInVariableIds.find(uint32_t(builtIn)); // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (builtInVariableIds.end() != iter) { auto iterBuiltin = builtInVariableIds.find(uint32_t(builtIn));
id = iter->second; if (builtInVariableIds.end() != iterBuiltin) {
id = iterBuiltin->second;
// END @MEWIN
symbolValues[symbol->getId()] = id; symbolValues[symbol->getId()] = id;
if (forcedType.second != spv::NoType) if (forcedType.second != spv::NoType)
forceType[id] = forcedType.second; forceType[id] = forcedType.second;

View File

@ -312,14 +312,16 @@ namespace spv {
literal.reserve(16); literal.reserve(16);
do { do {
spirword_t word = *pos; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
spirword_t posWord = *pos;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
char c = word & 0xff; char c = posWord & 0xff;
if (c == '\0') if (c == '\0')
return literal; return literal;
literal += c; literal += c;
word >>= 8; posWord >>= 8;
} }
// END @MEWIN
pos++; pos++;
} while (true); } while (true);
} }

View File

@ -873,7 +873,7 @@ Id Builder::makeIntegerDebugType(int const width, bool const hasSign)
type = groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic][t]; type = groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic][t];
if (type->getIdOperand(0) == nameId && if (type->getIdOperand(0) == nameId &&
type->getIdOperand(1) == static_cast<unsigned int>(width) && type->getIdOperand(1) == static_cast<unsigned int>(width) &&
type->getIdOperand(2) == (hasSign ? NonSemanticShaderDebugInfo100Signed : NonSemanticShaderDebugInfo100Unsigned)) type->getIdOperand(2) == static_cast<unsigned int>(hasSign ? NonSemanticShaderDebugInfo100Signed : NonSemanticShaderDebugInfo100Unsigned)) // @MEWIN - 2024-06-26 - Fixed comparison warning.
return type->getResultId(); return type->getResultId();
} }
@ -1156,7 +1156,7 @@ Id Builder::createDebugLocalVariable(Id type, char const*const name, size_t cons
inst->addIdOperand(currentDebugScopeId.top()); // scope id inst->addIdOperand(currentDebugScopeId.top()); // scope id
inst->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsLocal)); // flags id inst->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsLocal)); // flags id
if(argNumber != 0) { if(argNumber != 0) {
inst->addIdOperand(makeUintConstant(argNumber)); inst->addIdOperand(makeUintConstant(static_cast<unsigned>(argNumber))); // @MEWIN - 2024-06-26 - Fixed cast warning.
} }
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst)); constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
@ -1945,7 +1945,7 @@ void Builder::addDecoration(Id id, Decoration decoration, const std::vector<unsi
decorations.push_back(std::unique_ptr<Instruction>(dec)); decorations.push_back(std::unique_ptr<Instruction>(dec));
} }
void Builder::addDecoration(Id id, Decoration decoration, const std::vector<const char*>& strings) void Builder::addDecoration(Id id, Decoration decoration, const std::vector<const char*>& stringOps) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
if (decoration == spv::DecorationMax) if (decoration == spv::DecorationMax)
return; return;
@ -1953,8 +1953,10 @@ void Builder::addDecoration(Id id, Decoration decoration, const std::vector<cons
Instruction* dec = new Instruction(OpDecorateString); Instruction* dec = new Instruction(OpDecorateString);
dec->addIdOperand(id); dec->addIdOperand(id);
dec->addImmediateOperand(decoration); dec->addImmediateOperand(decoration);
for (auto string : strings) // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
dec->addStringOperand(string); for (auto stringOp : stringOps)
dec->addStringOperand(stringOp);
// END @MEWIN
decorations.push_back(std::unique_ptr<Instruction>(dec)); decorations.push_back(std::unique_ptr<Instruction>(dec));
} }
@ -2041,7 +2043,7 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
decorations.push_back(std::unique_ptr<Instruction>(dec)); decorations.push_back(std::unique_ptr<Instruction>(dec));
} }
void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, const std::vector<const char*>& strings) void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, const std::vector<const char*>& stringOps) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
if (decoration == spv::DecorationMax) if (decoration == spv::DecorationMax)
return; return;
@ -2050,8 +2052,10 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
dec->addIdOperand(id); dec->addIdOperand(id);
dec->addImmediateOperand(member); dec->addImmediateOperand(member);
dec->addImmediateOperand(decoration); dec->addImmediateOperand(decoration);
for (auto string : strings) // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
dec->addStringOperand(string); for (auto stringOp : stringOps)
dec->addStringOperand(stringOp);
// END @MEWIN
decorations.push_back(std::unique_ptr<Instruction>(dec)); decorations.push_back(std::unique_ptr<Instruction>(dec));
} }
@ -2064,7 +2068,7 @@ Function* Builder::makeEntryPoint(const char* entryPoint)
Block* entry; Block* entry;
std::vector<Id> paramsTypes; std::vector<Id> paramsTypes;
std::vector<char const*> paramNames; std::vector<char const*> paramNames;
std::vector<std::vector<Decoration>> decorations; std::vector<std::vector<Decoration>> decos; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
auto const returnType = makeVoidType(); auto const returnType = makeVoidType();
@ -2073,7 +2077,7 @@ Function* Builder::makeEntryPoint(const char* entryPoint)
emitNonSemanticShaderDebugInfo = false; emitNonSemanticShaderDebugInfo = false;
} }
entryPointFunction = makeFunctionEntry(NoPrecision, returnType, entryPoint, LinkageTypeMax, paramsTypes, paramNames, decorations, &entry); entryPointFunction = makeFunctionEntry(NoPrecision, returnType, entryPoint, LinkageTypeMax, paramsTypes, paramNames, decos, &entry); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo; emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo;
@ -2083,7 +2087,7 @@ Function* Builder::makeEntryPoint(const char* entryPoint)
// Comments in header // Comments in header
Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const char* name, LinkageType linkType, Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const char* name, LinkageType linkType,
const std::vector<Id>& paramTypes, const std::vector<char const*>& paramNames, const std::vector<Id>& paramTypes, const std::vector<char const*>& paramNames,
const std::vector<std::vector<Decoration>>& decorations, Block **entry) const std::vector<std::vector<Decoration>>& decos, Block **entry) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
// Make the function and initial instructions in it // Make the function and initial instructions in it
Id typeId = makeFunctionType(returnType, paramTypes); Id typeId = makeFunctionType(returnType, paramTypes);
@ -2094,10 +2098,12 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const
// Set up the precisions // Set up the precisions
setPrecision(function->getId(), precision); setPrecision(function->getId(), precision);
function->setReturnPrecision(precision); function->setReturnPrecision(precision);
for (unsigned p = 0; p < (unsigned)decorations.size(); ++p) { // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
for (int d = 0; d < (int)decorations[p].size(); ++d) { for (unsigned p = 0; p < (unsigned)decos.size(); ++p) {
addDecoration(firstParamId + p, decorations[p][d]); for (int d = 0; d < (int)decos[p].size(); ++d) {
function->addParamPrecision(p, decorations[p][d]); addDecoration(firstParamId + p, decos[p][d]);
function->addParamPrecision(p, decos[p][d]);
// END @MEWIN
} }
} }
@ -2135,9 +2141,9 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const
}; };
auto const& paramName = paramNames[p]; auto const& paramName = paramNames[p];
auto const debugLocalVariableId = createDebugLocalVariable(debugId[getParamTypeId(paramTypes[p])], paramName, p+1); auto const debugLocalVariableId = createDebugLocalVariable(debugId[getParamTypeId(paramTypes[p])], paramName, p+1);
debugId[firstParamId + p] = debugLocalVariableId; debugId[static_cast<unsigned>(firstParamId + p)] = debugLocalVariableId; // @MEWIN - 2024-06-26 - Fixed cast warning.
makeDebugDeclare(debugLocalVariableId, firstParamId + p); makeDebugDeclare(debugLocalVariableId, static_cast<spv::Id>(firstParamId + p)); // @MEWIN - 2024-06-26 - Fixed cast warning.
} }
} }

View File

@ -246,9 +246,11 @@ void Builder::postProcess(Instruction& inst)
// (set via Builder::AccessChain::alignment) only accounts for the base of // (set via Builder::AccessChain::alignment) only accounts for the base of
// the reference type and any scalar component selection in the accesschain, // the reference type and any scalar component selection in the accesschain,
// and this function computes the rest from the SPIR-V Offset decorations. // and this function computes the rest from the SPIR-V Offset decorations.
Instruction *accessChain = module.getInstruction(inst.getIdOperand(0)); // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (accessChain->getOpCode() == OpAccessChain) { Instruction *accChain = module.getInstruction(inst.getIdOperand(0));
Instruction *base = module.getInstruction(accessChain->getIdOperand(0)); if (accChain->getOpCode() == OpAccessChain) {
Instruction *base = module.getInstruction(accChain->getIdOperand(0));
// END @MEWIN
// Get the type of the base of the access chain. It must be a pointer type. // Get the type of the base of the access chain. It must be a pointer type.
Id typeId = base->getTypeId(); Id typeId = base->getTypeId();
Instruction *type = module.getInstruction(typeId); Instruction *type = module.getInstruction(typeId);
@ -264,8 +266,10 @@ void Builder::postProcess(Instruction& inst)
// Offset/ArrayStride/MatrixStride decorations, and bitwise OR them all // Offset/ArrayStride/MatrixStride decorations, and bitwise OR them all
// together. // together.
int alignment = 0; int alignment = 0;
for (int i = 1; i < accessChain->getNumOperands(); ++i) { // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
Instruction *idx = module.getInstruction(accessChain->getIdOperand(i)); for (int i = 1; i < accChain->getNumOperands(); ++i) {
Instruction *idx = module.getInstruction(accChain->getIdOperand(i));
// END @MEWIN
if (type->getOpCode() == OpTypeStruct) { if (type->getOpCode() == OpTypeStruct) {
assert(idx->getOpCode() == OpConstant); assert(idx->getOpCode() == OpConstant);
unsigned int c = idx->getImmediateOperand(0); unsigned int c = idx->getImmediateOperand(0);

View File

@ -2772,7 +2772,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
return true; return true;
} }
void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage language, TSymbolTable& symbolTable) void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage linkLanguage, TSymbolTable& symbolTable) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
// Add top-level nodes for declarations that must be checked cross // Add top-level nodes for declarations that must be checked cross
// compilation unit by a linker, yet might not have been referenced // compilation unit by a linker, yet might not have been referenced
@ -2795,7 +2795,7 @@ void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguag
// addSymbolLinkageNode(root, symbolTable, "gl_ModelViewProjectionMatrix"); // addSymbolLinkageNode(root, symbolTable, "gl_ModelViewProjectionMatrix");
//} //}
if (language == EShLangVertex) { if (linkLanguage == EShLangVertex) { // @MEWIN - 2024-06-26 - Fixed shadowing warning.
// the names won't be found in the symbol table unless the versions are right, // the names won't be found in the symbol table unless the versions are right,
// so version logic does not need to be repeated here // so version logic does not need to be repeated here
addSymbolLinkageNode(linkage, symbolTable, "gl_VertexID"); addSymbolLinkageNode(linkage, symbolTable, "gl_VertexID");

View File

@ -190,10 +190,10 @@ void TParseContext::setLimits(const TBuiltInResource& r)
// //
// Returns true for successful acceptance of the shader, false if any errors. // Returns true for successful acceptance of the shader, false if any errors.
// //
bool TParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& input, bool versionWillBeError) bool TParseContext::parseShaderStrings(TPpContext& ppCtx, TInputScanner& input, bool versionWillBeError) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
currentScanner = &input; currentScanner = &input;
ppContext.setInput(input, versionWillBeError); ppCtx.setInput(input, versionWillBeError); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
yyparse(this); yyparse(this);
finish(); finish();
@ -4918,17 +4918,19 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
// Either redeclare the requested block, or give an error message why it can't be done. // Either redeclare the requested block, or give an error message why it can't be done.
// //
// TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size // TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size
void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blkName, // @MEWIN - 2024-06-26 - Fixed shadowing warning.
const TString* instanceName, TArraySizes* arraySizes) const TString* instanceName, TArraySizes* arraySizes)
{ {
const char* feature = "built-in block redeclaration"; const char* feature = "built-in block redeclaration";
profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature);
if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment" && // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
blockName != "gl_MeshPerVertexNV" && blockName != "gl_MeshPerPrimitiveNV" && if (blkName != "gl_PerVertex" && blkName != "gl_PerFragment" &&
blockName != "gl_MeshPerVertexEXT" && blockName != "gl_MeshPerPrimitiveEXT") { blkName != "gl_MeshPerVertexNV" && blkName != "gl_MeshPerPrimitiveNV" &&
error(loc, "cannot redeclare block: ", "block declaration", blockName.c_str()); blkName != "gl_MeshPerVertexEXT" && blkName != "gl_MeshPerPrimitiveEXT") {
error(loc, "cannot redeclare block: ", "block declaration", blkName.c_str());
// END @MEWIN
return; return;
} }
@ -4958,7 +4960,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
// Built-in blocks cannot be redeclared more than once, which if happened, // Built-in blocks cannot be redeclared more than once, which if happened,
// we'd be finding the already redeclared one here, rather than the built in. // we'd be finding the already redeclared one here, rather than the built in.
if (! builtIn) { if (! builtIn) {
error(loc, "can only redeclare a built-in block once, and before any use", blockName.c_str(), ""); error(loc, "can only redeclare a built-in block once, and before any use", blkName.c_str(), ""); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
return; return;
} }
@ -5101,10 +5103,10 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
} }
if (numOriginalMembersFound < newTypeList.size()) if (numOriginalMembersFound < newTypeList.size())
error(loc, "block redeclaration has extra members", blockName.c_str(), ""); error(loc, "block redeclaration has extra members", blkName.c_str(), ""); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (type.isArray() != (arraySizes != nullptr) || if (type.isArray() != (arraySizes != nullptr) ||
(type.isArray() && arraySizes != nullptr && type.getArraySizes()->getNumDims() != arraySizes->getNumDims())) (type.isArray() && arraySizes != nullptr && type.getArraySizes()->getNumDims() != arraySizes->getNumDims()))
error(loc, "cannot change arrayness of redeclared block", blockName.c_str(), ""); error(loc, "cannot change arrayness of redeclared block", blkName.c_str(), ""); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
else if (type.isArray()) { else if (type.isArray()) {
// At this point, we know both are arrays and both have the same number of dimensions. // At this point, we know both are arrays and both have the same number of dimensions.
@ -5119,7 +5121,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
// Now, they must match in all dimensions. // Now, they must match in all dimensions.
if (type.isSizedArray() && *type.getArraySizes() != *arraySizes) if (type.isSizedArray() && *type.getArraySizes() != *arraySizes)
error(loc, "cannot change array size of redeclared block", blockName.c_str(), ""); error(loc, "cannot change array size of redeclared block", blkName.c_str(), ""); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
} }
symbolTable.insert(*block); symbolTable.insert(*block);
@ -5521,7 +5523,7 @@ void TParseContext::finish()
// This is before we know any type information for error checking. // This is before we know any type information for error checking.
void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id) void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id)
{ {
std::transform(id.begin(), id.end(), id.begin(), ::tolower); std::transform(id.begin(), id.end(), id.begin(), [](char chr) { return static_cast<char>(::tolower(chr));} ); // @MEWIN - 2024-06-26 - Fixed conversion warning.
if (id == TQualifier::getLayoutMatrixString(ElmColumnMajor)) { if (id == TQualifier::getLayoutMatrixString(ElmColumnMajor)) {
publicType.qualifier.layoutMatrix = ElmColumnMajor; publicType.qualifier.layoutMatrix = ElmColumnMajor;
@ -5884,18 +5886,18 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
return; return;
} }
std::transform(id.begin(), id.end(), id.begin(), ::tolower); std::transform(id.begin(), id.end(), id.begin(), [](char chr) { return static_cast<char>(::tolower(chr));} ); // @MEWIN - 2024-06-26 - Fixed conversion warning.
if (id == "offset") { if (id == "offset") {
// "offset" can be for either // "offset" can be for either
// - uniform offsets // - uniform offsets
// - atomic_uint offsets // - atomic_uint offsets
const char* feature = "offset"; const char* fture = "offset"; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (spvVersion.spv == 0) { if (spvVersion.spv == 0) {
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature); requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
const char* exts[2] = { E_GL_ARB_enhanced_layouts, E_GL_ARB_shader_atomic_counters }; const char* exts[2] = { E_GL_ARB_enhanced_layouts, E_GL_ARB_shader_atomic_counters };
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
profileRequires(loc, EEsProfile, 310, nullptr, feature); profileRequires(loc, EEsProfile, 310, nullptr, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
} }
publicType.qualifier.layoutOffset = value; publicType.qualifier.layoutOffset = value;
publicType.qualifier.explicitOffset = true; publicType.qualifier.explicitOffset = true;
@ -5903,10 +5905,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
error(loc, "needs a literal integer", "offset", ""); error(loc, "needs a literal integer", "offset", "");
return; return;
} else if (id == "align") { } else if (id == "align") {
const char* feature = "uniform buffer-member align"; const char* fture = "uniform buffer-member align"; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (spvVersion.spv == 0) { if (spvVersion.spv == 0) {
requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature); requireProfile(loc, ECoreProfile | ECompatibilityProfile, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
} }
// "The specified alignment must be a power of 2, or a compile-time error results." // "The specified alignment must be a power of 2, or a compile-time error results."
if (! IsPow2(value)) if (! IsPow2(value))
@ -5998,10 +6000,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
// capturing mode and hence responsible for describing the transform feedback // capturing mode and hence responsible for describing the transform feedback
// setup." // setup."
intermediate.setXfbMode(); intermediate.setXfbMode();
const char* feature = "transform feedback qualifier"; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
requireStage(loc, (EShLanguageMask)(EShLangVertexMask | EShLangGeometryMask | EShLangTessControlMask | EShLangTessEvaluationMask), feature); const char* fture = "transform feedback qualifier";
requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature); requireStage(loc, (EShLanguageMask)(EShLangVertexMask | EShLangGeometryMask | EShLangTessControlMask | EShLangTessEvaluationMask), fture);
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature); requireProfile(loc, ECoreProfile | ECompatibilityProfile, fture);
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, fture);
// END @MEWIN
if (id == "xfb_buffer") { if (id == "xfb_buffer") {
// "It is a compile-time error to specify an *xfb_buffer* that is greater than // "It is a compile-time error to specify an *xfb_buffer* that is greater than
// the implementation-dependent constant gl_MaxTransformFeedbackBuffers." // the implementation-dependent constant gl_MaxTransformFeedbackBuffers."
@ -8089,7 +8093,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EOpConstructUVec2: case EOpConstructUVec2:
if (node->getType().getBasicType() == EbtReference) { if (node->getType().getBasicType() == EbtReference) {
requireExtensions(loc, 1, &E_GL_EXT_buffer_reference_uvec2, "reference conversion to uvec2"); requireExtensions(loc, 1, &E_GL_EXT_buffer_reference_uvec2, "reference conversion to uvec2");
TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUvec2, true, node, newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUvec2, true, node, // @MEWIN - 2024-06-26 - Fixed shadowing warning.
type); type);
return newNode; return newNode;
} else if (node->getType().getBasicType() == EbtSampler) { } else if (node->getType().getBasicType() == EbtSampler) {
@ -8099,7 +8103,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
TIntermTyped* newSrcNode = intermediate.createConversion(EbtUint, node); TIntermTyped* newSrcNode = intermediate.createConversion(EbtUint, node);
newSrcNode->getAsTyped()->getWritableType().setVectorSize(2); newSrcNode->getAsTyped()->getWritableType().setVectorSize(2);
TIntermTyped* newNode = newNode = // @MEWIN - 2024-06-26 - Fixed shadowing warning.
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructUVec2, false, newSrcNode, type); intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructUVec2, false, newSrcNode, type);
return newNode; return newNode;
} }
@ -8121,7 +8125,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
node->getType().getVectorSize() == 2) { node->getType().getVectorSize() == 2) {
requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "ivec2/uvec2 convert to texture handle"); requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "ivec2/uvec2 convert to texture handle");
// No matter ivec2 or uvec2, Set EOpPackUint2x32 just to generate an opBitcast op code // No matter ivec2 or uvec2, Set EOpPackUint2x32 just to generate an opBitcast op code
TIntermTyped* newNode = newNode = // @MEWIN - 2024-06-26 - Fixed shadowing warning.
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type); intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type);
return newNode; return newNode;
} }
@ -8275,7 +8279,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EOpConstructUint64: case EOpConstructUint64:
if (type.isScalar() && node->getType().isReference()) { if (type.isScalar() && node->getType().isReference()) {
TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUint64, true, node, type); newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUint64, true, node, type); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
return newNode; return newNode;
} }
// fall through // fall through
@ -8297,14 +8301,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
return newNode; return newNode;
// construct reference from uint64 // construct reference from uint64
} else if (node->getType().isScalar() && node->getType().getBasicType() == EbtUint64) { } else if (node->getType().isScalar() && node->getType().getBasicType() == EbtUint64) {
TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUint64ToPtr, true, node, newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUint64ToPtr, true, node, // @MEWIN - 2024-06-26 - Fixed shadowing warning.
type); type);
return newNode; return newNode;
// construct reference from uvec2 // construct reference from uvec2
} else if (node->getType().isVector() && node->getType().getBasicType() == EbtUint && } else if (node->getType().isVector() && node->getType().getBasicType() == EbtUint &&
node->getVectorSize() == 2) { node->getVectorSize() == 2) {
requireExtensions(loc, 1, &E_GL_EXT_buffer_reference_uvec2, "uvec2 conversion to reference"); requireExtensions(loc, 1, &E_GL_EXT_buffer_reference_uvec2, "uvec2 conversion to reference");
TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUvec2ToPtr, true, node, newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUvec2ToPtr, true, node, // @MEWIN - 2024-06-26 - Fixed shadowing warning.
type); type);
return newNode; return newNode;
} else { } else {
@ -8324,32 +8328,36 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
} }
node = intermediate.setAggregateOperator(node, op, type, node->getLoc()); node = intermediate.setAggregateOperator(node, op, type, node->getLoc());
} else { } else {
TOperator op = EOpNull; TOperator nodeOp = EOpNull; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
switch (type.getBasicType()) { switch (type.getBasicType()) {
default: default:
assert(0); assert(0);
break; break;
case EbtInt: case EbtInt:
switch (node->getType().getBasicType()) { switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToInt; break; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
case EbtFloat16: op = EOpConvFloat16ToInt; break; case EbtFloat: nodeOp = EOpConvFloatToInt; break;
case EbtUint8: op = EOpConvUint8ToInt; break; case EbtFloat16: nodeOp = EOpConvFloat16ToInt; break;
case EbtInt8: op = EOpConvInt8ToInt; break; case EbtUint8: nodeOp = EOpConvUint8ToInt; break;
case EbtUint16: op = EOpConvUint16ToInt; break; case EbtInt8: nodeOp = EOpConvInt8ToInt; break;
case EbtInt16: op = EOpConvInt16ToInt; break; case EbtUint16: nodeOp = EOpConvUint16ToInt; break;
case EbtUint: op = EOpConvUintToInt; break; case EbtInt16: nodeOp = EOpConvInt16ToInt; break;
case EbtUint: nodeOp = EOpConvUintToInt; break;
// END @MEWIN
default: assert(0); default: assert(0);
} }
break; break;
case EbtUint: case EbtUint:
switch (node->getType().getBasicType()) { switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToUint; break; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
case EbtFloat16: op = EOpConvFloat16ToUint; break; case EbtFloat: nodeOp = EOpConvFloatToUint; break;
case EbtUint8: op = EOpConvUint8ToUint; break; case EbtFloat16: nodeOp = EOpConvFloat16ToUint; break;
case EbtInt8: op = EOpConvInt8ToUint; break; case EbtUint8: nodeOp = EOpConvUint8ToUint; break;
case EbtUint16: op = EOpConvUint16ToUint; break; case EbtInt8: nodeOp = EOpConvInt8ToUint; break;
case EbtInt16: op = EOpConvInt16ToUint; break; case EbtUint16: nodeOp = EOpConvUint16ToUint; break;
case EbtInt: op = EOpConvIntToUint; break; case EbtInt16: nodeOp = EOpConvInt16ToUint; break;
case EbtInt: nodeOp = EOpConvIntToUint; break;
// END @MEWIN
default: assert(0); default: assert(0);
} }
break; break;
@ -8367,61 +8375,71 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
break; break;
case EbtUint16: case EbtUint16:
switch (node->getType().getBasicType()) { switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToUint16; break; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
case EbtFloat16: op = EOpConvFloat16ToUint16; break; case EbtFloat: nodeOp = EOpConvFloatToUint16; break;
case EbtUint8: op = EOpConvUint8ToUint16; break; case EbtFloat16: nodeOp = EOpConvFloat16ToUint16; break;
case EbtInt8: op = EOpConvInt8ToUint16; break; case EbtUint8: nodeOp = EOpConvUint8ToUint16; break;
case EbtInt16: op = EOpConvInt16ToUint16; break; case EbtInt8: nodeOp = EOpConvInt8ToUint16; break;
case EbtInt: op = EOpConvIntToUint16; break; case EbtInt16: nodeOp = EOpConvInt16ToUint16; break;
case EbtUint: op = EOpConvUintToUint16; break; case EbtInt: nodeOp = EOpConvIntToUint16; break;
case EbtUint: nodeOp = EOpConvUintToUint16; break;
// END @MEWIN
default: assert(0); default: assert(0);
} }
break; break;
case EbtInt8: case EbtInt8:
switch (node->getType().getBasicType()) { switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToInt8; break; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
case EbtFloat16: op = EOpConvFloat16ToInt8; break; case EbtFloat: nodeOp = EOpConvFloatToInt8; break;
case EbtUint8: op = EOpConvUint8ToInt8; break; case EbtFloat16: nodeOp = EOpConvFloat16ToInt8; break;
case EbtInt16: op = EOpConvInt16ToInt8; break; case EbtUint8: nodeOp = EOpConvUint8ToInt8; break;
case EbtUint16: op = EOpConvUint16ToInt8; break; case EbtInt16: nodeOp = EOpConvInt16ToInt8; break;
case EbtInt: op = EOpConvIntToInt8; break; case EbtUint16: nodeOp = EOpConvUint16ToInt8; break;
case EbtUint: op = EOpConvUintToInt8; break; case EbtInt: nodeOp = EOpConvIntToInt8; break;
case EbtUint: nodeOp = EOpConvUintToInt8; break;
// END @MEWIN
default: assert(0); default: assert(0);
} }
break; break;
case EbtUint8: case EbtUint8:
switch (node->getType().getBasicType()) { switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToUint8; break; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
case EbtFloat16: op = EOpConvFloat16ToUint8; break; case EbtFloat: nodeOp = EOpConvFloatToUint8; break;
case EbtInt8: op = EOpConvInt8ToUint8; break; case EbtFloat16: nodeOp = EOpConvFloat16ToUint8; break;
case EbtInt16: op = EOpConvInt16ToUint8; break; case EbtInt8: nodeOp = EOpConvInt8ToUint8; break;
case EbtUint16: op = EOpConvUint16ToUint8; break; case EbtInt16: nodeOp = EOpConvInt16ToUint8; break;
case EbtInt: op = EOpConvIntToUint8; break; case EbtUint16: nodeOp = EOpConvUint16ToUint8; break;
case EbtUint: op = EOpConvUintToUint8; break; case EbtInt: nodeOp = EOpConvIntToUint8; break;
case EbtUint: nodeOp = EOpConvUintToUint8; break;
// END @MEWIN
default: assert(0); default: assert(0);
} }
break; break;
case EbtFloat: case EbtFloat:
switch (node->getType().getBasicType()) { switch (node->getType().getBasicType()) {
case EbtFloat16: op = EOpConvFloat16ToFloat; break; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
case EbtInt8: op = EOpConvInt8ToFloat; break; case EbtFloat16: nodeOp = EOpConvFloat16ToFloat; break;
case EbtUint8: op = EOpConvUint8ToFloat; break; case EbtInt8: nodeOp = EOpConvInt8ToFloat; break;
case EbtInt16: op = EOpConvInt16ToFloat; break; case EbtUint8: nodeOp = EOpConvUint8ToFloat; break;
case EbtUint16: op = EOpConvUint16ToFloat; break; case EbtInt16: nodeOp = EOpConvInt16ToFloat; break;
case EbtInt: op = EOpConvIntToFloat; break; case EbtUint16: nodeOp = EOpConvUint16ToFloat; break;
case EbtUint: op = EOpConvUintToFloat; break; case EbtInt: nodeOp = EOpConvIntToFloat; break;
case EbtUint: nodeOp = EOpConvUintToFloat; break;
// END @MEWIN
default: assert(0); default: assert(0);
} }
break; break;
case EbtFloat16: case EbtFloat16:
switch (node->getType().getBasicType()) { switch (node->getType().getBasicType()) {
case EbtFloat: op = EOpConvFloatToFloat16; break; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
case EbtInt8: op = EOpConvInt8ToFloat16; break; case EbtFloat: nodeOp = EOpConvFloatToFloat16; break;
case EbtUint8: op = EOpConvUint8ToFloat16; break; case EbtInt8: nodeOp = EOpConvInt8ToFloat16; break;
case EbtInt16: op = EOpConvInt16ToFloat16; break; case EbtUint8: nodeOp = EOpConvUint8ToFloat16; break;
case EbtUint16: op = EOpConvUint16ToFloat16; break; case EbtInt16: nodeOp = EOpConvInt16ToFloat16; break;
case EbtInt: op = EOpConvIntToFloat16; break; case EbtUint16: nodeOp = EOpConvUint16ToFloat16; break;
case EbtUint: op = EOpConvUintToFloat16; break; case EbtInt: nodeOp = EOpConvIntToFloat16; break;
case EbtUint: nodeOp = EOpConvUintToFloat16; break;
// END @MEWIN
default: assert(0); default: assert(0);
} }
break; break;
@ -9730,10 +9748,12 @@ const TTypeList* TParseContext::recordStructCopy(TStructRecord& record, const TT
size_t originHash = 0, tmpHash = 0; size_t originHash = 0, tmpHash = 0;
std::hash<size_t> hasher; std::hash<size_t> hasher;
for (size_t i = 0; i < memberCount; i++) { for (size_t i = 0; i < memberCount; i++) {
size_t originMemberHash = hasher(originType->getStruct()->at(i).type->getQualifier().layoutPacking + // BEGIN @MEWIN - 2024-06-26 - Fixed cast warnings.
originType->getStruct()->at(i).type->getQualifier().layoutMatrix); size_t originMemberHash = hasher(static_cast<int>(originType->getStruct()->at(i).type->getQualifier().layoutPacking) +
size_t tmpMemberHash = hasher(tmpType->getStruct()->at(i).type->getQualifier().layoutPacking + static_cast<int>(originType->getStruct()->at(i).type->getQualifier().layoutMatrix));
tmpType->getStruct()->at(i).type->getQualifier().layoutMatrix); size_t tmpMemberHash = hasher(static_cast<int>(tmpType->getStruct()->at(i).type->getQualifier().layoutPacking) +
static_cast<int>(tmpType->getStruct()->at(i).type->getQualifier().layoutMatrix));
// END @MEWIN
originHash = hasher((originHash ^ originMemberHash) << 1); originHash = hasher((originHash ^ originMemberHash) << 1);
tmpHash = hasher((tmpHash ^ tmpMemberHash) << 1); tmpHash = hasher((tmpHash ^ tmpMemberHash) << 1);
} }

View File

@ -136,10 +136,10 @@ public:
virtual bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) = 0; virtual bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) = 0;
virtual void notifyVersion(int line, int version, const char* type_string) virtual void notifyVersion(int line, int vers, const char* type_string) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
if (versionCallback) if (versionCallback)
versionCallback(line, version, type_string); versionCallback(line, vers, type_string); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
} }
virtual void notifyErrorDirective(int line, const char* error_message) virtual void notifyErrorDirective(int line, const char* error_message)
{ {

View File

@ -825,15 +825,17 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
{ {
do { do {
parserToken = &token; parserToken = &token;
TPpToken ppToken; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
int token = pp->tokenize(ppToken); TPpToken ppTkn;
if (token == EndOfInput) int tkn = pp->tokenize(ppTkn);
if (tkn == EndOfInput)
return 0; return 0;
tokenText = ppToken.name; tokenText = ppTkn.name;
loc = ppToken.loc; loc = ppTkn.loc;
parserToken->sType.lex.loc = loc; parserToken->sType.lex.loc = loc;
switch (token) { switch (tkn) {
// END @MEWIN
case ';': afterType = false; afterBuffer = false; return SEMICOLON; case ';': afterType = false; afterBuffer = false; return SEMICOLON;
case ',': afterType = false; return COMMA; case ',': afterType = false; return COMMA;
case ':': return COLON; case ':': return COLON;
@ -894,27 +896,29 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
break; break;
case PpAtomConstString: parserToken->sType.lex.string = NewPoolTString(tokenText); return STRING_LITERAL; case PpAtomConstString: parserToken->sType.lex.string = NewPoolTString(tokenText); return STRING_LITERAL;
case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT; // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT; case PpAtomConstInt: parserToken->sType.lex.i = ppTkn.ival; return INTCONSTANT;
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT; case PpAtomConstUint: parserToken->sType.lex.i = ppTkn.ival; return UINTCONSTANT;
case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT; case PpAtomConstFloat: parserToken->sType.lex.d = ppTkn.dval; return FLOATCONSTANT;
case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT; case PpAtomConstInt16: parserToken->sType.lex.i = ppTkn.ival; return INT16CONSTANT;
case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT; case PpAtomConstUint16: parserToken->sType.lex.i = ppTkn.ival; return UINT16CONSTANT;
case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT; case PpAtomConstInt64: parserToken->sType.lex.i64 = ppTkn.i64val; return INT64CONSTANT;
case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT; case PpAtomConstUint64: parserToken->sType.lex.i64 = ppTkn.i64val; return UINT64CONSTANT;
case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT; case PpAtomConstDouble: parserToken->sType.lex.d = ppTkn.dval; return DOUBLECONSTANT;
case PpAtomConstFloat16: parserToken->sType.lex.d = ppTkn.dval; return FLOAT16CONSTANT;
case PpAtomIdentifier: case PpAtomIdentifier:
{ {
int token = tokenizeIdentifier(); int tkn2 = tokenizeIdentifier();
field = false; field = false;
return token; return tkn2;
} }
// END @MEWIN
case EndOfInput: return 0; case EndOfInput: return 0;
default: default:
char buf[2]; char buf[2];
buf[0] = (char)token; buf[0] = (char)tkn; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
buf[1] = 0; buf[1] = 0;
parseContext.error(loc, "unexpected token", buf, ""); parseContext.error(loc, "unexpected token", buf, "");
break; break;

View File

@ -273,9 +273,9 @@ public:
// Install 'this' as the first parameter. // Install 'this' as the first parameter.
// 'this' is reflected in the list of parameters, but not the mangled name. // 'this' is reflected in the list of parameters, but not the mangled name.
virtual void addThisParameter(TType& type, const char* name) virtual void addThisParameter(TType& type, const char* paramName) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
TParameter p = { NewPoolTString(name), new TType, nullptr }; TParameter p = { NewPoolTString(paramName), new TType, nullptr }; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
p.type->shallowCopy(type); p.type->shallowCopy(type);
parameters.insert(parameters.begin(), p); parameters.insert(parameters.begin(), p);
} }

View File

@ -1377,9 +1377,9 @@ void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op)
if (spvVersion.spv == 0) if (spvVersion.spv == 0)
error(loc, "only allowed when generating SPIR-V", op, ""); error(loc, "only allowed when generating SPIR-V", op, "");
} }
void TParseVersions::requireSpv(const TSourceLoc& loc, const char *op, unsigned int version) void TParseVersions::requireSpv(const TSourceLoc& loc, const char *op, unsigned int vers) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
if (spvVersion.spv < version) if (spvVersion.spv < vers) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
error(loc, "not supported for current targeted SPIR-V version", op, ""); error(loc, "not supported for current targeted SPIR-V version", op, "");
} }

View File

@ -66,7 +66,7 @@ bool TAttributeArgs::getString(TString& value, int argNum, bool convertToLower)
// Convenience. // Convenience.
if (convertToLower) if (convertToLower)
std::transform(value.begin(), value.end(), value.begin(), ::tolower); std::transform(value.begin(), value.end(), value.begin(), [](char chr) { return static_cast<char>(::tolower(chr));} ); // @MEWIN - 2024-06-26 - Fixed conversion warning.
return true; return true;
} }

View File

@ -219,7 +219,7 @@ struct TResolverUniformAdaptor {
} }
if (ent.symbol->getQualifier().hasBinding()) { if (ent.symbol->getQualifier().hasBinding()) {
for (uint32_t idx = EShLangVertex; idx < EShLangCount; ++idx) { for (int32_t idx = EShLangVertex; idx < EShLangCount; ++idx) { // @MEWIN - 2024-06-26 - Fixed sign comparison warning.
if (idx == ent.stage || uniformVarMap[idx] == nullptr) if (idx == ent.stage || uniformVarMap[idx] == nullptr)
continue; continue;
auto entKey2 = uniformVarMap[idx]->find(entKey.first); auto entKey2 = uniformVarMap[idx]->find(entKey.first);
@ -237,7 +237,7 @@ struct TResolverUniformAdaptor {
error = true; error = true;
} }
if (ent.symbol->getQualifier().hasSet()) { if (ent.symbol->getQualifier().hasSet()) {
for (uint32_t idx = EShLangVertex; idx < EShLangCount; ++idx) { for (int32_t idx = EShLangVertex; idx < EShLangCount; ++idx) { // @MEWIN - 2024-06-26 - Fixed sign comparison warning.
if ((idx == stage) || (uniformVarMap[idx] == nullptr)) if ((idx == stage) || (uniformVarMap[idx] == nullptr))
continue; continue;
auto entKey2 = uniformVarMap[idx]->find(entKey.first); auto entKey2 = uniformVarMap[idx]->find(entKey.first);
@ -313,10 +313,10 @@ private:
struct TSymbolValidater struct TSymbolValidater
{ {
TSymbolValidater(TIoMapResolver& r, TInfoSink& i, TVarLiveMap* in[EShLangCount], TVarLiveMap* out[EShLangCount], TSymbolValidater(TIoMapResolver& r, TInfoSink& iSink, TVarLiveMap* in[EShLangCount], TVarLiveMap* out[EShLangCount], // @MEWIN - 2024-06-26 - Fixed shadowing warning.
TVarLiveMap* uniform[EShLangCount], bool& hadError, EProfile profile, int version) TVarLiveMap* uniform[EShLangCount], bool& hadError, EProfile profile, int version)
: resolver(r) : resolver(r)
, infoSink(i) , infoSink(iSink) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
, hadError(hadError) , hadError(hadError)
, profile(profile) , profile(profile)
, version(version) , version(version)
@ -511,17 +511,17 @@ struct TSymbolValidater
if (type1.getBasicType() == EbtBlock && if (type1.getBasicType() == EbtBlock &&
type1.isStruct() && !type2.isStruct()) { type1.isStruct() && !type2.isStruct()) {
// Iterate through block members tracking layout // Iterate through block members tracking layout
glslang::TString name; glslang::TString typeName; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
type1.getStruct()->begin()->type->appendMangledName(name); type1.getStruct()->begin()->type->appendMangledName(typeName); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (name == mangleName2 if (typeName == mangleName2
&& type1.getQualifier().layoutLocation == type2.getQualifier().layoutLocation) return; && type1.getQualifier().layoutLocation == type2.getQualifier().layoutLocation) return;
} }
if (type2.getBasicType() == EbtBlock && if (type2.getBasicType() == EbtBlock &&
type2.isStruct() && !type1.isStruct()) { type2.isStruct() && !type1.isStruct()) {
// Iterate through block members tracking layout // Iterate through block members tracking layout
glslang::TString name; glslang::TString typeName; // @MEWIN - 2024-06-26 - Fixed shadowing warning.
type2.getStruct()->begin()->type->appendMangledName(name); type2.getStruct()->begin()->type->appendMangledName(typeName); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (name == mangleName1 if (typeName == mangleName1 // @MEWIN - 2024-06-26 - Fixed shadowing warning.
&& type1.getQualifier().layoutLocation == type2.getQualifier().layoutLocation) return; && type1.getQualifier().layoutLocation == type2.getQualifier().layoutLocation) return;
} }
TString err = "Invalid In/Out variable type : " + entKey.first; TString err = "Invalid In/Out variable type : " + entKey.first;

View File

@ -129,9 +129,9 @@ bool TInductiveTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* n
// //
// External function to call for loop check. // External function to call for loop check.
// //
void TParseContext::inductiveLoopBodyCheck(TIntermNode* body, long long loopId, TSymbolTable& symbolTable) void TParseContext::inductiveLoopBodyCheck(TIntermNode* body, long long loopId, TSymbolTable& symbolTbl) // @MEWIN - 2024-06-26 - Fixed shadowing warning.
{ {
TInductiveTraverser it(loopId, symbolTable); TInductiveTraverser it(loopId, symbolTbl); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (body == nullptr) if (body == nullptr)
return; return;

View File

@ -1203,13 +1203,15 @@ bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate)
TReflectionTraverser it(intermediate, *this); TReflectionTraverser it(intermediate, *this);
for (auto& sequnence : intermediate.getTreeRoot()->getAsAggregate()->getSequence()) { // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning.
if (sequnence->getAsAggregate() != nullptr) { for (auto& sequenceA : intermediate.getTreeRoot()->getAsAggregate()->getSequence()) {
if (sequnence->getAsAggregate()->getOp() == glslang::EOpLinkerObjects) { if (sequenceA->getAsAggregate() != nullptr) {
if (sequenceA->getAsAggregate()->getOp() == glslang::EOpLinkerObjects) {
it.updateStageMasks = false; it.updateStageMasks = false;
TIntermAggregate* linkerObjects = sequnence->getAsAggregate(); TIntermAggregate* linkerObjects = sequenceA->getAsAggregate();
for (auto& sequnence : linkerObjects->getSequence()) { for (auto& sequenceB : linkerObjects->getSequence()) {
auto pNode = sequnence->getAsSymbolNode(); auto pNode = sequenceB->getAsSymbolNode();
// END @MEWIN
if (pNode != nullptr) { if (pNode != nullptr) {
if ((pNode->getQualifier().storage == EvqUniform && if ((pNode->getQualifier().storage == EvqUniform &&
(options & EShReflectionSharedStd140UBO)) || (options & EShReflectionSharedStd140UBO)) ||
@ -1239,7 +1241,7 @@ bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate)
// When linke message not been set EShMsgKeepUncalled, linker won't keep uncalled function in AST. // When linke message not been set EShMsgKeepUncalled, linker won't keep uncalled function in AST.
// So, travers all function node can equivalent to travers live function. // So, travers all function node can equivalent to travers live function.
it.updateStageMasks = true; it.updateStageMasks = true;
sequnence->getAsAggregate()->traverse(&it); sequenceA->getAsAggregate()->traverse(&it); // @MEWIN - 2024-06-26 - Fixed shadowing warning.
} }
} }
} }