From ec7e23f4580e151d0449b6cdeee52a47bf47bb82 Mon Sep 17 00:00:00 2001 From: Arcady Goldmints-Orlov Date: Wed, 18 Sep 2024 12:36:54 -0400 Subject: [PATCH] Final round of symbol visibility fixes This change adds GLSLANG_EXPORT in a couple more places, as well as adding a new symbol visibility annotation GLSLANG_EXPORT_FOR_TESTS which is defined the same as GLSLANG_EXPORT but documents the intention that the symbols marked with it are only meant to be used by glslang's test suite and do not form part of the public API and are thus not subject to ABI stability guarantees. --- SPIRV/Logger.h | 4 ++-- glslang/Include/visibility.h | 5 ++++- glslang/MachineIndependent/localintermediate.h | 1 + glslang/MachineIndependent/reflection.h | 5 +++-- glslang/OSDependent/osinclude.h | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/SPIRV/Logger.h b/SPIRV/Logger.h index dece1c4b..c64a3b8a 100644 --- a/SPIRV/Logger.h +++ b/SPIRV/Logger.h @@ -43,7 +43,7 @@ namespace spv { // A class for holding all SPIR-V build status messages, including // missing/TBD functionalities, warnings, and errors. -class SpvBuildLogger { +class GLSLANG_EXPORT SpvBuildLogger { public: SpvBuildLogger() {} @@ -59,7 +59,7 @@ public: // Returns all messages accumulated in the order of: // TBD functionalities, missing functionalities, warnings, errors. - GLSLANG_EXPORT std::string getAllMessages() const; + std::string getAllMessages() const; private: SpvBuildLogger(const SpvBuildLogger&); diff --git a/glslang/Include/visibility.h b/glslang/Include/visibility.h index d6b6bb34..9bb8f3fa 100644 --- a/glslang/Include/visibility.h +++ b/glslang/Include/visibility.h @@ -48,4 +48,7 @@ #define GLSLANG_EXPORT #endif - +// Symbols marked with this macro are only meant for public use by the test suite +// and do not appear in publicly installed headers. They are not considered to be +// part of the glslang library ABI. +#define GLSLANG_EXPORT_FOR_TESTS GLSLANG_EXPORT diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 390a405f..80638a6b 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -1063,6 +1063,7 @@ public: int checkLocationRT(int set, int location); int addUsedOffsets(int binding, int offset, int numOffsets); bool addUsedConstantId(int id); + GLSLANG_EXPORT_FOR_TESTS static int computeTypeLocationSize(const TType&, EShLanguage); static int computeTypeUniformLocationSize(const TType&); diff --git a/glslang/MachineIndependent/reflection.h b/glslang/MachineIndependent/reflection.h index 221d93f8..8315b112 100644 --- a/glslang/MachineIndependent/reflection.h +++ b/glslang/MachineIndependent/reflection.h @@ -37,8 +37,8 @@ #define _REFLECTION_INCLUDED #include "../Public/ShaderLang.h" -#include "../Include/Types.h" - +#include "../Include/BaseTypes.h" +#include "../Include/visibility.h" #include #include @@ -65,6 +65,7 @@ public: virtual ~TReflection() {} // grow the reflection stage by stage + GLSLANG_EXPORT_FOR_TESTS bool addStage(EShLanguage, const TIntermediate&); // for mapping a uniform index to a uniform object's description diff --git a/glslang/OSDependent/osinclude.h b/glslang/OSDependent/osinclude.h index 0d677e4a..da1c4f69 100644 --- a/glslang/OSDependent/osinclude.h +++ b/glslang/OSDependent/osinclude.h @@ -35,9 +35,10 @@ #ifndef __OSINCLUDE_H #define __OSINCLUDE_H +#include "../Include/visibility.h" namespace glslang { -void OS_DumpMemoryCounters(); +GLSLANG_EXPORT void OS_DumpMemoryCounters(); } // end namespace glslang