summaryrefslogtreecommitdiff
path: root/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/glslang/glslang/MachineIndependent/localintermediate.h')
-rw-r--r--thirdparty/glslang/glslang/MachineIndependent/localintermediate.h120
1 files changed, 110 insertions, 10 deletions
diff --git a/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h b/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h
index f8d8e80199..6aa9399dcc 100644
--- a/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h
+++ b/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h
@@ -227,10 +227,10 @@ enum ComputeDerivativeMode {
class TIdMaps {
public:
- TMap<TString, int>& operator[](int i) { return maps[i]; }
- const TMap<TString, int>& operator[](int i) const { return maps[i]; }
+ TMap<TString, long long>& operator[](long long i) { return maps[i]; }
+ const TMap<TString, long long>& operator[](long long i) const { return maps[i]; }
private:
- TMap<TString, int> maps[EsiCount];
+ TMap<TString, long long> maps[EsiCount];
};
class TNumericFeatures {
@@ -291,8 +291,15 @@ public:
numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false),
invertY(false),
useStorageBuffer(false),
+ invariantAll(false),
nanMinMaxClamp(false),
- depthReplacing(false)
+ depthReplacing(false),
+ uniqueId(0),
+ globalUniformBlockName(""),
+ atomicCounterBlockName(""),
+ globalUniformBlockSet(TQualifier::layoutSetEnd),
+ globalUniformBlockBinding(TQualifier::layoutBindingEnd),
+ atomicCounterBlockSet(TQualifier::layoutSetEnd)
#ifndef GLSLANG_WEB
,
implicitThisName("@this"), implicitCounterName("@count"),
@@ -322,7 +329,10 @@ public:
textureSamplerTransformMode(EShTexSampTransKeep),
needToLegalize(false),
binaryDoubleOutput(false),
+ subgroupUniformControlFlow(false),
usePhysicalStorageBuffer(false),
+ spirvRequirement(nullptr),
+ spirvExecutionMode(nullptr),
uniformLocationBase(0)
#endif
{
@@ -529,15 +539,30 @@ public:
TIntermTyped* foldSwizzle(TIntermTyped* node, TSwizzleSelectors<TVectorSelector>& fields, const TSourceLoc&);
// Tree ops
- static const TIntermTyped* findLValueBase(const TIntermTyped*, bool swizzleOkay);
+ static const TIntermTyped* findLValueBase(const TIntermTyped*, bool swizzleOkay , bool BufferReferenceOk = false);
// Linkage related
void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&);
TIntermAggregate* findLinkerObjects() const;
+ void setGlobalUniformBlockName(const char* name) { globalUniformBlockName = std::string(name); }
+ const char* getGlobalUniformBlockName() const { return globalUniformBlockName.c_str(); }
+ void setGlobalUniformSet(unsigned int set) { globalUniformBlockSet = set; }
+ unsigned int getGlobalUniformSet() const { return globalUniformBlockSet; }
+ void setGlobalUniformBinding(unsigned int binding) { globalUniformBlockBinding = binding; }
+ unsigned int getGlobalUniformBinding() const { return globalUniformBlockBinding; }
+
+ void setAtomicCounterBlockName(const char* name) { atomicCounterBlockName = std::string(name); }
+ const char* getAtomicCounterBlockName() const { return atomicCounterBlockName.c_str(); }
+ void setAtomicCounterBlockSet(unsigned int set) { atomicCounterBlockSet = set; }
+ unsigned int getAtomicCounterBlockSet() const { return atomicCounterBlockSet; }
+
+
void setUseStorageBuffer() { useStorageBuffer = true; }
bool usingStorageBuffer() const { return useStorageBuffer; }
+ void setInvariantAll() { invariantAll = true; }
+ bool isInvariantAll() const { return invariantAll; }
void setDepthReplacing() { depthReplacing = true; }
bool isDepthReplacing() const { return depthReplacing; }
bool setLocalSize(int dim, int size)
@@ -549,6 +574,11 @@ public:
return true;
}
unsigned int getLocalSize(int dim) const { return localSize[dim]; }
+ bool isLocalSizeSet() const
+ {
+ // Return true if any component has been set (i.e. any component is not default).
+ return localSizeNotDefault[0] || localSizeNotDefault[1] || localSizeNotDefault[2];
+ }
bool setLocalSizeSpecId(int dim, int id)
{
if (localSizeSpecId[dim] != TQualifier::layoutNotSet)
@@ -557,6 +587,13 @@ public:
return true;
}
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
+ bool isLocalSizeSpecialized() const
+ {
+ // Return true if any component has been specialized.
+ return localSizeSpecId[0] != TQualifier::layoutNotSet ||
+ localSizeSpecId[1] != TQualifier::layoutNotSet ||
+ localSizeSpecId[2] != TQualifier::layoutNotSet;
+ }
#ifdef GLSLANG_WEB
void output(TInfoSink&, bool tree) { }
@@ -833,8 +870,34 @@ public:
void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
+
+ void setSubgroupUniformControlFlow() { subgroupUniformControlFlow = true; }
+ bool getSubgroupUniformControlFlow() const { return subgroupUniformControlFlow; }
+
+ // GL_EXT_spirv_intrinsics
+ void insertSpirvRequirement(const TSpirvRequirement* spirvReq);
+ bool hasSpirvRequirement() const { return spirvRequirement != nullptr; }
+ const TSpirvRequirement& getSpirvRequirement() const { return *spirvRequirement; }
+ void insertSpirvExecutionMode(int executionMode, const TIntermAggregate* args = nullptr);
+ void insertSpirvExecutionModeId(int executionMode, const TIntermAggregate* args);
+ bool hasSpirvExecutionMode() const { return spirvExecutionMode != nullptr; }
+ const TSpirvExecutionMode& getSpirvExecutionMode() const { return *spirvExecutionMode; }
#endif // GLSLANG_WEB
+ void addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing)
+ {
+ std::string name(nameStr);
+ blockBackingOverrides[name] = backing;
+ }
+ TBlockStorageClass getBlockStorageOverride(const char* nameStr) const
+ {
+ std::string name = nameStr;
+ auto pos = blockBackingOverrides.find(name);
+ if (pos == blockBackingOverrides.end())
+ return EbsNone;
+ else
+ return pos->second;
+ }
#ifdef ENABLE_HLSL
void setHlslFunctionality1() { hlslFunctionality1 = true; }
bool getHlslFunctionality1() const { return hlslFunctionality1; }
@@ -858,10 +921,27 @@ public:
bool usingHlslIoMapping() { return false; }
#endif
+ bool usingScalarBlockLayout() const {
+ for (auto extIt = requestedExtensions.begin(); extIt != requestedExtensions.end(); ++extIt) {
+ if (*extIt == E_GL_EXT_scalar_block_layout)
+ return true;
+ }
+ return false;
+ }
+
+ bool IsRequestedExtension(const char* extension) const
+ {
+ return (requestedExtensions.find(extension) != requestedExtensions.end());
+ }
+
void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
void merge(TInfoSink&, TIntermediate&);
void finalCheck(TInfoSink&, bool keepUncalled);
+ void mergeGlobalUniformBlocks(TInfoSink& infoSink, TIntermediate& unit, bool mergeExistingOnly);
+ void mergeUniformObjects(TInfoSink& infoSink, TIntermediate& unit);
+ void checkStageIO(TInfoSink&, TIntermediate&);
+
bool buildConvertOp(TBasicType dst, TBasicType src, TOperator& convertOp) const;
TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const;
@@ -885,6 +965,8 @@ public:
static int getOffset(const TType& type, int index);
static int getBlockSize(const TType& blockType);
static int computeBufferReferenceTypeSize(const TType&);
+ static bool isIoResizeArray(const TType& type, EShLanguage language);
+
bool promote(TIntermOperator*);
void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
@@ -903,6 +985,8 @@ public:
void addProcess(const std::string& process) { processes.addProcess(process); }
void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
+ unsigned long long getUniqueId() const { return uniqueId; }
+ void setUniqueId(unsigned long long id) { uniqueId = id; }
// Certain explicit conversions are allowed conditionally
#ifdef GLSLANG_WEB
@@ -931,21 +1015,23 @@ public:
#endif
protected:
- TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
+ TIntermSymbol* addSymbol(long long Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
void error(TInfoSink& infoSink, const char*);
void warn(TInfoSink& infoSink, const char*);
void mergeCallGraphs(TInfoSink&, TIntermediate&);
void mergeModes(TInfoSink&, TIntermediate&);
void mergeTrees(TInfoSink&, TIntermediate&);
- void seedIdMap(TIdMaps& idMaps, int& maxId);
- void remapIds(const TIdMaps& idMaps, int idShift, TIntermediate&);
+ void seedIdMap(TIdMaps& idMaps, long long& IdShift);
+ void remapIds(const TIdMaps& idMaps, long long idShift, TIntermediate&);
void mergeBodies(TInfoSink&, TIntermSequence& globals, const TIntermSequence& unitGlobals);
- void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects);
+ void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects, EShLanguage);
+ void mergeBlockDefinitions(TInfoSink&, TIntermSymbol* block, TIntermSymbol* unitBlock, TIntermediate* unitRoot);
void mergeImplicitArraySizes(TType&, const TType&);
- void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, bool crossStage);
+ void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, EShLanguage);
void checkCallGraphCycles(TInfoSink&);
void checkCallGraphBodies(TInfoSink&, bool keepUncalled);
void inOutLocationCheck(TInfoSink&);
+ void sharedBlockCheck(TInfoSink&);
bool userOutputUsed() const;
bool isSpecializationOperation(const TIntermOperator&) const;
bool isNonuniformPropagating(TOperator) const;
@@ -985,11 +1071,20 @@ protected:
bool recursive;
bool invertY;
bool useStorageBuffer;
+ bool invariantAll;
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
bool depthReplacing;
int localSize[3];
bool localSizeNotDefault[3];
int localSizeSpecId[3];
+ unsigned long long uniqueId;
+
+ std::string globalUniformBlockName;
+ std::string atomicCounterBlockName;
+ unsigned int globalUniformBlockSet;
+ unsigned int globalUniformBlockBinding;
+ unsigned int atomicCounterBlockSet;
+
#ifndef GLSLANG_WEB
public:
const char* const implicitThisName;
@@ -1044,12 +1139,17 @@ protected:
bool needToLegalize;
bool binaryDoubleOutput;
+ bool subgroupUniformControlFlow;
bool usePhysicalStorageBuffer;
+ TSpirvRequirement* spirvRequirement;
+ TSpirvExecutionMode* spirvExecutionMode;
+
std::unordered_map<std::string, int> uniformLocationOverrides;
int uniformLocationBase;
TNumericFeatures numericFeatures;
#endif
+ std::unordered_map<std::string, TBlockStorageClass> blockBackingOverrides;
std::unordered_set<int> usedConstantId; // specialization constant ids used
std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters