Бранимир Караџић 5 лет назад
Родитель
Сommit
0440e80b79

+ 11 - 1
3rdparty/glslang/CHANGES.md

@@ -3,7 +3,17 @@
 All notable changes to this project will be documented in this file.
 This project adheres to [Semantic Versioning](https://semver.org/).
 
-## 10.15.3847-dev 2020-06-16
+## 11.0.0 2020-07-20
+
+### Breaking changes
+
+#### Visual Studio 2013 is no longer supported
+
+[As scheduled](https://github.com/KhronosGroup/glslang/blob/9eef54b2513ca6b40b47b07d24f453848b65c0df/README.md#planned-deprecationsremovals),
+Microsoft Visual Studio 2013 is no longer officially supported. Please upgrade
+to at least Visual Studio 2015.
+
+## 10.15.3847 2020-07-20
 
 ### Breaking changes
 

+ 1 - 0
3rdparty/glslang/OGLCompilersDLL/CMakeLists.txt

@@ -36,6 +36,7 @@ set(SOURCES InitializeDll.cpp InitializeDll.h)
 add_library(OGLCompiler STATIC ${SOURCES})
 set_property(TARGET OGLCompiler PROPERTY FOLDER glslang)
 set_property(TARGET OGLCompiler PROPERTY POSITION_INDEPENDENT_CODE ON)
+glslang_default_to_hidden_visibility(OGLCompiler)
 
 if(WIN32)
     source_group("Source" FILES ${SOURCES})

+ 0 - 128
3rdparty/glslang/OGLCompilersDLL/InitializeDll.cpp

@@ -32,134 +32,6 @@
 // POSSIBILITY OF SUCH DAMAGE.
 //
 
-#define SH_EXPORTING
-
-#include <cassert>
-
-#include "InitializeDll.h"
-#include "../glslang/Include/InitializeGlobals.h"
-#include "../glslang/Public/ShaderLang.h"
-#include "../glslang/Include/PoolAlloc.h"
-
 namespace glslang {
 
-OS_TLSIndex ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
-
-// Per-process initialization.
-// Needs to be called at least once before parsing, etc. is done.
-// Will also do thread initialization for the calling thread; other
-// threads will need to do that explicitly.
-bool InitProcess()
-{
-    glslang::GetGlobalLock();
-
-    if (ThreadInitializeIndex != OS_INVALID_TLS_INDEX) {
-        //
-        // Function is re-entrant.
-        //
-
-        glslang::ReleaseGlobalLock();
-        return true;
-    }
-
-    ThreadInitializeIndex = OS_AllocTLSIndex();
-
-    if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 && "InitProcess(): Failed to allocate TLS area for init flag");
-
-        glslang::ReleaseGlobalLock();
-        return false;
-    }
-
-    if (! InitializePoolIndex()) {
-        assert(0 && "InitProcess(): Failed to initialize global pool");
-
-        glslang::ReleaseGlobalLock();
-        return false;
-    }
-
-    if (! InitThread()) {
-        assert(0 && "InitProcess(): Failed to initialize thread");
-
-        glslang::ReleaseGlobalLock();
-        return false;
-    }
-
-    glslang::ReleaseGlobalLock();
-    return true;
-}
-
-// Per-thread scoped initialization.
-// Must be called at least once by each new thread sharing the
-// symbol tables, etc., needed to parse.
-bool InitThread()
-{
-    //
-    // This function is re-entrant
-    //
-    if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 && "InitThread(): Process hasn't been initalised.");
-        return false;
-    }
-
-    if (OS_GetTLSValue(ThreadInitializeIndex) != 0)
-        return true;
-
-    if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) {
-        assert(0 && "InitThread(): Unable to set init flag.");
-        return false;
-    }
-
-    glslang::SetThreadPoolAllocator(nullptr);
-
-    return true;
-}
-
-// Not necessary to call this: InitThread() is reentrant, and the need
-// to do per thread tear down has been removed.
-//
-// This is kept, with memory management removed, to satisfy any exiting
-// calls to it that rely on it.
-bool DetachThread()
-{
-    bool success = true;
-
-    if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
-        return true;
-
-    //
-    // Function is re-entrant and this thread may not have been initialized.
-    //
-    if (OS_GetTLSValue(ThreadInitializeIndex) != 0) {
-        if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) {
-            assert(0 && "DetachThread(): Unable to clear init flag.");
-            success = false;
-        }
-    }
-
-    return success;
-}
-
-// Not necessary to call this: InitProcess() is reentrant.
-//
-// This is kept, with memory management removed, to satisfy any exiting
-// calls to it that rely on it.
-//
-// Users of glslang should call shFinalize() or glslang::FinalizeProcess() for
-// process-scoped memory tear down.
-bool DetachProcess()
-{
-    bool success = true;
-
-    if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
-        return true;
-
-    success = DetachThread();
-
-    OS_FreeTLSIndex(ThreadInitializeIndex);
-    ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
-
-    return success;
-}
-
 } // end namespace glslang

