diff options
Diffstat (limited to 'glslang/MachineIndependent/localintermediate.h')
-rw-r--r-- | glslang/MachineIndependent/localintermediate.h | 90 |
1 files changed, 15 insertions, 75 deletions
diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 0c569976..e7a171cd 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -225,16 +225,6 @@ enum ComputeDerivativeMode { LayoutDerivativeGroupLinear, // derivative_group_linearNV }; -// -// Status type on AST level. Some uncalled status or functions would be reset in call graph. -// Currently we will keep status set by explicitly declared layout or variable decl. -// -enum AstRefType { - AstRefTypeVar, // Status set by variable decl - AstRefTypeFunc, // Status set by function decl - AstRefTypeLayout, // Status set by layout decl -}; - class TIdMaps { public: TMap<TString, long long>& operator[](long long i) { return maps[i]; } @@ -293,8 +283,10 @@ class TIntermediate { public: explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), +#ifndef GLSLANG_ANGLE profile(p), version(v), - treeRoot(nullptr), +#endif + treeRoot(0), resources(TBuiltInResource{}), numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false), invertY(false), @@ -366,11 +358,15 @@ public: void setVersion(int v) { +#ifndef GLSLANG_ANGLE version = v; +#endif } void setProfile(EProfile p) { +#ifndef GLSLANG_ANGLE profile = p; +#endif } int getVersion() const { return version; } @@ -754,65 +750,6 @@ public: useVariablePointers = true; processes.addProcess("use-variable-pointers"); } - // Set the global flag for bindless texture - void setBindlessTextureMode(const TString& currentCaller, AstRefType type) - { - // When type is not func, currentCaller should be "" (empty string) - bindlessTextureModeCaller[currentCaller] = type; - } - - // Get the global flag for bindless texture - bool getBindlessTextureMode() const - { - return (bindlessTextureModeCaller.size() > 0); - } - - // Set the global flag for bindless image - void setBindlessImageMode(const TString& currentCaller, AstRefType type) - { - // When type is not func, currentCaller should be "" (empty string) - bindlessImageModeCaller[currentCaller] = type; - } - - // Get the global flag for bindless image - bool getBindlessImageMode() const - { - return (bindlessImageModeCaller.size() > 0); - } - - // Get the global flag for bindless texture - bool resetTopLevelUncalledStatus(const TString& deadCaller) - { - // For reflection collection purpose, currently uniform layout setting and some - // flags introduced by variables (IO, global, etc,.) won't be reset here. - // Remove each global status (AST top level) introduced by uncalled functions. - // If a status is set by several functions, keep those which in call graph. - bool result = false; - - // For two types of bindless mode flag, we would only reset which is set by an uncalled function. - // If one status flag's key in caller vec is empty, it should be come from a non-function setting. - if (!bindlessTextureModeCaller.empty()) { - auto caller = bindlessTextureModeCaller.find(deadCaller); - if (caller != bindlessTextureModeCaller.end() && bindlessTextureModeCaller[deadCaller] == AstRefTypeFunc) { - bindlessTextureModeCaller.erase(caller); - result = true; - } - } - if (!bindlessImageModeCaller.empty()) { - auto caller = bindlessImageModeCaller.find(deadCaller); - if (caller != bindlessImageModeCaller.end() && bindlessImageModeCaller[deadCaller] == AstRefTypeFunc) { - bindlessImageModeCaller.erase(caller); - result = true; - } - } - return result; - } - - bool getBindlessMode() const - { - return getBindlessTextureMode() || getBindlessImageMode(); - } - bool usingVariablePointers() const { return useVariablePointers; } #ifdef ENABLE_HLSL @@ -1164,8 +1101,13 @@ protected: typedef std::list<TCall> TGraph; TGraph callGraph; +#ifdef GLSLANG_ANGLE + const EProfile profile = ECoreProfile; + const int version = 450; +#else EProfile profile; // source profile int version; // source version +#endif SpvVersion spvVersion; TIntermNode* treeRoot; std::set<std::string> requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them @@ -1257,8 +1199,7 @@ protected: TSpirvRequirement* spirvRequirement; TSpirvExecutionMode* spirvExecutionMode; - std::map<TString, AstRefType> bindlessTextureModeCaller; - std::map<TString, AstRefType> bindlessImageModeCaller; + std::unordered_map<std::string, int> uniformLocationOverrides; int uniformLocationBase; TNumericFeatures numericFeatures; @@ -1268,9 +1209,8 @@ protected: std::unordered_set<int> usedConstantId; // specialization constant ids used std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers - std::vector<TRange> usedIoRT[4]; // sets of used location, one for rayPayload/rayPayloadIN, - // one for callableData/callableDataIn, one for hitObjectAttributeNV and - // one for shaderrecordhitobjectNV + std::vector<TRange> usedIoRT[2]; // sets of used location, one for rayPayload/rayPayloadIN and other + // for callableData/callableDataIn // set of names of statically read/written I/O that might need extra checking std::set<TString> ioAccessed; |