mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 15:06:32 +00:00
Make downstream changes to glslang 16.2.0 to support compiling
* Remove use of newer STL classes like std::filesystem, std::variant and
std::optional.
* Do not use inline variables - the only instance is also static constexpr
* Explicitly initialise std::array variables with type and size (also add extra
{}s to appease an old clang warning)
* Work around old libstdc++ bug with move assignment and non-assignable
allocators
* Remove redundant constexpr that warns on older compilers
* Remove use of declaration-inside-if statements
This commit is contained in:
+19
-12
@@ -69,7 +69,8 @@ namespace spv {
|
||||
#include <iomanip>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
// RD Modification - remove use of std::optional
|
||||
//#include <optional>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -169,7 +170,8 @@ protected:
|
||||
spv::Id convertGlslangToSpvType(const glslang::TType& type, bool forwardReferenceOnly = false);
|
||||
spv::Id convertGlslangToSpvType(const glslang::TType& type, glslang::TLayoutPacking, const glslang::TQualifier&,
|
||||
bool lastBufferBlockMember, bool forwardReferenceOnly = false);
|
||||
void applySpirvDecorate(const glslang::TType& type, spv::Id id, std::optional<int> member);
|
||||
// RD Modification - remove use of std::optional
|
||||
void applySpirvDecorate(const glslang::TType& type, spv::Id id, int* member);
|
||||
bool filterMember(const glslang::TType& member);
|
||||
spv::Id convertGlslangStructToSpvType(const glslang::TType&, const glslang::TTypeList* glslangStruct,
|
||||
glslang::TLayoutPacking, const glslang::TQualifier&);
|
||||
@@ -5268,8 +5270,9 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
|
||||
if (options.emitNonSemanticShaderDebugInfo && storageClass != spv::StorageClass::Function) {
|
||||
// Create variable alias for retargeted symbols if any.
|
||||
// Notably, this is only applicable to built-in variables so that it is okay to only use name as the key.
|
||||
auto [itBegin, itEnd] = glslangIntermediate->getBuiltinAliasLookup().equal_range(name);
|
||||
for (auto it = itBegin; it != itEnd; ++it) {
|
||||
// RD modification - use pair explicitly
|
||||
auto itRange = glslangIntermediate->getBuiltinAliasLookup().equal_range(name);
|
||||
for (auto it = itRange.first; it != itRange.second; ++it) {
|
||||
builder.createDebugGlobalVariable(builder.getDebugType(spvType), it->second.c_str(), var);
|
||||
}
|
||||
}
|
||||
@@ -5830,7 +5833,8 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
|
||||
|
||||
// Apply SPIR-V decorations to the SPIR-V object (provided by SPIR-V ID). If member index is provided, the
|
||||
// decorations are applied to this member.
|
||||
void TGlslangToSpvTraverser::applySpirvDecorate(const glslang::TType& type, spv::Id id, std::optional<int> member)
|
||||
// RD Modification - remove use of std::optional
|
||||
void TGlslangToSpvTraverser::applySpirvDecorate(const glslang::TType& type, spv::Id id, int* member)
|
||||
{
|
||||
assert(type.getQualifier().hasSpirvDecorate());
|
||||
|
||||
@@ -5841,12 +5845,12 @@ void TGlslangToSpvTraverser::applySpirvDecorate(const glslang::TType& type, spv:
|
||||
if (!decorate.second.empty()) {
|
||||
std::vector<unsigned> literals;
|
||||
TranslateLiterals(decorate.second, literals);
|
||||
if (member.has_value())
|
||||
if (member)
|
||||
builder.addMemberDecoration(id, *member, static_cast<spv::Decoration>(decorate.first), literals);
|
||||
else
|
||||
builder.addDecoration(id, static_cast<spv::Decoration>(decorate.first), literals);
|
||||
} else {
|
||||
if (member.has_value())
|
||||
if (member)
|
||||
builder.addMemberDecoration(id, *member, static_cast<spv::Decoration>(decorate.first));
|
||||
else
|
||||
builder.addDecoration(id, static_cast<spv::Decoration>(decorate.first));
|
||||
@@ -5854,7 +5858,7 @@ void TGlslangToSpvTraverser::applySpirvDecorate(const glslang::TType& type, spv:
|
||||
}
|
||||
|
||||
// Add spirv_decorate_id
|
||||
if (member.has_value()) {
|
||||
if (member) {
|
||||
// spirv_decorate_id not applied to members
|
||||
assert(spirvDecorate.decorateIds.empty());
|
||||
} else {
|
||||
@@ -5879,7 +5883,7 @@ void TGlslangToSpvTraverser::applySpirvDecorate(const glslang::TType& type, spv:
|
||||
const char* string = extraOperand->getConstArray()[0].getSConst()->c_str();
|
||||
strings.push_back(string);
|
||||
}
|
||||
if (member.has_value())
|
||||
if (member)
|
||||
builder.addMemberDecoration(id, *member, static_cast<spv::Decoration>(decorateString.first), strings);
|
||||
else
|
||||
builder.addDecoration(id, static_cast<spv::Decoration>(decorateString.first), strings);
|
||||
@@ -5987,7 +5991,8 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy
|
||||
// + Table lookup during creation of composite debug types. This really shouldn't be necessary.
|
||||
if(options.emitNonSemanticShaderDebugInfo) {
|
||||
spv::StructMemberDebugInfo debugInfo{};
|
||||
debugInfo.name = glslangMember.type->getFieldName();
|
||||
// RD modification - use explicit string conversion
|
||||
debugInfo.name = std::string(glslangMember.type->getFieldName().data(), glslangMember.type->getFieldName().size());
|
||||
debugInfo.line = glslangMember.loc.line;
|
||||
debugInfo.column = glslangMember.loc.column;
|
||||
|
||||
@@ -6307,8 +6312,9 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
|
||||
}
|
||||
|
||||
// Add SPIR-V decorations (GL_EXT_spirv_intrinsics)
|
||||
// RD Modification - remove use of std::optional
|
||||
if (glslangMember.getQualifier().hasSpirvDecorate())
|
||||
applySpirvDecorate(glslangMember, spvType, member);
|
||||
applySpirvDecorate(glslangMember, spvType, &member);
|
||||
}
|
||||
|
||||
// Decorate the structure
|
||||
@@ -11243,8 +11249,9 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
|
||||
}
|
||||
|
||||
// Add SPIR-V decorations (GL_EXT_spirv_intrinsics)
|
||||
// RD Modification - remove use of std::optional
|
||||
if (symbol->getType().getQualifier().hasSpirvDecorate())
|
||||
applySpirvDecorate(symbol->getType(), id, {});
|
||||
applySpirvDecorate(symbol->getType(), id, NULL);
|
||||
|
||||
if (symbol->getQualifier().hasBank()) {
|
||||
builder.addExtension(spv::E_SPV_NV_push_constant_bank);
|
||||
|
||||
+3
-1
@@ -2819,7 +2819,9 @@ void Builder::enterFunction(Function const* function)
|
||||
addInstruction(std::unique_ptr<Instruction>(defInst));
|
||||
}
|
||||
|
||||
if (auto linkType = function->getLinkType(); linkType != LinkageType::Max) {
|
||||
// RD Modification - remove use of new declaration-inside-if
|
||||
auto linkType = function->getLinkType();
|
||||
if (linkType != LinkageType::Max) {
|
||||
Id funcId = function->getFuncId();
|
||||
addCapability(Capability::Linkage);
|
||||
addLinkageDecoration(funcId, function->getExportName(), linkType);
|
||||
|
||||
+8
-3
@@ -208,7 +208,9 @@ public:
|
||||
|
||||
// Maps the given OpType Id to a Non-Semantic DebugType Id.
|
||||
Id getDebugType(Id type) {
|
||||
if (auto it = debugTypeIdLookup.find(type); it != debugTypeIdLookup.end()) {
|
||||
// RD Modification - remove use of new declaration-inside-if
|
||||
auto it = debugTypeIdLookup.find(type);
|
||||
if (it != debugTypeIdLookup.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
@@ -217,7 +219,9 @@ public:
|
||||
|
||||
// Maps the given OpFunction Id to a Non-Semantic DebugFunction Id.
|
||||
Id getDebugFunction(Id func) {
|
||||
if (auto it = debugFuncIdLookup.find(func); it != debugFuncIdLookup.end()) {
|
||||
// RD Modification - remove use of new declaration-inside-if
|
||||
auto it = debugFuncIdLookup.find(func);
|
||||
if (it != debugFuncIdLookup.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
@@ -1115,7 +1119,8 @@ protected:
|
||||
struct ScalarConstantKeyHash {
|
||||
// 64/32 bit mix function from MurmurHash3
|
||||
inline std::size_t hash_mix(std::size_t h) const {
|
||||
if constexpr (sizeof(std::size_t) == 8) {
|
||||
// RD Modification - remove if constexpr
|
||||
if (sizeof(std::size_t) == 8) {
|
||||
h ^= h >> 33;
|
||||
h *= UINT64_C(0xff51afd7ed558ccd);
|
||||
h ^= h >> 33;
|
||||
|
||||
+9
-6
@@ -56,7 +56,8 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <optional>
|
||||
// RD Modification - remove use of std::optional
|
||||
//#include <optional>
|
||||
|
||||
namespace spv {
|
||||
|
||||
@@ -297,8 +298,8 @@ public:
|
||||
// Returns true if the source location is actually updated.
|
||||
// Note we still need the builder to insert the line marker instruction. This is just a tracker.
|
||||
bool updateDebugSourceLocation(int line, int column, spv::Id fileId) {
|
||||
if (currentSourceLoc && currentSourceLoc->line == line && currentSourceLoc->column == column &&
|
||||
currentSourceLoc->fileId == fileId) {
|
||||
if (currentSourceLoc.line == line && currentSourceLoc.column == column &&
|
||||
currentSourceLoc.fileId == fileId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -309,7 +310,7 @@ public:
|
||||
// Note we still need the builder to insert the debug scope instruction. This is just a tracker.
|
||||
bool updateDebugScope(spv::Id scopeId) {
|
||||
assert(scopeId);
|
||||
if (currentDebugScope && *currentDebugScope == scopeId) {
|
||||
if (currentDebugScope && currentDebugScope == scopeId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -409,10 +410,12 @@ protected:
|
||||
Function& parent;
|
||||
|
||||
// Track source location of the last source location marker instruction.
|
||||
std::optional<DebugSourceLocation> currentSourceLoc;
|
||||
// RD Modification - remove use of std::optional
|
||||
DebugSourceLocation currentSourceLoc = {-1, -1};
|
||||
|
||||
// Track scope of the last debug scope instruction.
|
||||
std::optional<spv::Id> currentDebugScope;
|
||||
// RD Modification - remove use of std::optional
|
||||
spv::Id currentDebugScope = {};
|
||||
|
||||
// track whether this block is known to be uncreachable (not necessarily
|
||||
// true for all unreachable blocks, but should be set at least
|
||||
|
||||
+11
-9
@@ -36,7 +36,8 @@
|
||||
#define _INFOSINK_INCLUDED_
|
||||
|
||||
#include "../Include/Common.h"
|
||||
#include <filesystem>
|
||||
// RD Modification - remove std::filesystem use
|
||||
//#include <filesystem>
|
||||
#include <cmath>
|
||||
|
||||
namespace glslang {
|
||||
@@ -104,16 +105,17 @@ public:
|
||||
snprintf(locText, maxSize, ":%d", loc.line);
|
||||
}
|
||||
|
||||
if(loc.getFilename() == nullptr && shaderFileName != nullptr && absolute) {
|
||||
append(std::filesystem::absolute(shaderFileName).string());
|
||||
} else {
|
||||
// RD Modification - absolute paths unsupported
|
||||
//if(loc.getFilename() == nullptr && shaderFileName != nullptr && absolute) {
|
||||
// append(std::filesystem::absolute(shaderFileName).string());
|
||||
//} else {
|
||||
std::string location = loc.getStringNameOrNum(false);
|
||||
if (absolute) {
|
||||
append(std::filesystem::absolute(location).string());
|
||||
} else {
|
||||
//if (absolute) {
|
||||
// append(std::filesystem::absolute(location).string());
|
||||
//} else {
|
||||
append(location);
|
||||
}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
|
||||
append(locText);
|
||||
append(": ");
|
||||
|
||||
+10
-6
@@ -120,14 +120,15 @@ private:
|
||||
unsigned char* mem; // beginning of our allocation (pts to header)
|
||||
TAllocation* prevAlloc; // prior allocation in the chain
|
||||
|
||||
static inline constexpr unsigned char guardBlockBeginVal = 0xfb;
|
||||
static inline constexpr unsigned char guardBlockEndVal = 0xfe;
|
||||
static inline constexpr unsigned char userDataFill = 0xcd;
|
||||
// RD Modification - static constexpr implies inline
|
||||
static constexpr unsigned char guardBlockBeginVal = 0xfb;
|
||||
static constexpr unsigned char guardBlockEndVal = 0xfe;
|
||||
static constexpr unsigned char userDataFill = 0xcd;
|
||||
|
||||
# ifdef GUARD_BLOCKS
|
||||
static inline constexpr size_t guardBlockSize = 16;
|
||||
static constexpr size_t guardBlockSize = 16;
|
||||
# else
|
||||
static inline constexpr size_t guardBlockSize = 0;
|
||||
static constexpr size_t guardBlockSize = 0;
|
||||
# endif
|
||||
|
||||
# ifdef GUARD_BLOCKS
|
||||
@@ -317,8 +318,11 @@ public:
|
||||
|
||||
pool_allocator select_on_container_copy_construction() const { return pool_allocator{}; }
|
||||
|
||||
protected:
|
||||
// RD Modification - work around seeming old libstdc++ bug, string move assignment
|
||||
// invokes std::swap() which swaps allocators via assignment
|
||||
// newer compilers do not invoke this function
|
||||
pool_allocator& operator=(const pool_allocator&) { return *this; }
|
||||
protected:
|
||||
TPoolAllocator& allocator;
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
// GL_EXT_spirv_intrinsics
|
||||
//
|
||||
#include "Common.h"
|
||||
#include <variant>
|
||||
// RD Modification - remove std::variant use
|
||||
//#include <variant>
|
||||
|
||||
namespace glslang {
|
||||
|
||||
@@ -97,19 +98,19 @@ struct TSpirvInstruction {
|
||||
struct TSpirvTypeParameter {
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
TSpirvTypeParameter(const TIntermConstantUnion* arg) { value = arg; }
|
||||
TSpirvTypeParameter(const TType* arg) { value = arg; }
|
||||
TSpirvTypeParameter(const TIntermConstantUnion* arg) { value.constant = arg; valueIndex = 0; }
|
||||
TSpirvTypeParameter(const TType* arg) { value.type = arg; valueIndex = 1; }
|
||||
|
||||
const TIntermConstantUnion* getAsConstant() const
|
||||
{
|
||||
if (value.index() == 0)
|
||||
return std::get<const TIntermConstantUnion*>(value);
|
||||
if (valueIndex == 0)
|
||||
return value.constant;
|
||||
return nullptr;
|
||||
}
|
||||
const TType* getAsType() const
|
||||
{
|
||||
if (value.index() == 1)
|
||||
return std::get<const TType*>(value);
|
||||
if (valueIndex == 1)
|
||||
return value.type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -117,7 +118,14 @@ struct TSpirvTypeParameter {
|
||||
bool operator!=(const TSpirvTypeParameter& rhs) const { return !operator==(rhs); }
|
||||
|
||||
// Parameter value: constant expression or type specifier
|
||||
std::variant<const TIntermConstantUnion*, const TType*> value;
|
||||
// RD Modification - remove std::variant use
|
||||
//std::variant<const TIntermConstantUnion*, const TType*> value;
|
||||
union
|
||||
{
|
||||
const TIntermConstantUnion* constant;
|
||||
const TType* type;
|
||||
} value;
|
||||
int valueIndex = 0;
|
||||
};
|
||||
|
||||
typedef TVector<TSpirvTypeParameter> TSpirvTypeParameters;
|
||||
|
||||
+2
-1
@@ -2691,8 +2691,9 @@ public:
|
||||
|
||||
TString getBasicTypeString() const
|
||||
{
|
||||
// RD modification: use explicit constructor
|
||||
if (basicType == EbtSampler)
|
||||
return TString{sampler.getString()};
|
||||
return TString(sampler.getString().data(), sampler.getString().size());
|
||||
else
|
||||
return getBasicString();
|
||||
}
|
||||
|
||||
@@ -142,17 +142,21 @@ struct Versioning {
|
||||
EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECompatibilityProfile);
|
||||
|
||||
// Declare pointers to put into the table for versioning.
|
||||
const std::array Es300Desktop130Version = { Versioning{ EEsProfile, 0, 300, 0, nullptr },
|
||||
// RD Modification - explicitly type std::array
|
||||
const std::array<Versioning, 2> Es300Desktop130Version
|
||||
= {{ Versioning{ EEsProfile, 0, 300, 0, nullptr },
|
||||
Versioning{ EDesktopProfile, 0, 130, 0, nullptr },
|
||||
};
|
||||
}};
|
||||
|
||||
const std::array Es310Desktop400Version = { Versioning{ EEsProfile, 0, 310, 0, nullptr },
|
||||
const std::array<Versioning, 2> Es310Desktop400Version
|
||||
= {{ Versioning{ EEsProfile, 0, 310, 0, nullptr },
|
||||
Versioning{ EDesktopProfile, 0, 400, 0, nullptr },
|
||||
};
|
||||
}};
|
||||
|
||||
const std::array Es310Desktop450Version = { Versioning{ EEsProfile, 0, 310, 0, nullptr },
|
||||
const std::array<Versioning, 2> Es310Desktop450Version
|
||||
= {{ Versioning{ EEsProfile, 0, 310, 0, nullptr },
|
||||
Versioning{ EDesktopProfile, 0, 450, 0, nullptr },
|
||||
};
|
||||
}};
|
||||
|
||||
// The main descriptor of what a set of function prototypes can look like, and
|
||||
// a pointer to extra versioning information, when needed.
|
||||
@@ -174,7 +178,8 @@ struct BuiltInFunction {
|
||||
//
|
||||
// Table is terminated by an OpNull TOperator.
|
||||
|
||||
const std::array BaseFunctions = {
|
||||
// RD Modification - explicitly type std::array
|
||||
const std::array<BuiltInFunction, 79> BaseFunctions = {{
|
||||
// TOperator, name, arg-count, ArgType, ArgClass, versioning
|
||||
// --------- ---- --------- ------- -------- ----------
|
||||
BuiltInFunction{ EOpRadians, "radians", 1, TypeF, ClassRegular, {} },
|
||||
@@ -256,13 +261,14 @@ const std::array BaseFunctions = {
|
||||
BuiltInFunction{ EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCVN, {Es310Desktop400Version} },
|
||||
BuiltInFunction{ EOpMix, "mix", 3, TypeB, ClassRegular, {Es310Desktop450Version} },
|
||||
BuiltInFunction{ EOpMix, "mix", 3, TypeIU, ClassLB, {Es310Desktop450Version} },
|
||||
};
|
||||
}};
|
||||
|
||||
const std::array DerivativeFunctions = {
|
||||
// RD Modification - explicitly type std::array
|
||||
const std::array<BuiltInFunction, 3> DerivativeFunctions = {{
|
||||
BuiltInFunction{ EOpDPdx, "dFdx", 1, TypeF, ClassRegular, {} },
|
||||
BuiltInFunction{ EOpDPdy, "dFdy", 1, TypeF, ClassRegular, {} },
|
||||
BuiltInFunction{ EOpFwidth, "fwidth", 1, TypeF, ClassRegular, {} },
|
||||
};
|
||||
}};
|
||||
|
||||
// For functions declared some other way, but still use the table to relate to operator.
|
||||
struct CustomFunction {
|
||||
@@ -5069,7 +5075,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
<< t << " data[], uint tensorOperands = 0U, ...);\n";
|
||||
}
|
||||
ostream << "uint tensorSizeARM(readonly writeonly tensorARM t, uint dim);\n";
|
||||
commonBuiltins.append(ostream.str());
|
||||
// RD modification - remove incompatible string conversion
|
||||
commonBuiltins.append(ostream.str().data(), ostream.str().size());
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
@@ -7269,7 +7276,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
false,
|
||||
ms ? true : false);
|
||||
|
||||
TString typeName = TString{sampler.getString()};
|
||||
// RD modification - explicit string conversion
|
||||
TString typeName = TString(sampler.getString().data(), sampler.getString().size());
|
||||
|
||||
addQueryFunctions(sampler, typeName, version, profile);
|
||||
addImageFunctions(sampler, typeName, version, profile);
|
||||
@@ -7371,8 +7379,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
|
||||
shadow ? true : false,
|
||||
ms ? true : false);
|
||||
}
|
||||
|
||||
TString typeName = TString{sampler.getString()};
|
||||
// RD modification - explicit string conversion
|
||||
TString typeName = TString(sampler.getString().data(), sampler.getString().size());
|
||||
|
||||
if (dim == EsdSubpass) {
|
||||
addSubpassSampling(sampler, typeName, version, profile);
|
||||
@@ -7396,7 +7404,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
|
||||
// texture types.
|
||||
sampler.setTexture(sampler.type, sampler.dim, sampler.arrayed, sampler.shadow,
|
||||
sampler.ms);
|
||||
TString textureTypeName = TString{sampler.getString()};
|
||||
// RD modification - explicit string conversion
|
||||
TString textureTypeName = TString(sampler.getString().data(), sampler.getString().size());
|
||||
addSamplingFunctions(sampler, textureTypeName, version, profile);
|
||||
addQueryFunctions(sampler, textureTypeName, version, profile);
|
||||
}
|
||||
|
||||
@@ -1827,7 +1827,8 @@ void TParseContext::handleCoopMat2FunctionCall(const TSourceLoc& loc, const TFun
|
||||
// Validate that the matrix sizes are compatible for multiplication and addition
|
||||
const auto &sequence = arguments->getAsAggregate()->getSequence();
|
||||
|
||||
using ArrayDim = const TArraySize&;
|
||||
// RD modification use no reference - the struct is small and fine to value copy
|
||||
using ArrayDim = TArraySize;
|
||||
auto getDim = [](const TIntermSequence& seq, int idx) -> std::tuple<ArrayDim, ArrayDim, int> {
|
||||
const auto &type = seq[idx]->getAsTyped()->getType();
|
||||
const auto *size = type.getTypeParameters()->arraySizes;
|
||||
@@ -1842,9 +1843,12 @@ void TParseContext::handleCoopMat2FunctionCall(const TSourceLoc& loc, const TFun
|
||||
};
|
||||
|
||||
// sizes look like: [scope, rows, cols, use]
|
||||
auto [aRows, aCols, aUse] = getDim(sequence, 0);
|
||||
auto [bRows, bCols, bUse] = getDim(sequence, 1);
|
||||
auto [cRows, cCols, cUse] = getDim(sequence, 2);
|
||||
// RD modification - use std::tie
|
||||
ArrayDim aRows, aCols, bRows, bCols, cRows, cCols;
|
||||
int aUse, bUse, cUse;
|
||||
std::tie(aRows, aCols, aUse) = getDim(sequence, 0);
|
||||
std::tie(bRows, bCols, bUse) = getDim(sequence, 1);
|
||||
std::tie(cRows, cCols, cUse) = getDim(sequence, 2);
|
||||
|
||||
auto toString = [](ArrayDim dim) -> std::string {
|
||||
std::stringstream buf;
|
||||
|
||||
@@ -370,7 +370,9 @@ void TSymbolTableLevel::setFunctionExtensionsCallback(const char* name, std::fun
|
||||
// Should only be used for a version/profile that actually needs the extension(s).
|
||||
void TSymbolTableLevel::setSingleFunctionExtensions(const char* name, int num, const char* const extensions[])
|
||||
{
|
||||
if (auto candidate = level.find(name); candidate != level.end()) {
|
||||
// RD Modification - remove use of new declaration-inside-if
|
||||
auto candidate = level.find(name);
|
||||
if (candidate != level.end()) {
|
||||
candidate->second->setExtensions(num, extensions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,8 +507,9 @@ public:
|
||||
}
|
||||
|
||||
void collectRetargetedSymbols(std::unordered_multimap<std::string, std::string> &out) const {
|
||||
for (const auto &[fromName, toName] : retargetedSymbols)
|
||||
out.insert({std::string{toName}, std::string{fromName}});
|
||||
// RD modification - use normal pair access, use explicit constructor
|
||||
for (const auto &sym : retargetedSymbols)
|
||||
out.insert({std::string(sym.second.data(), sym.second.size()), std::string(sym.first.data(), sym.first.size())});
|
||||
}
|
||||
|
||||
TSymbol* find(const TString& name) const
|
||||
|
||||
@@ -83,8 +83,9 @@ public:
|
||||
const char* featureDesc);
|
||||
virtual void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
|
||||
const char* featureDesc);
|
||||
// RD Modification - drop redundant constexpr (warning about it not implying const)
|
||||
template<typename Container>
|
||||
constexpr void ppRequireExtensions(const TSourceLoc& loc, Container extensions, const char* featureDesc) {
|
||||
void ppRequireExtensions(const TSourceLoc& loc, Container extensions, const char* featureDesc) {
|
||||
ppRequireExtensions(loc, static_cast<int>(extensions.size()), extensions.data(), featureDesc);
|
||||
}
|
||||
|
||||
|
||||
@@ -1020,7 +1020,8 @@ int TPpContext::readCPPline(TPpToken* ppToken)
|
||||
break;
|
||||
case PpAtomInclude:
|
||||
if(!parseContext.isReadingHLSL()) {
|
||||
const std::array exts = { E_GL_GOOGLE_include_directive, E_GL_ARB_shading_language_include };
|
||||
// RD Modification - explicitly type std::array
|
||||
const std::array<const char* const, 2> exts = {{ E_GL_GOOGLE_include_directive, E_GL_ARB_shading_language_include }};
|
||||
parseContext.ppRequireExtensions(ppToken->loc, exts, "#include");
|
||||
}
|
||||
token = CPPinclude(ppToken);
|
||||
|
||||
Reference in New Issue
Block a user