+ 4 - 4
3rdparty/glslang/OGLCompilersDLL/InitializeDll.h

@@ -38,10 +38,10 @@
 
 namespace glslang {
 
-bool InitProcess();
-bool InitThread();
-bool DetachThread();  // not called from standalone, perhaps other tools rely on parts of it
-bool DetachProcess(); // not called from standalone, perhaps other tools rely on parts of it
+inline bool InitProcess()   { return true; } // DEPRECATED
+inline bool InitThread()    { return true; } // DEPRECATED
+inline bool DetachThread()  { return true; } // DEPRECATED
+inline bool DetachProcess() { return true; } // DEPRECATED
 
 } // end namespace glslang
 

+ 4 - 5
3rdparty/glslang/SPIRV/CMakeLists.txt

@@ -43,8 +43,7 @@ set(SOURCES
     CInterface/spirv_c_interface.cpp)
 
 set(SPVREMAP_SOURCES
-    SPVRemapper.cpp
-    doc.cpp)
+    SPVRemapper.cpp)
 
 set(HEADERS
     bitutils.h
@@ -69,6 +68,7 @@ set(SPVREMAP_HEADERS
     doc.h)
 
 add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
+target_link_libraries(SPIRV PRIVATE MachineIndependent)
 set_property(TARGET SPIRV PROPERTY FOLDER glslang)
 set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
 target_include_directories(SPIRV PUBLIC
@@ -79,6 +79,7 @@ glslang_add_build_info_dependency(SPIRV)
 
 if (ENABLE_SPVREMAPPER)
     add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
+    target_link_libraries(SPVRemapper PRIVATE SPIRV)
     set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
     set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON)
 endif()
@@ -95,12 +96,10 @@ if(ENABLE_OPT)
         PRIVATE ${spirv-tools_SOURCE_DIR}/include
         PRIVATE ${spirv-tools_SOURCE_DIR}/source
     )
-    target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt)
+    target_link_libraries(SPIRV PRIVATE SPIRV-Tools-opt)
     target_include_directories(SPIRV PUBLIC
         $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
-else()
-    target_link_libraries(SPIRV PRIVATE MachineIndependent)
 endif(ENABLE_OPT)
 
 if(WIN32)

+ 1 - 0
3rdparty/glslang/SPIRV/GLSL.ext.EXT.h

@@ -35,5 +35,6 @@ static const char* const E_SPV_EXT_shader_viewport_index_layer  = "SPV_EXT_shade
 static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered";
 static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density";
 static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation";
+static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_atomic_float_add";
 
 #endif  // #ifndef GLSLextEXT_H

+ 8 - 0
3rdparty/glslang/SPIRV/GlslangToSpv.cpp

@@ -6682,6 +6682,14 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
     case glslang::EOpImageAtomicAdd:
     case glslang::EOpAtomicCounterAdd:
         opCode = spv::OpAtomicIAdd;
+        if (typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
+            opCode = spv::OpAtomicFAddEXT;
+            builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_add);
+            if (typeProxy == glslang::EbtFloat)
+                builder.addCapability(spv::CapabilityAtomicFloat32AddEXT);
+            else
+                builder.addCapability(spv::CapabilityAtomicFloat64AddEXT);
+        }
         break;
     case glslang::EOpAtomicCounterSubtract:
         opCode = spv::OpAtomicISub;

+ 10 - 0
3rdparty/glslang/SPIRV/doc.cpp

@@ -938,6 +938,9 @@ const char* CapabilityString(int info)
 
     case CapabilityIntegerFunctions2INTEL:              return "CapabilityIntegerFunctions2INTEL";
 
+    case CapabilityAtomicFloat32AddEXT:                     return "AtomicFloat32AddEXT";
+    case CapabilityAtomicFloat64AddEXT:                     return "AtomicFloat64AddEXT";
+
     default: return "Bad";
     }
 }
@@ -1313,6 +1316,8 @@ const char* OpcodeString(int op)
     case 4430: return "OpSubgroupAllEqualKHR";
     case 4432: return "OpSubgroupReadInvocationKHR";
 
+    case OpAtomicFAddEXT: return "OpAtomicFAddEXT";
+
     case 5000: return "OpGroupIAddNonUniformAMD";
     case 5001: return "OpGroupFAddNonUniformAMD";
     case 5002: return "OpGroupFMinNonUniformAMD";
@@ -2260,6 +2265,11 @@ void Parameterize()
     InstructionDesc[OpAtomicIAdd].operands.push(OperandMemorySemantics, "'Semantics'");
     InstructionDesc[OpAtomicIAdd].operands.push(OperandId, "'Value'");
 
+    InstructionDesc[OpAtomicFAddEXT].operands.push(OperandId, "'Pointer'");
+    InstructionDesc[OpAtomicFAddEXT].operands.push(OperandScope, "'Scope'");
+    InstructionDesc[OpAtomicFAddEXT].operands.push(OperandMemorySemantics, "'Semantics'");
+    InstructionDesc[OpAtomicFAddEXT].operands.push(OperandId, "'Value'");
+
     InstructionDesc[OpAtomicISub].operands.push(OperandId, "'Pointer'");
     InstructionDesc[OpAtomicISub].operands.push(OperandScope, "'Scope'");
     InstructionDesc[OpAtomicISub].operands.push(OperandMemorySemantics, "'Semantics'");

+ 57 - 0
3rdparty/glslang/SPIRV/spirv.hpp

@@ -168,6 +168,10 @@ enum ExecutionMode {
     ExecutionModeSampleInterlockUnorderedEXT = 5369,
     ExecutionModeShadingRateInterlockOrderedEXT = 5370,
     ExecutionModeShadingRateInterlockUnorderedEXT = 5371,
+    ExecutionModeMaxWorkgroupSizeINTEL = 5893,
+    ExecutionModeMaxWorkDimINTEL = 5894,
+    ExecutionModeNoGlobalOffsetINTEL = 5895,
+    ExecutionModeNumSIMDWorkitemsINTEL = 5896,
     ExecutionModeMax = 0x7fffffff,
 };
 
@@ -199,6 +203,7 @@ enum StorageClass {
     StorageClassShaderRecordBufferNV = 5343,
     StorageClassPhysicalStorageBuffer = 5349,
     StorageClassPhysicalStorageBufferEXT = 5349,
+    StorageClassCodeSectionINTEL = 5605,
     StorageClassMax = 0x7fffffff,
 };
 
@@ -477,11 +482,24 @@ enum Decoration {
     DecorationRestrictPointerEXT = 5355,
     DecorationAliasedPointer = 5356,
     DecorationAliasedPointerEXT = 5356,
+    DecorationReferencedIndirectlyINTEL = 5602,
     DecorationCounterBuffer = 5634,
     DecorationHlslCounterBufferGOOGLE = 5634,
     DecorationHlslSemanticGOOGLE = 5635,
     DecorationUserSemantic = 5635,
     DecorationUserTypeGOOGLE = 5636,
+    DecorationRegisterINTEL = 5825,
+    DecorationMemoryINTEL = 5826,
+    DecorationNumbanksINTEL = 5827,
+    DecorationBankwidthINTEL = 5828,
+    DecorationMaxPrivateCopiesINTEL = 5829,
+    DecorationSinglepumpINTEL = 5830,
+    DecorationDoublepumpINTEL = 5831,
+    DecorationMaxReplicatesINTEL = 5832,
+    DecorationSimpleDualPortINTEL = 5833,
+    DecorationMergeINTEL = 5834,
+    DecorationBankBitsINTEL = 5835,
+    DecorationForcePow2DepthINTEL = 5836,
     DecorationMax = 0x7fffffff,
 };
 
@@ -628,6 +646,13 @@ enum LoopControlShift {
     LoopControlIterationMultipleShift = 6,
     LoopControlPeelCountShift = 7,
     LoopControlPartialCountShift = 8,
+    LoopControlInitiationIntervalINTELShift = 16,
+    LoopControlMaxConcurrencyINTELShift = 17,
+    LoopControlDependencyArrayINTELShift = 18,
+    LoopControlPipelineEnableINTELShift = 19,
+    LoopControlLoopCoalesceINTELShift = 20,
+    LoopControlMaxInterleavingINTELShift = 21,
+    LoopControlSpeculatedIterationsINTELShift = 22,
     LoopControlMax = 0x7fffffff,
 };
 
