Browse Source

Updated glslang.

Бранимир Караџић 9 months ago
parent
commit
14d0bef1fe

+ 5 - 1
3rdparty/glslang/SPIRV/GlslangToSpv.cpp

@@ -1,7 +1,7 @@
 //
 //
 // Copyright (C) 2014-2016 LunarG, Inc.
 // Copyright (C) 2014-2016 LunarG, Inc.
 // Copyright (C) 2015-2020 Google, Inc.
 // Copyright (C) 2015-2020 Google, Inc.
-// Copyright (C) 2017, 2022-2024 Arm Limited.
+// Copyright (C) 2017, 2022-2025 Arm Limited.
 // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
 // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
 //
 //
 // All rights reserved.
 // All rights reserved.
@@ -1913,6 +1913,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
     case EShLangCallable:
     case EShLangCallable:
     {
     {
         auto& extensions = glslangIntermediate->getRequestedExtensions();
         auto& extensions = glslangIntermediate->getRequestedExtensions();
+        if (extensions.find("GL_EXT_opacity_micromap") != extensions.end()) {
+            builder.addCapability(spv::CapabilityRayTracingOpacityMicromapEXT);
+            builder.addExtension("SPV_EXT_opacity_micromap");
+        }
         if (extensions.find("GL_NV_ray_tracing") == extensions.end()) {
         if (extensions.find("GL_NV_ray_tracing") == extensions.end()) {
             builder.addCapability(spv::CapabilityRayTracingKHR);
             builder.addCapability(spv::CapabilityRayTracingKHR);
             builder.addExtension("SPV_KHR_ray_tracing");
             builder.addExtension("SPV_KHR_ray_tracing");

+ 2 - 1
3rdparty/glslang/SPIRV/doc.cpp

@@ -1,6 +1,6 @@
 //
 //
 // Copyright (C) 2014-2015 LunarG, Inc.
 // Copyright (C) 2014-2015 LunarG, Inc.
-// Copyright (C) 2022-2024 Arm Limited.
+// Copyright (C) 2022-2025 Arm Limited.
 // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
 // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
 //
 //
 // All rights reserved.
 // All rights reserved.
@@ -1009,6 +1009,7 @@ const char* CapabilityString(int info)
     case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
     case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
     case CapabilityRayTracingPositionFetchKHR:      return "RayTracingPositionFetchKHR";
     case CapabilityRayTracingPositionFetchKHR:      return "RayTracingPositionFetchKHR";
     case CapabilityDisplacementMicromapNV:           return "DisplacementMicromapNV";
     case CapabilityDisplacementMicromapNV:           return "DisplacementMicromapNV";
+    case CapabilityRayTracingOpacityMicromapEXT:    return "RayTracingOpacityMicromapEXT";
     case CapabilityRayTracingDisplacementMicromapNV: return "CapabilityRayTracingDisplacementMicromapNV";
     case CapabilityRayTracingDisplacementMicromapNV: return "CapabilityRayTracingDisplacementMicromapNV";
     case CapabilityRayQueryPositionFetchKHR:        return "RayQueryPositionFetchKHR";
     case CapabilityRayQueryPositionFetchKHR:        return "RayQueryPositionFetchKHR";
     case CapabilityComputeDerivativeGroupQuadsNV:   return "ComputeDerivativeGroupQuadsNV";
     case CapabilityComputeDerivativeGroupQuadsNV:   return "ComputeDerivativeGroupQuadsNV";

+ 1 - 0
3rdparty/glslang/StandAlone/StandAlone.cpp

@@ -56,6 +56,7 @@
 #include <cmath>
 #include <cmath>
 #include <cstdlib>
 #include <cstdlib>
 #include <cstring>
 #include <cstring>
+#include <iterator>
 #include <map>
 #include <map>
 #include <memory>
 #include <memory>
 #include <set>
 #include <set>

+ 1 - 1
3rdparty/glslang/StandAlone/spirv-remap.cpp

@@ -182,7 +182,7 @@ namespace {
         std::cout << "  " << basename(name) << " [--version | -V]" << std::endl;
         std::cout << "  " << basename(name) << " [--version | -V]" << std::endl;
         std::cout << "  " << basename(name) << " [--help | -?]" << std::endl;
         std::cout << "  " << basename(name) << " [--help | -?]" << std::endl;
 
 
-        exit(5);
+        exit(0);
     }
     }
 
 
     // grind through each SPIR in turn
     // grind through each SPIR in turn

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

@@ -35,7 +35,7 @@
 #define GLSLANG_BUILD_INFO
 #define GLSLANG_BUILD_INFO
 
 
 #define GLSLANG_VERSION_MAJOR 15
 #define GLSLANG_VERSION_MAJOR 15
-#define GLSLANG_VERSION_MINOR 1
+#define GLSLANG_VERSION_MINOR 2
 #define GLSLANG_VERSION_PATCH 0
 #define GLSLANG_VERSION_PATCH 0
 #define GLSLANG_VERSION_FLAVOR ""
 #define GLSLANG_VERSION_FLAVOR ""
 
 

+ 1 - 0
3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp

@@ -46,6 +46,7 @@
 #include "propagateNoContraction.h"
 #include "propagateNoContraction.h"
 
 
 #include <cfloat>
 #include <cfloat>
+#include <limits>
 #include <utility>
 #include <utility>
 #include <tuple>
 #include <tuple>
 
 

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

@@ -1517,7 +1517,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
                !result->getAsTyped()->getType().isParameterized()) {
                !result->getAsTyped()->getType().isParameterized()) {
                 if (auto unaryNode = result->getAsUnaryNode())
                 if (auto unaryNode = result->getAsUnaryNode())
                     result->setType(unaryNode->getOperand()->getAsTyped()->getType());
                     result->setType(unaryNode->getOperand()->getAsTyped()->getType());
-                else 
+                else
                     result->setType(result->getAsAggregate()->getSequence()[0]->getAsTyped()->getType());
                     result->setType(result->getAsAggregate()->getSequence()[0]->getAsTyped()->getType());
             }
             }
         }
         }
@@ -1573,7 +1573,7 @@ void TParseContext::handleCoopMat2FunctionCall(const TSourceLoc& loc, const TFun
                         error(loc, "coordinate parameters must be uint32_t", param->getAsSymbolNode()->getMangledName().c_str(), "");
                         error(loc, "coordinate parameters must be uint32_t", param->getAsSymbolNode()->getMangledName().c_str(), "");
                     }
                     }
                 }
                 }
-                
+
                 // error checking reduce function has matching parameters
                 // error checking reduce function has matching parameters
                 if (fnCandidate->getBuiltInOp() == EOpCooperativeMatrixReduceNV) {
                 if (fnCandidate->getBuiltInOp() == EOpCooperativeMatrixReduceNV) {
                     const TFunction* combineOp = symbolTable.find(param->getAsSymbolNode()->getMangledName())->getAsFunction();
                     const TFunction* combineOp = symbolTable.find(param->getAsSymbolNode()->getMangledName())->getAsFunction();
@@ -2103,7 +2103,8 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct
     // Will there be any output conversions?
     // Will there be any output conversions?
     bool outputConversions = false;
     bool outputConversions = false;
     for (int i = 0; i < function.getParamCount(); ++i) {
     for (int i = 0; i < function.getParamCount(); ++i) {
-        if (*function[i].type != arguments[i]->getAsTyped()->getType() && function[i].type->getQualifier().isParamOutput()) {
+        if (*function[i].type != arguments[i]->getAsTyped()->getType() && function[i].type->getQualifier().isParamOutput() &&
+            !function[i].type->isCoopMat()) {
             outputConversions = true;
             outputConversions = true;
             break;
             break;
         }
         }
@@ -2147,13 +2148,6 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct
                 }
                 }
                 TVariable* tempArg = makeInternalVariable("tempArg", paramType);
                 TVariable* tempArg = makeInternalVariable("tempArg", paramType);
                 tempArg->getWritableType().getQualifier().makeTemporary();
                 tempArg->getWritableType().getQualifier().makeTemporary();
-                if (function[i].type->getQualifier().isParamInput()) {
-                    // If the parameter is also an input, copy-in.
-                    TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, intermNode.getLoc());
-                    TIntermTyped* tempAssign = intermediate.addAssign(EOpAssign, tempArgNode, intermediate.addSymbol(*arguments[i]->getAsTyped()->getAsSymbolNode()), arguments[i]->getLoc());
-                    conversionTree = intermediate.mergeAggregate(tempAssign, conversionTree, intermNode.getLoc());
-                }
-
                 TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, intermNode.getLoc());
                 TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, intermNode.getLoc());
                 TIntermTyped* tempAssign = intermediate.addAssign(EOpAssign, arguments[i]->getAsTyped(), tempArgNode, arguments[i]->getLoc());
                 TIntermTyped* tempAssign = intermediate.addAssign(EOpAssign, arguments[i]->getAsTyped(), tempArgNode, arguments[i]->getLoc());
                 conversionTree = intermediate.growAggregate(conversionTree, tempAssign, arguments[i]->getLoc());
                 conversionTree = intermediate.growAggregate(conversionTree, tempAssign, arguments[i]->getLoc());
@@ -7061,6 +7055,15 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
             error(loc, "Push constants blocks can't be an array", "push_constant", "");
             error(loc, "Push constants blocks can't be an array", "push_constant", "");
     }
     }
 
 
+    if (type.getBasicType() == EbtReference) {
+        if (qualifier.isPipeInput())
+            error(loc, "cannot contain any structs with buffer_reference.", "in",
+                  "If you want to interface shader stages with a buffer_reference cast to a uint64 or uvec2 instead.");
+        if (qualifier.isPipeOutput())
+            error(loc, "cannot contain any structs with buffer_reference.", "out",
+                  "If you want to interface shader stages with a buffer_reference cast to a uint64 or uvec2 instead.");
+    }
+
     if (qualifier.hasBufferReference() && type.getBasicType() != EbtBlock)
     if (qualifier.hasBufferReference() && type.getBasicType() != EbtBlock)
         error(loc, "can only be used with a block", "buffer_reference", "");
         error(loc, "can only be used with a block", "buffer_reference", "");
 
 
@@ -7070,7 +7073,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
     // input attachment
     // input attachment
     if (type.isSubpass()) {
     if (type.isSubpass()) {
         if (extensionTurnedOn(E_GL_EXT_shader_tile_image))
         if (extensionTurnedOn(E_GL_EXT_shader_tile_image))
-	    error(loc, "can not be used with GL_EXT_shader_tile_image enabled", type.getSampler().getString().c_str(), "");
+            error(loc, "cannot be used with GL_EXT_shader_tile_image enabled", type.getSampler().getString().c_str(),
+                  "");
         if (! qualifier.hasAttachment())
         if (! qualifier.hasAttachment())
             error(loc, "requires an input_attachment_index layout qualifier", "subpass", "");
             error(loc, "requires an input_attachment_index layout qualifier", "subpass", "");
     } else {
     } else {
@@ -10311,7 +10315,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
 
 
     if (publicType.shaderQualifiers.layoutPrimitiveCulling) {
     if (publicType.shaderQualifiers.layoutPrimitiveCulling) {
         if (publicType.qualifier.storage != EvqTemporary)
         if (publicType.qualifier.storage != EvqTemporary)
-            error(loc, "layout qualifier can not have storage qualifiers", "primitive_culling","", "");
+            error(loc, "layout qualifier cannot have storage qualifiers", "primitive_culling", "", "");
         else {
         else {
             intermediate.setLayoutPrimitiveCulling();
             intermediate.setLayoutPrimitiveCulling();
         }
         }

+ 6 - 2
3rdparty/glslang/glslang/MachineIndependent/Scan.cpp

@@ -1108,9 +1108,13 @@ int TScanContext::tokenizeIdentifier()
             reservedWord();
             reservedWord();
         return keyword;
         return keyword;
     case NONTEMPORAL:
     case NONTEMPORAL:
-        if (parseContext.symbolTable.atBuiltInLevel() ||
-            (parseContext.extensionTurnedOn(E_GL_EXT_nontemporal_keyword)))
+        if (parseContext.symbolTable.atBuiltInLevel())
+            return keyword;
+        if (parseContext.extensionTurnedOn(E_GL_EXT_nontemporal_keyword)) {
+            if (!parseContext.intermediate.usingVulkanMemoryModel())
+                parseContext.warn(loc, "Nontemporal without the Vulkan Memory Model is ignored", tokenText, "");
             return keyword;
             return keyword;
+        }
         return identifierOrType();
         return identifierOrType();
     case PATCH:
     case PATCH:
         if (parseContext.symbolTable.atBuiltInLevel() ||
         if (parseContext.symbolTable.atBuiltInLevel() ||

+ 17 - 3
3rdparty/glslang/glslang/stub.cpp

@@ -32,6 +32,20 @@
 // POSSIBILITY OF SUCH DAMAGE.
 // POSSIBILITY OF SUCH DAMAGE.
 //
 //
 
 
-// This empty source file exists to support building stubbed versions of
-// deprecated libraries which have been integrated into the main glslang
-// library. It should be deleted once the stub libraries are fully removed.
+#ifdef GLSLANG_IS_SHARED_LIBRARY
+#ifdef _WIN32
+#ifdef GLSLANG_EXPORTING
+#define STUB_EXPORT __declspec(dllexport)
+#else
+#define STUB_EXPORT __declspec(dllimport)
+#endif
+#endif
+#endif // GLSLANG_IS_SHARED_LIBRARY
+
+#ifndef STUB_EXPORT
+#define STUB_EXPORT
+#endif
+
+// Force stub library to export function to preserve backcompat.
+// https://github.com/KhronosGroup/glslang/issues/3882
+STUB_EXPORT int stub_library_function() { return 0; }