From 14d0bef1fe855a5aa321e2282f76a31a05de962d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 14 Mar 2025 22:03:33 -0700 Subject: [PATCH] Updated glslang. --- 3rdparty/glslang/SPIRV/GlslangToSpv.cpp | 6 +++- 3rdparty/glslang/SPIRV/doc.cpp | 3 +- 3rdparty/glslang/StandAlone/StandAlone.cpp | 1 + 3rdparty/glslang/StandAlone/spirv-remap.cpp | 2 +- 3rdparty/glslang/build_info.h | 2 +- .../MachineIndependent/Intermediate.cpp | 1 + .../MachineIndependent/ParseHelper.cpp | 28 +++++++++++-------- .../glslang/MachineIndependent/Scan.cpp | 8 ++++-- 3rdparty/glslang/glslang/stub.cpp | 20 +++++++++++-- 9 files changed, 50 insertions(+), 21 deletions(-) diff --git a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp index ee736042e..1e0ff3305 100644 --- a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -1,7 +1,7 @@ // // Copyright (C) 2014-2016 LunarG, 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. // // All rights reserved. @@ -1913,6 +1913,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, case EShLangCallable: { 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()) { builder.addCapability(spv::CapabilityRayTracingKHR); builder.addExtension("SPV_KHR_ray_tracing"); diff --git a/3rdparty/glslang/SPIRV/doc.cpp b/3rdparty/glslang/SPIRV/doc.cpp index 1868f0e96..09f2d76fc 100644 --- a/3rdparty/glslang/SPIRV/doc.cpp +++ b/3rdparty/glslang/SPIRV/doc.cpp @@ -1,6 +1,6 @@ // // 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. // // All rights reserved. @@ -1009,6 +1009,7 @@ const char* CapabilityString(int info) case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR"; case CapabilityRayTracingPositionFetchKHR: return "RayTracingPositionFetchKHR"; case CapabilityDisplacementMicromapNV: return "DisplacementMicromapNV"; + case CapabilityRayTracingOpacityMicromapEXT: return "RayTracingOpacityMicromapEXT"; case CapabilityRayTracingDisplacementMicromapNV: return "CapabilityRayTracingDisplacementMicromapNV"; case CapabilityRayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR"; case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV"; diff --git a/3rdparty/glslang/StandAlone/StandAlone.cpp b/3rdparty/glslang/StandAlone/StandAlone.cpp index 15181ee06..d2d9dce66 100644 --- a/3rdparty/glslang/StandAlone/StandAlone.cpp +++ b/3rdparty/glslang/StandAlone/StandAlone.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include diff --git a/3rdparty/glslang/StandAlone/spirv-remap.cpp b/3rdparty/glslang/StandAlone/spirv-remap.cpp index 1bd4a2d6a..b1f032664 100644 --- a/3rdparty/glslang/StandAlone/spirv-remap.cpp +++ b/3rdparty/glslang/StandAlone/spirv-remap.cpp @@ -182,7 +182,7 @@ namespace { std::cout << " " << basename(name) << " [--version | -V]" << std::endl; std::cout << " " << basename(name) << " [--help | -?]" << std::endl; - exit(5); + exit(0); } // grind through each SPIR in turn diff --git a/3rdparty/glslang/build_info.h b/3rdparty/glslang/build_info.h index 05e3e3093..6f73ec077 100644 --- a/3rdparty/glslang/build_info.h +++ b/3rdparty/glslang/build_info.h @@ -35,7 +35,7 @@ #define GLSLANG_BUILD_INFO #define GLSLANG_VERSION_MAJOR 15 -#define GLSLANG_VERSION_MINOR 1 +#define GLSLANG_VERSION_MINOR 2 #define GLSLANG_VERSION_PATCH 0 #define GLSLANG_VERSION_FLAVOR "" diff --git a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp index a174855ac..58120d7e3 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -46,6 +46,7 @@ #include "propagateNoContraction.h" #include +#include #include #include diff --git a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index 099236647..d19478042 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -1517,7 +1517,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction !result->getAsTyped()->getType().isParameterized()) { if (auto unaryNode = result->getAsUnaryNode()) result->setType(unaryNode->getOperand()->getAsTyped()->getType()); - else + else 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 checking reduce function has matching parameters if (fnCandidate->getBuiltInOp() == EOpCooperativeMatrixReduceNV) { 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? bool outputConversions = false; 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; break; } @@ -2147,13 +2148,6 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct } TVariable* tempArg = makeInternalVariable("tempArg", paramType); 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()); TIntermTyped* tempAssign = intermediate.addAssign(EOpAssign, arguments[i]->getAsTyped(), tempArgNode, 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", ""); } + 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) 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 if (type.isSubpass()) { 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()) error(loc, "requires an input_attachment_index layout qualifier", "subpass", ""); } else { @@ -10311,7 +10315,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con if (publicType.shaderQualifiers.layoutPrimitiveCulling) { 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 { intermediate.setLayoutPrimitiveCulling(); } diff --git a/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp b/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp index 3f47ebf0c..d2375a0e2 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp @@ -1108,9 +1108,13 @@ int TScanContext::tokenizeIdentifier() reservedWord(); return keyword; 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 identifierOrType(); case PATCH: if (parseContext.symbolTable.atBuiltInLevel() || diff --git a/3rdparty/glslang/glslang/stub.cpp b/3rdparty/glslang/glslang/stub.cpp index b9aec6d15..9c286fb90 100644 --- a/3rdparty/glslang/glslang/stub.cpp +++ b/3rdparty/glslang/glslang/stub.cpp @@ -32,6 +32,20 @@ // 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; }