@@ -642,6 +667,13 @@ enum LoopControlMask {
     LoopControlIterationMultipleMask = 0x00000040,
     LoopControlPeelCountMask = 0x00000080,
     LoopControlPartialCountMask = 0x00000100,
+    LoopControlInitiationIntervalINTELMask = 0x00010000,
+    LoopControlMaxConcurrencyINTELMask = 0x00020000,
+    LoopControlDependencyArrayINTELMask = 0x00040000,
+    LoopControlPipelineEnableINTELMask = 0x00080000,
+    LoopControlLoopCoalesceINTELMask = 0x00100000,
+    LoopControlMaxInterleavingINTELMask = 0x00200000,
+    LoopControlSpeculatedIterationsINTELMask = 0x00400000,
 };
 
 enum FunctionControlShift {
@@ -928,9 +960,20 @@ enum Capability {
     CapabilitySubgroupImageBlockIOINTEL = 5570,
     CapabilitySubgroupImageMediaBlockIOINTEL = 5579,
     CapabilityIntegerFunctions2INTEL = 5584,
+    CapabilityFunctionPointersINTEL = 5603,
+    CapabilityIndirectReferencesINTEL = 5604,
     CapabilitySubgroupAvcMotionEstimationINTEL = 5696,
     CapabilitySubgroupAvcMotionEstimationIntraINTEL = 5697,
     CapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698,
+    CapabilityFPGAMemoryAttributesINTEL = 5824,
+    CapabilityUnstructuredLoopControlsINTEL = 5886,
+    CapabilityFPGALoopControlsINTEL = 5888,
+    CapabilityKernelAttributesINTEL = 5892,
+    CapabilityFPGAKernelAttributesINTEL = 5897,
+    CapabilityBlockingPipesINTEL = 5945,
+    CapabilityFPGARegINTEL = 5948,
+    CapabilityAtomicFloat32AddEXT = 6033,
+    CapabilityAtomicFloat64AddEXT = 6034,
     CapabilityMax = 0x7fffffff,
 };
 
@@ -1398,6 +1441,8 @@ enum Op {
     OpUSubSatINTEL = 5596,
     OpIMul32x16INTEL = 5597,
     OpUMul32x16INTEL = 5598,
+    OpFunctionPointerINTEL = 5600,
+    OpFunctionPointerCallINTEL = 5601,
     OpDecorateString = 5632,
     OpDecorateStringGOOGLE = 5632,
     OpMemberDecorateString = 5633,
@@ -1520,6 +1565,10 @@ enum Op {
     OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814,
     OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815,
     OpSubgroupAvcSicGetInterRawSadsINTEL = 5816,
+    OpLoopControlINTEL = 5887,
+    OpReadPipeBlockingINTEL = 5946,
+    OpWritePipeBlockingINTEL = 5947,
+    OpFPGARegINTEL = 5949,
     OpRayQueryGetRayTMinKHR = 6016,
     OpRayQueryGetRayFlagsKHR = 6017,
     OpRayQueryGetIntersectionTKHR = 6018,
@@ -1537,6 +1586,7 @@ enum Op {
     OpRayQueryGetWorldRayOriginKHR = 6030,
     OpRayQueryGetIntersectionObjectToWorldKHR = 6031,
     OpRayQueryGetIntersectionWorldToObjectKHR = 6032,
+    OpAtomicFAddEXT = 6035,
     OpMax = 0x7fffffff,
 };
 
@@ -1955,6 +2005,8 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
     case OpUSubSatINTEL: *hasResult = true; *hasResultType = true; break;
     case OpIMul32x16INTEL: *hasResult = true; *hasResultType = true; break;
     case OpUMul32x16INTEL: *hasResult = true; *hasResultType = true; break;
+    case OpFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break;
+    case OpFunctionPointerCallINTEL: *hasResult = true; *hasResultType = true; break;
     case OpDecorateString: *hasResult = false; *hasResultType = false; break;
     case OpMemberDecorateString: *hasResult = false; *hasResultType = false; break;
     case OpVmeImageINTEL: *hasResult = true; *hasResultType = true; break;
@@ -2075,6 +2127,10 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
     case OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: *hasResult = true; *hasResultType = true; break;
     case OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: *hasResult = true; *hasResultType = true; break;
     case OpSubgroupAvcSicGetInterRawSadsINTEL: *hasResult = true; *hasResultType = true; break;
+    case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break;
+    case OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break;
+    case OpWritePipeBlockingINTEL: *hasResult = true; *hasResultType = true; break;
+    case OpFPGARegINTEL: *hasResult = true; *hasResultType = true; break;
     case OpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break;
     case OpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break;
     case OpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break;
@@ -2092,6 +2148,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
     case OpRayQueryGetWorldRayOriginKHR: *hasResult = true; *hasResultType = true; break;
     case OpRayQueryGetIntersectionObjectToWorldKHR: *hasResult = true; *hasResultType = true; break;
     case OpRayQueryGetIntersectionWorldToObjectKHR: *hasResult = true; *hasResultType = true; break;
+    case OpAtomicFAddEXT: *hasResult = true; *hasResultType = true; break;
     }
 }
 #endif /* SPV_ENABLE_UTILITY_CODE */

+ 4 - 4
3rdparty/glslang/build_info.h

@@ -34,10 +34,10 @@
 #ifndef GLSLANG_BUILD_INFO
 #define GLSLANG_BUILD_INFO
 
-#define GLSLANG_VERSION_MAJOR 10
-#define GLSLANG_VERSION_MINOR 15
-#define GLSLANG_VERSION_PATCH 3847
-#define GLSLANG_VERSION_FLAVOR "dev"
+#define GLSLANG_VERSION_MAJOR 11
+#define GLSLANG_VERSION_MINOR 0
+#define GLSLANG_VERSION_PATCH 0
+#define GLSLANG_VERSION_FLAVOR ""
 
 #define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \
     (((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \

+ 5 - 2
3rdparty/glslang/build_info.py

@@ -100,12 +100,15 @@ def deduce_software_version(directory):
         for line in f.readlines():
             match = pattern.match(line)
             if match:
+                flavor = match.group(4)
+                if flavor == None:
+                    flavor = ""
                 return {
                     "major": match.group(1),
                     "minor": match.group(2),
                     "patch": match.group(3),
-                    "flavor": match.group(4).lstrip("-"),
-                    "-flavor": match.group(4),
+                    "flavor": flavor.lstrip("-"),
+                    "-flavor": flavor,
                     "date": match.group(5),
                 }
     raise Exception('No version number found in {}'.format(changes_file))

+ 3 - 1
3rdparty/glslang/glslang/CMakeLists.txt

@@ -52,6 +52,7 @@ add_library(GenericCodeGen STATIC
     GenericCodeGen/Link.cpp)
 set_property(TARGET GenericCodeGen PROPERTY POSITION_INDEPENDENT_CODE ON)
 set_property(TARGET GenericCodeGen PROPERTY FOLDER glslang)
+glslang_default_to_hidden_visibility(GenericCodeGen)
 
 ################################################################################
 # MachineIndependent
@@ -133,6 +134,7 @@ endif(ENABLE_HLSL)
 add_library(MachineIndependent STATIC ${MACHINEINDEPENDENT_SOURCES} ${MACHINEINDEPENDENT_HEADERS})
 set_property(TARGET MachineIndependent PROPERTY POSITION_INDEPENDENT_CODE ON)
 set_property(TARGET MachineIndependent PROPERTY FOLDER glslang)
+glslang_only_export_explicit_symbols(MachineIndependent)
 
 glslang_add_build_info_dependency(MachineIndependent)
 
@@ -168,7 +170,7 @@ set_target_properties(glslang PROPERTIES
     POSITION_INDEPENDENT_CODE ON
     VERSION   "${GLSLANG_VERSION}"
     SOVERSION "${GLSLANG_VERSION_MAJOR}")
-target_link_libraries(glslang PRIVATE OGLCompiler OSDependent MachineIndependent)
+target_link_libraries(glslang PRIVATE OGLCompiler MachineIndependent)
 target_include_directories(glslang PUBLIC
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
     $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

+ 1 - 1
3rdparty/glslang/glslang/Include/InitializeGlobals.h

@@ -37,7 +37,7 @@
 
 namespace glslang {
 
-bool InitializePoolIndex();
+inline bool InitializePoolIndex() { return true; } // DEPRECATED: No need to call
 
 } // end namespace glslang
 

+ 41 - 2
3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp

@@ -1241,11 +1241,19 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
             " int64_t atomicAdd(coherent volatile inout  int64_t,  int64_t);"
             "uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t, int, int, int);"
             " int64_t atomicAdd(coherent volatile inout  int64_t,  int64_t, int, int, int);"
+            "   float atomicAdd(coherent volatile inout float, float);"
+            "   float atomicAdd(coherent volatile inout float, float, int, int, int);"
+            "  double atomicAdd(coherent volatile inout double, double);"
+            "  double atomicAdd(coherent volatile inout double, double, int, int, int);"
 
             "uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t);"
             " int64_t atomicExchange(coherent volatile inout  int64_t,  int64_t);"
             "uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t, int, int, int);"
             " int64_t atomicExchange(coherent volatile inout  int64_t,  int64_t, int, int, int);"
+            "   float atomicExchange(coherent volatile inout float, float);"
+            "   float atomicExchange(coherent volatile inout float, float, int, int, int);"
+            "  double atomicExchange(coherent volatile inout double, double);"
+            "  double atomicExchange(coherent volatile inout double, double, int, int, int);"
 
             "uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t);"
             " int64_t atomicCompSwap(coherent volatile inout  int64_t,  int64_t,  int64_t);"
@@ -1254,9 +1262,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
 
             "uint64_t atomicLoad(coherent volatile in uint64_t, int, int, int);"
             " int64_t atomicLoad(coherent volatile in  int64_t, int, int, int);"
+            "   float atomicLoad(coherent volatile in float, int, int, int);"
+            "  double atomicLoad(coherent volatile in double, int, int, int);"
 
             "void atomicStore(coherent volatile out uint64_t, uint64_t, int, int, int);"
             "void atomicStore(coherent volatile out  int64_t,  int64_t, int, int, int);"
+            "void atomicStore(coherent volatile out float, float, int, int, int);"
+            "void atomicStore(coherent volatile out double, double, int, int, int);"
             "\n");
     }
 #endif
@@ -6013,12 +6025,39 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int
             // not int or uint
             // GL_ARB_ES3_1_compatibility
             // TODO: spec issue: are there restrictions on the kind of layout() that can be used?  what about dropping memory qualifiers?
-            if ((profile != EEsProfile && version >= 450) ||
-                (profile == EEsProfile && version >= 310)) {
+            if (profile == EEsProfile && version >= 310) {
                 commonBuiltins.append("float imageAtomicExchange(volatile coherent ");
                 commonBuiltins.append(imageParams);
                 commonBuiltins.append(", float);\n");
             }
+            if (profile != EEsProfile && version >= 450) {
+                commonBuiltins.append("float imageAtomicAdd(volatile coherent ");
+                commonBuiltins.append(imageParams);
+                commonBuiltins.append(", float);\n");
+
+                commonBuiltins.append("float imageAtomicAdd(volatile coherent ");
+                commonBuiltins.append(imageParams);
+                commonBuiltins.append(", float");
+                commonBuiltins.append(", int, int, int);\n");
+
+                commonBuiltins.append("float imageAtomicExchange(volatile coherent ");
+                commonBuiltins.append(imageParams);
+                commonBuiltins.append(", float);\n");
+
+                commonBuiltins.append("float imageAtomicExchange(volatile coherent ");
+                commonBuiltins.append(imageParams);
+                commonBuiltins.append(", float");
+                commonBuiltins.append(", int, int, int);\n");
+
+                commonBuiltins.append("float imageAtomicLoad(readonly volatile coherent ");
+                commonBuiltins.append(imageParams);
+                commonBuiltins.append(", int, int, int);\n");
+
+                commonBuiltins.append("void imageAtomicStore(writeonly volatile coherent ");
+                commonBuiltins.append(imageParams);
+                commonBuiltins.append(", float");
+                commonBuiltins.append(", int, int, int);\n");
+            }
         }
     }
 

+ 34 - 4
3rdparty/glslang/glslang/MachineIndependent/LiveTraverser.h

@@ -74,14 +74,33 @@ public:
         for (unsigned int f = 0; f < globals.size(); ++f) {
             TIntermAggregate* candidate = globals[f]->getAsAggregate();
             if (candidate && candidate->getOp() == EOpFunction && candidate->getName() == name) {
-                functions.push_back(candidate);
+                destinations.push_back(candidate);
                 break;
             }
         }
     }
 
-    typedef std::list<TIntermAggregate*> TFunctionStack;
-    TFunctionStack functions;
+    void pushGlobalReference(const TString& name)
+    {
+        TIntermSequence& globals = intermediate.getTreeRoot()->getAsAggregate()->getSequence();
+        for (unsigned int f = 0; f < globals.size(); ++f) {
+            TIntermAggregate* candidate = globals[f]->getAsAggregate();
+            if (candidate && candidate->getOp() == EOpSequence &&
+                candidate->getSequence().size() == 1 &&
+                candidate->getSequence()[0]->getAsBinaryNode()) {
+                TIntermBinary* binary = candidate->getSequence()[0]->getAsBinaryNode();
+                TIntermSymbol* symbol = binary->getLeft()->getAsSymbolNode();
+                if (symbol && symbol->getQualifier().storage == EvqGlobal &&
+                    symbol->getName() == name) {
+                    destinations.push_back(candidate);
+                    break;
+                }
+            }
+        }
+    }
+
+    typedef std::list<TIntermAggregate*> TDestinationStack;
+    TDestinationStack destinations;
 
 protected:
     // To catch which function calls are not dead, and hence which functions must be visited.
@@ -117,16 +136,27 @@ protected:
     // and only visit each function once.
     void addFunctionCall(TIntermAggregate* call)
     {
-        // // just use the map to ensure we process each function at most once
+        // just use the map to ensure we process each function at most once
         if (liveFunctions.find(call->getName()) == liveFunctions.end()) {
             liveFunctions.insert(call->getName());
             pushFunction(call->getName());
         }
     }
 
+    void addGlobalReference(const TString& name)
+    {
+        // just use the map to ensure we process each global at most once
+        if (liveGlobals.find(name) == liveGlobals.end()) {
+            liveGlobals.insert(name);
+            pushGlobalReference(name);
+        }
+    }
+
     const TIntermediate& intermediate;
     typedef std::unordered_set<TString> TLiveFunctions;
     TLiveFunctions liveFunctions;
+    typedef std::unordered_set<TString> TLiveGlobals;
+    TLiveGlobals liveGlobals;
     bool traverseAll;
 
 private:

+ 16 - 1
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp

@@ -2110,7 +2110,14 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
             if (imageType.getQualifier().getFormat() != ElfR32i && imageType.getQualifier().getFormat() != ElfR32ui)
                 error(loc, "only supported on image with format r32i or r32ui", fnCandidate.getName().c_str(), "");
         } else {
-            if (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") != 0)
+            bool isImageAtomicOnFloatAllowed = ((fnCandidate.getName().compare(0, 14, "imageAtomicAdd") == 0) ||
+                (fnCandidate.getName().compare(0, 15, "imageAtomicLoad") == 0) ||
+                (fnCandidate.getName().compare(0, 16, "imageAtomicStore") == 0) ||
+                (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") == 0));
+            if (imageType.getSampler().type == EbtFloat && isImageAtomicOnFloatAllowed &&
+                (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") != 0)) // imageAtomicExchange doesn't require GL_EXT_shader_atomic_float
+                requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_float, fnCandidate.getName().c_str());
+            if (!isImageAtomicOnFloatAllowed)
                 error(loc, "only supported on integer images", fnCandidate.getName().c_str(), "");
             else if (imageType.getQualifier().getFormat() != ElfR32f && isEsProfile())
                 error(loc, "only supported on image with format r32f", fnCandidate.getName().c_str(), "");
@@ -2139,10 +2146,18 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
         if (argp->size() > 3) {
             requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str());
             memorySemanticsCheck(loc, fnCandidate, callNode);
+            if ((callNode.getOp() == EOpAtomicAdd || callNode.getOp() == EOpAtomicExchange ||
+                callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpAtomicStore) &&
+                (arg0->getType().isFloatingDomain())) {
+                requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_float, fnCandidate.getName().c_str());
+            }
         } else if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64) {
             const char* const extensions[2] = { E_GL_NV_shader_atomic_int64,
                                                 E_GL_EXT_shader_atomic_int64 };
             requireExtensions(loc, 2, extensions, fnCandidate.getName().c_str());
+        } else if ((callNode.getOp() == EOpAtomicAdd || callNode.getOp() == EOpAtomicExchange) &&
+                   (arg0->getType().isFloatingDomain())) {
+            requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_float, fnCandidate.getName().c_str());
         }
         break;
     }

