diff --git a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index 6f41bfa07..e6e3db8bc 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -7035,12 +7035,14 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T TFunction realFunc(&name, function->getType()); + // Use copyParam to avoid shared ownership of the 'type' field + // of the parameter. for (int i = 0; i < function->getParamCount(); ++i) { - realFunc.addParameter((*function)[i]); + realFunc.addParameter(TParameter().copyParam((*function)[i])); } TParameter tmpP = { 0, &uintType }; - realFunc.addParameter(tmpP); + realFunc.addParameter(TParameter().copyParam(tmpP)); arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(1, loc, true)); result = handleFunctionCall(loc, &realFunc, arguments); @@ -7053,11 +7055,11 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T TFunction realFunc(&name, function->getType()); for (int i = 0; i < function->getParamCount(); ++i) { - realFunc.addParameter((*function)[i]); + realFunc.addParameter(TParameter().copyParam((*function)[i])); } TParameter tmpP = { 0, &uintType }; - realFunc.addParameter(tmpP); + realFunc.addParameter(TParameter().copyParam(tmpP)); arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(-1, loc, true)); result = handleFunctionCall(loc, &realFunc, arguments); diff --git a/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp b/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp index a3ffa0c46..2f1b5ac3c 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp @@ -383,7 +383,7 @@ TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf) for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) { TParameter param; parameters.push_back(param); - parameters.back().copyParam(copyOf.parameters[i]); + (void)parameters.back().copyParam(copyOf.parameters[i]); } extensions = nullptr; diff --git a/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h b/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h index 31312ecba..2e570bb3b 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h +++ b/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h @@ -224,7 +224,7 @@ struct TParameter { TString *name; TType* type; TIntermTyped* defaultValue; - void copyParam(const TParameter& param) + TParameter& copyParam(const TParameter& param) { if (param.name) name = NewPoolTString(param.name->c_str()); @@ -232,6 +232,7 @@ struct TParameter { name = 0; type = param.type->clone(); defaultValue = param.defaultValue; + return *this; } TBuiltInVariable getDeclaredBuiltIn() const { return type->getQualifier().declaredBuiltIn; } };