diff --git a/3rdparty/glslang b/3rdparty/glslang index 6f125987..fa562bb9 160000 --- a/3rdparty/glslang +++ b/3rdparty/glslang @@ -1 +1 @@ -Subproject commit 6f12598784a553f61568eb7340cfcffd2a502317 +Subproject commit fa562bb911bdc61d087c20c2020065d511a3c1d0 diff --git a/include/glslang/MachineIndependent/ParseHelper.h b/include/glslang/MachineIndependent/ParseHelper.h index 42bc00c7..a002f213 100644 --- a/include/glslang/MachineIndependent/ParseHelper.h +++ b/include/glslang/MachineIndependent/ParseHelper.h @@ -368,6 +368,8 @@ public: TIntermTyped* vkRelaxedRemapFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*); // returns true if the variable was remapped to something else void recordUniformInitializer(const TString&, const TType&, const TConstUnionArray&); + void recordUniformLocation(const TString&, const TType&); + void atomicCounterOffsetCheck(const TSourceLoc&, const TString&, const TType&); bool vkRelaxedRemapUniformVariable(const TSourceLoc&, TString&, const TPublicType&, TArraySizes*, TIntermTyped*, TType&); void vkRelaxedRemapUniformMembers(const TSourceLoc&, const TPublicType&, const TType&, const TString&); void vkRelaxedRemapFunctionParameter(TFunction*, TParameter&, std::vector* newParams = nullptr); diff --git a/include/glslang/MachineIndependent/localintermediate.h b/include/glslang/MachineIndependent/localintermediate.h index e19bc4d7..137ab279 100644 --- a/include/glslang/MachineIndependent/localintermediate.h +++ b/include/glslang/MachineIndependent/localintermediate.h @@ -637,6 +637,29 @@ public: void addUniformInitializer(TUniformInitializer&& init) { uniformInitializers.push_back(std::move(init)); } const std::vector& getUniformInitializers() const { return uniformInitializers; } + // A default-block uniform's explicit layout(location = N), recorded where Vulkan-relaxed + // rules DROP it. + // + // Desktop GLSL 4.3 / ARB_explicit_uniform_location lets a default-block uniform name the + // number glGetUniformLocation will answer for it. Vulkan-relaxed parsing sweeps such + // uniforms into a uniform BLOCK, where a location qualifier means nothing, so the + // qualifier is dropped with a warning - and once it is gone no later stage can tell the + // uniform ever carried one: mapIO sees layoutLocationEnd and reflection reports whatever + // the client's own assigner chose. The CLIENT is the only party that can still honor it, + // so the declared number is handed out here instead of discarded. + // + // arraySizes is the declared array shape, outer dimension first, and empty when the + // uniform is not an array. A client that keys these by REFLECTION name has to spell the + // same elements glslang's reflection will ("u[1][0]" for a float u[2][3]), and only the + // declaration knows the shape; a dimension glslang could not size appears as 0. + struct TUniformLocation { + std::string name; + int location = -1; + std::vector arraySizes; + }; + void addUniformLocation(TUniformLocation&& location) { uniformLocations.push_back(std::move(location)); } + const std::vector& getUniformLocations() const { return uniformLocations; } + void setAtomicCounterBlockName(const char* name) { atomicCounterBlockName = std::string(name); } const char* getAtomicCounterBlockName() const { return atomicCounterBlockName.c_str(); } void setAtomicCounterBlockSet(unsigned int set) { atomicCounterBlockSet = set; } @@ -1250,6 +1273,7 @@ protected: std::string globalUniformBlockName; std::string atomicCounterBlockName; std::vector uniformInitializers; + std::vector uniformLocations; unsigned int globalUniformBlockSet; unsigned int globalUniformBlockBinding; unsigned int atomicCounterBlockSet;