+ 11 - 17
3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp

@@ -35,34 +35,28 @@
 #include "../Include/Common.h"
 #include "../Include/PoolAlloc.h"
 
-#include "../Include/InitializeGlobals.h"
-#include "../OSDependent/osinclude.h"
-
 namespace glslang {
 
-// Process-wide TLS index
-OS_TLSIndex PoolIndex;
+namespace {
+thread_local TPoolAllocator* threadPoolAllocator = nullptr;
+
+TPoolAllocator* GetDefaultThreadPoolAllocator()
+{
+    thread_local TPoolAllocator defaultAllocator;
+    return &defaultAllocator;
+}
+} // anonymous namespace
 
 // Return the thread-specific current pool.
 TPoolAllocator& GetThreadPoolAllocator()
 {
-    return *static_cast<TPoolAllocator*>(OS_GetTLSValue(PoolIndex));
+    return *(threadPoolAllocator ? threadPoolAllocator : GetDefaultThreadPoolAllocator());
 }
 
 // Set the thread-specific current pool.
 void SetThreadPoolAllocator(TPoolAllocator* poolAllocator)
 {
-    OS_SetTLSValue(PoolIndex, poolAllocator);
-}
-
-// Process-wide set up of the TLS pool storage.
-bool InitializePoolIndex()
-{
-    // Allocate a TLS index.
-    if ((PoolIndex = OS_AllocTLSIndex()) == OS_INVALID_TLS_INDEX)
-        return false;
-
-    return true;
+    threadPoolAllocator = poolAllocator;
 }
 
 //

+ 3 - 0
3rdparty/glslang/glslang/MachineIndependent/Versions.cpp

@@ -347,6 +347,7 @@ void TParseVersions::initializeExtensionBehavior()
     extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_int16]   = EBhDisable;
     extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_int64]   = EBhDisable;
     extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_float16] = EBhDisable;
+    extensionBehavior[E_GL_EXT_shader_atomic_float]                    = EBhDisable;
 }
 
 #endif // GLSLANG_WEB
@@ -520,6 +521,8 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define GL_EXT_shader_subgroup_extended_types_int16 1\n"
             "#define GL_EXT_shader_subgroup_extended_types_int64 1\n"
             "#define GL_EXT_shader_subgroup_extended_types_float16 1\n"
+
+            "#define GL_EXT_shader_atomic_float 1\n"
             ;
 
         if (version >= 150) {

+ 2 - 0
3rdparty/glslang/glslang/MachineIndependent/Versions.h

@@ -298,6 +298,8 @@ const char* const E_GL_EXT_shader_subgroup_extended_types_int16   = "GL_EXT_shad
 const char* const E_GL_EXT_shader_subgroup_extended_types_int64   = "GL_EXT_shader_subgroup_extended_types_int64";
 const char* const E_GL_EXT_shader_subgroup_extended_types_float16 = "GL_EXT_shader_subgroup_extended_types_float16";
 
+const char* const E_GL_EXT_shader_atomic_float = "GL_EXT_shader_atomic_float";
+
 // Arrays of extensions for the above AEP duplications
 
 const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader };

+ 15 - 8
3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp

@@ -79,6 +79,11 @@ public:
             target = &outputList;
         else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().isPushConstant())
             target = &uniformList;
+        // If a global is being visited, then we should also traverse it incase it's evaluation
+        // ends up visiting inputs we want to tag as live
+        else if (base->getQualifier().storage == EvqGlobal)
+            addGlobalReference(base->getName());
+
         if (target) {
             TVarEntryInfo ent = {base->getId(), base, ! traverseAll};
             ent.stage = intermediate.getStage();
@@ -1105,11 +1110,12 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
     TVarGatherTraverser iter_binding_live(intermediate, false, inVarMap, outVarMap, uniformVarMap);
     root->traverse(&iter_binding_all);
     iter_binding_live.pushFunction(intermediate.getEntryPointMangledName().c_str());
-    while (! iter_binding_live.functions.empty()) {
-        TIntermNode* function = iter_binding_live.functions.back();
-        iter_binding_live.functions.pop_back();
-        function->traverse(&iter_binding_live);
+    while (! iter_binding_live.destinations.empty()) {
+        TIntermNode* destination = iter_binding_live.destinations.back();
+        iter_binding_live.destinations.pop_back();
+        destination->traverse(&iter_binding_live);
     }
+
     // sort entries by priority. see TVarEntryInfo::TOrderByPriority for info.
     std::for_each(inVarMap.begin(), inVarMap.end(),
                   [&inVector](TVarLivePair p) { inVector.push_back(p); });
@@ -1200,11 +1206,12 @@ bool TGlslIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TIn
                                           *uniformVarMap[stage]);
     root->traverse(&iter_binding_all);
     iter_binding_live.pushFunction(intermediate.getEntryPointMangledName().c_str());
-    while (! iter_binding_live.functions.empty()) {
-        TIntermNode* function = iter_binding_live.functions.back();
-        iter_binding_live.functions.pop_back();
-        function->traverse(&iter_binding_live);
+    while (! iter_binding_live.destinations.empty()) {
+        TIntermNode* destination = iter_binding_live.destinations.back();
+        iter_binding_live.destinations.pop_back();
+        destination->traverse(&iter_binding_live);
     }
+
     TNotifyInOutAdaptor inOutNotify(stage, *resolver);
     TNotifyUniformAdaptor uniformNotify(stage, *resolver);
     // Resolve current stage input symbol location with previous stage output here,

+ 48 - 38
3rdparty/glslang/license-checker.cfg

@@ -1,41 +1,51 @@
-{
-    "paths": [
-        {
-            "exclude": [
-                "_config.yml",
-                ".*",
-                "*.md",
-                "CMakeSettings.json",
-                "known_good_khr.json",
-                "known_good.json",
-                "LICENSE.txt",
-                "make-revision",
-                "README-spirv-remap.txt",
-                "WORKSPACE",
+[
+    {
+        "licenses": [
+            "Apache-2.0-Header",
+            "BSD-2-Clause",
+            "BSD-3-Clause",
+            "MIT-0",
+            "MIT"
+        ],
+        "paths": [
+            {
+                "exclude": [
+                    "**.md",
 
-                "gtests/README.md",
-                "External/spirv-tools",
-                "Test/*",
-                "out/*",
-                "glslang/Include/revision.*",
-                "glslang/OSDependent/Web/glslang.*.js",
+                    "_config.yml",
+                    ".*",
+                    "CMakeSettings.json",
+                    "known_good_khr.json",
+                    "known_good.json",
+                    "LICENSE.txt",
+                    "make-revision",
+                    "README-spirv-remap.txt",
+                    "WORKSPACE",
 
-                "glslang/MachineIndependent/glslang_tab.cpp",
-                "glslang/MachineIndependent/glslang_tab.cpp.h",
+                    "glslang/OSDependent/Web/glslang.*.js",
+                    "glslang/MachineIndependent/glslang_tab.cpp",
+                    "glslang/MachineIndependent/glslang_tab.cpp.h",
 
-                "**.md",
-                "build/**",
-                "out/**",
-                "Test/**",
-                "External/spirv-tools/**"
-            ]
-        }
-    ],
-    "licenses": [
-        "Apache-2.0-Header",
-        "BSD-2-Clause",
-        "BSD-3-Clause",
-        "MIT-0",
-        "MIT"
-    ]
-}
+                    "build/**",
+                    "out/**",
+                    "Test/**",
+                    "External/spirv-tools/**"
+                ]
+            }
+        ]
+    },
+    {
+        "licenses": [
+            "GPL-Header"
+        ],
+        "paths": [
+            { "exclude": [ "**" ] },
+            {
+                "include": [
+                    "glslang/MachineIndependent/glslang_tab.cpp",
+                    "glslang/MachineIndependent/glslang_tab.cpp.h"
+                ]
+            }
+        ]
+    }
+]