Бранимир Караџић 6 лет назад
Родитель
Сommit
5202ed428e

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

@@ -42,5 +42,6 @@ static const char* const E_SPV_KHR_post_depth_coverage          = "SPV_KHR_post_
 static const char* const E_SPV_KHR_vulkan_memory_model          = "SPV_KHR_vulkan_memory_model";
 static const char* const E_SPV_EXT_physical_storage_buffer      = "SPV_EXT_physical_storage_buffer";
 static const char* const E_SPV_EXT_fragment_shader_interlock    = "SPV_EXT_fragment_shader_interlock";
+static const char* const E_SPV_KHR_shader_clock                 = "SPV_KHR_shader_clock";
 
 #endif  // #ifndef GLSLextKHR_H

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

@@ -7623,6 +7623,22 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
         return id;
     }
 
+    case glslang::EOpReadClockSubgroupKHR: {
+        std::vector<spv::Id> args;
+        args.push_back(builder.makeUintConstant(spv::ScopeSubgroup));
+        builder.addExtension(spv::E_SPV_KHR_shader_clock);
+        builder.addCapability(spv::CapabilityShaderClockKHR);
+        return builder.createOp(spv::OpReadClockKHR, typeId, args);
+    }
+
+    case glslang::EOpReadClockDeviceKHR: {
+        std::vector<spv::Id> args;
+        args.push_back(builder.makeUintConstant(spv::ScopeDevice));
+        builder.addExtension(spv::E_SPV_KHR_shader_clock);
+        builder.addCapability(spv::CapabilityShaderClockKHR);
+        return builder.createOp(spv::OpReadClockKHR, typeId, args);
+    }
+
     default:
         logger->missingFunctionality("unknown operation with no arguments");
         return 0;

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

@@ -959,6 +959,7 @@ const char* CapabilityString(int info)
     case CapabilityFragmentShaderShadingRateInterlockEXT:   return "CapabilityFragmentShaderShadingRateInterlockEXT";
 
     case CapabilityDemoteToHelperInvocationEXT:             return "DemoteToHelperInvocationEXT";
+    case CapabilityShaderClockKHR:                          return "ShaderClockKHR";
 
     default: return "Bad";
     }
@@ -1349,6 +1350,8 @@ const char* OpcodeString(int op)
     case 5012: return "OpFragmentFetchAMD";
 #endif
 
+    case OpReadClockKHR:               return "OpReadClockKHR";
+
     case OpDecorateStringGOOGLE:       return "OpDecorateStringGOOGLE";
     case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
 
@@ -2790,6 +2793,8 @@ void Parameterize()
     InstructionDesc[OpCooperativeMatrixLengthNV].operands.push(OperandId, "'Type'");
 
     InstructionDesc[OpDemoteToHelperInvocationEXT].setResultAndType(false, false);
+
+    InstructionDesc[OpReadClockKHR].operands.push(OperandScope, "'Scope'");
 }
 
 }; // end spv namespace

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

@@ -809,6 +809,7 @@ enum Capability {
     CapabilityFragmentMaskAMD = 5010,
     CapabilityStencilExportEXT = 5013,
     CapabilityImageReadWriteLodAMD = 5015,
+    CapabilityShaderClockKHR = 5055,
     CapabilitySampleMaskOverrideCoverageNV = 5249,
     CapabilityGeometryShaderPassthroughNV = 5251,
     CapabilityShaderViewportIndexLayerEXT = 5254,
@@ -1219,6 +1220,7 @@ enum Op {
     OpGroupSMaxNonUniformAMD = 5007,
     OpFragmentMaskFetchAMD = 5011,
     OpFragmentFetchAMD = 5012,
+    OpReadClockKHR = 5056,
     OpImageSampleFootprintNV = 5283,
     OpGroupNonUniformPartitionNV = 5296,
     OpWritePackedPrimitiveIndices4x8NV = 5299,

+ 8 - 9
3rdparty/glslang/Test/baseResults/spv.16bitstorage-int.frag.out

@@ -1,7 +1,7 @@
 spv.16bitstorage-int.frag
 // Module Version 10000
 // Generated by (magic number): 80007
-// Id's are bound by 172
+// Id's are bound by 171
 
                               Capability Shader
                               Capability StorageUniformBufferBlock16
@@ -209,10 +209,7 @@ spv.16bitstorage-int.frag
              114:     20(int) Constant 7
              115:     20(int) Constant 6
              116:             TypePointer Uniform 20(int)
-             166:  6(int16_t) Constant 1
-             167:  6(int16_t) Constant 2
-             168:  7(i16vec2) ConstantComposite 166 167
-             170:  6(int16_t) Constant 3
+             166:   39(ivec2) ConstantComposite 32 33
          4(main):           2 Function None 3
                5:             Label
           69(x0):     68(ptr) Variable Function
@@ -332,9 +329,11 @@ spv.16bitstorage-int.frag
              164:  6(int16_t) Load 163
              165:     28(ptr) AccessChain 19(b2) 21
                               Store 165 164
-             169:     42(ptr) AccessChain 19(b2) 32
-                              Store 169 168
-             171:     28(ptr) AccessChain 19(b2) 21
-                              Store 171 170
+             167:  7(i16vec2) SConvert 166
+             168:     42(ptr) AccessChain 19(b2) 32
+                              Store 168 167
+             169:  6(int16_t) SConvert 58
+             170:     28(ptr) AccessChain 19(b2) 21
+                              Store 170 169
                               Return
                               FunctionEnd

+ 6 - 6
3rdparty/glslang/Test/baseResults/spv.16bitstorage-uint.frag.out

@@ -210,10 +210,8 @@ spv.16bitstorage-uint.frag
              115:     20(int) Constant 7
              116:     20(int) Constant 6
              117:             TypePointer Uniform 9(int)
-             167:  6(int16_t) Constant 1
-             168:  6(int16_t) Constant 2
-             169:  7(i16vec2) ConstantComposite 167 168
-             171:  6(int16_t) Constant 3
+             167:   39(ivec2) ConstantComposite 82 10
+             170:      9(int) Constant 3
          4(main):           2 Function None 3
                5:             Label
           69(x0):     68(ptr) Variable Function
@@ -333,8 +331,10 @@ spv.16bitstorage-uint.frag
              165:  6(int16_t) Load 164
              166:     28(ptr) AccessChain 19(b2) 21
                               Store 166 165
-             170:     42(ptr) AccessChain 19(b2) 32
-                              Store 170 169
+             168:  7(i16vec2) UConvert 167
+             169:     42(ptr) AccessChain 19(b2) 32
+                              Store 169 168
+             171:  6(int16_t) UConvert 170
              172:     28(ptr) AccessChain 19(b2) 21
                               Store 172 171
                               Return

+ 8 - 7
3rdparty/glslang/Test/baseResults/spv.16bitstorage.frag.out

@@ -1,7 +1,7 @@
 spv.16bitstorage.frag
 // Module Version 10000
 // Generated by (magic number): 80007
-// Id's are bound by 172
+// Id's are bound by 173
 
                               Capability Shader
                               Capability StorageUniformBufferBlock16
@@ -209,10 +209,9 @@ spv.16bitstorage.frag
              114:     20(int) Constant 7
              115:     20(int) Constant 6
              116:             TypePointer Uniform 20(int)
-             166:6(float16_t) Constant 15360
-             167:6(float16_t) Constant 16384
-             168:  7(f16vec2) ConstantComposite 166 167
-             170:6(float16_t) Constant 16896
+             166:   37(float) Constant 1073741824
+             167:   40(fvec2) ConstantComposite 83 166
+             170:   37(float) Constant 1077936128
          4(main):           2 Function None 3
                5:             Label
           70(x0):     69(ptr) Variable Function
@@ -332,9 +331,11 @@ spv.16bitstorage.frag
              164:6(float16_t) Load 163
              165:     28(ptr) AccessChain 19(b2) 21
                               Store 165 164
+             168:  7(f16vec2) FConvert 167
              169:     43(ptr) AccessChain 19(b2) 32
                               Store 169 168
-             171:     28(ptr) AccessChain 19(b2) 21
-                              Store 171 170
+             171:6(float16_t) FConvert 170
+             172:     28(ptr) AccessChain 19(b2) 21
+                              Store 172 171
                               Return
                               FunctionEnd

+ 8 - 9
3rdparty/glslang/Test/baseResults/spv.8bitstorage-int.frag.out

@@ -1,7 +1,7 @@
 spv.8bitstorage-int.frag
 // Module Version 10000
 // Generated by (magic number): 80007
-// Id's are bound by 172
+// Id's are bound by 171
 
                               Capability Shader
                               Capability UniformAndStorageBuffer8BitAccess
@@ -208,10 +208,7 @@ spv.8bitstorage-int.frag
              114:     20(int) Constant 7
              115:     20(int) Constant 6
              116:             TypePointer Uniform 20(int)
-             166:   6(int8_t) Constant 1
-             167:   6(int8_t) Constant 2
-             168:   7(i8vec2) ConstantComposite 166 167
-             170:   6(int8_t) Constant 3
+             166:   39(ivec2) ConstantComposite 32 33
          4(main):           2 Function None 3
                5:             Label
           69(x0):     68(ptr) Variable Function
@@ -331,9 +328,11 @@ spv.8bitstorage-int.frag
              164:   6(int8_t) Load 163
              165:     28(ptr) AccessChain 19(b2) 21
                               Store 165 164
-             169:     42(ptr) AccessChain 19(b2) 32
-                              Store 169 168
-             171:     28(ptr) AccessChain 19(b2) 21
-                              Store 171 170
+             167:   7(i8vec2) SConvert 166
+             168:     42(ptr) AccessChain 19(b2) 32
+                              Store 168 167
+             169:   6(int8_t) SConvert 58
+             170:     28(ptr) AccessChain 19(b2) 21
+                              Store 170 169
                               Return
                               FunctionEnd

+ 6 - 6
3rdparty/glslang/Test/baseResults/spv.8bitstorage-uint.frag.out

@@ -209,10 +209,8 @@ spv.8bitstorage-uint.frag
              115:     20(int) Constant 7
              116:     20(int) Constant 6
              117:             TypePointer Uniform 9(int)
-             167:   6(int8_t) Constant 1
-             168:   6(int8_t) Constant 2
-             169:   7(i8vec2) ConstantComposite 167 168
-             171:   6(int8_t) Constant 3
+             167:   39(ivec2) ConstantComposite 82 10
+             170:      9(int) Constant 3
          4(main):           2 Function None 3
                5:             Label
           69(x0):     68(ptr) Variable Function
@@ -332,8 +330,10 @@ spv.8bitstorage-uint.frag
              165:   6(int8_t) Load 164
              166:     28(ptr) AccessChain 19(b2) 21
                               Store 166 165
-             170:     42(ptr) AccessChain 19(b2) 32
-                              Store 170 169
+             168:   7(i8vec2) UConvert 167
+             169:     42(ptr) AccessChain 19(b2) 32
+                              Store 169 168
+             171:   6(int8_t) UConvert 170
              172:     28(ptr) AccessChain 19(b2) 21
                               Store 172 171
                               Return

+ 5 - 4
3rdparty/glslang/Test/baseResults/spv.bufferhandle11.frag.out

@@ -4,7 +4,7 @@ WARNING: 0:6: '' : all default precisions are highp; use precision statements to
 
 // Module Version 10000
 // Generated by (magic number): 80007
-// Id's are bound by 60
+// Id's are bound by 61
 
                               Capability Shader
                               Capability StorageBuffer8BitAccess
@@ -68,7 +68,7 @@ WARNING: 0:6: '' : all default precisions are highp; use precision statements to
               50:     49(ptr) Variable StorageBuffer
               51:             TypePointer StorageBuffer 6(int)
               54:     31(int) Constant 1
-              58:  27(int8_t) Constant 9
+              58:      6(int) Constant 9
          4(main):           2 Function None 3
                5:             Label
        20(allOk):     19(ptr) Variable Function
@@ -103,8 +103,9 @@ WARNING: 0:6: '' : all default precisions are highp; use precision statements to
               47:             Label
               56:     33(ptr) AccessChain 30 32
               57:     25(ptr) Load 56
-              59:     36(ptr) AccessChain 57 32
-                              Store 59 58 Aligned 16
+              59:  27(int8_t) UConvert 58
+              60:     36(ptr) AccessChain 57 32
+                              Store 60 59 Aligned 16
                               Return
                               FunctionEnd
 12(compare_uint8_t(u1;u1;):     8(bool) Function None 9

+ 16 - 9
3rdparty/glslang/glslang/Include/intermediate.h

@@ -654,9 +654,21 @@ enum TOperator {
     EOpConstructBool,
     EOpConstructFloat,
     EOpConstructDouble,
+    // Keep vector and matrix constructors in a consistent relative order for
+    // TParseContext::constructBuiltIn, which converts between 8/16/32 bit
+    // vector constructors
     EOpConstructVec2,
     EOpConstructVec3,
     EOpConstructVec4,
+    EOpConstructMat2x2,
+    EOpConstructMat2x3,
+    EOpConstructMat2x4,
+    EOpConstructMat3x2,
+    EOpConstructMat3x3,
+    EOpConstructMat3x4,
+    EOpConstructMat4x2,
+    EOpConstructMat4x3,
+    EOpConstructMat4x4,
     EOpConstructDVec2,
     EOpConstructDVec3,
     EOpConstructDVec4,
@@ -687,15 +699,6 @@ enum TOperator {
     EOpConstructU64Vec2,
     EOpConstructU64Vec3,
     EOpConstructU64Vec4,
-    EOpConstructMat2x2,
-    EOpConstructMat2x3,
-    EOpConstructMat2x4,
-    EOpConstructMat3x2,
-    EOpConstructMat3x3,
-    EOpConstructMat3x4,
-    EOpConstructMat4x2,
-    EOpConstructMat4x3,
-    EOpConstructMat4x4,
     EOpConstructDMat2x2,
     EOpConstructDMat2x3,
     EOpConstructDMat2x4,
@@ -1002,6 +1005,10 @@ enum TOperator {
     EOpWaveGetLaneIndex,                 // Will decompose to gl_SubgroupInvocationID.
     EOpWaveActiveCountBits,              // Will decompose to subgroupBallotBitCount(subgroupBallot()).
     EOpWavePrefixCountBits,              // Will decompose to subgroupBallotInclusiveBitCount(subgroupBallot()).
+
+    // Shader Clock Ops
+    EOpReadClockSubgroupKHR,
+    EOpReadClockDeviceKHR,
 };
 
 class TIntermTraverser;

+ 28 - 9
3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp

@@ -3838,12 +3838,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
     }
 
     // GL_AMD_gcn_shader
-    if (profile != EEsProfile && version >= 450) {
+    if (profile != EEsProfile && version >= 440) {
         commonBuiltins.append(
             "float cubeFaceIndexAMD(vec3);"
             "vec2  cubeFaceCoordAMD(vec3);"
             "uint64_t timeAMD();"
 
+            "in int gl_SIMDGroupSizeAMD;"
             "\n");
     }
 
@@ -5089,6 +5090,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
             "\n");
     }
 
+    // GL_ARB_shader_clock & GL_EXT_shader_realtime_clock
+    if (profile != EEsProfile && version >= 450) {
+        commonBuiltins.append(
+            "uvec2 clock2x32ARB();"
+            "uint64_t clockARB();"
+            "uvec2 clockRealtime2x32EXT();"
+            "uint64_t clockRealtimeEXT();"
+            "\n");
+    }
+
     // GL_AMD_shader_fragment_mask
     if (profile != EEsProfile && version >= 450 && spvVersion.vulkan > 0) {
         stageBuiltins[EShLangFragment].append(
@@ -7752,14 +7763,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
         s.append(builtInConstant);
     }
 
-#ifdef AMD_EXTENSIONS
-    // GL_AMD_gcn_shader
-    if (profile != EEsProfile && version >= 450) {
-        snprintf(builtInConstant, maxSize, "const int gl_SIMDGroupSizeAMD = 64;");
-        s.append(builtInConstant);
-    }
-#endif
-
 #ifdef NV_EXTENSIONS
     // SPV_NV_mesh_shader
     if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
@@ -7911,6 +7914,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
             }
         }
 
+
 #ifdef AMD_EXTENSIONS
         if (profile != EEsProfile) {
             symbolTable.setFunctionExtensions("minInvocationsAMD",                1, &E_GL_AMD_shader_ballot);
@@ -7945,6 +7949,9 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
         }
 
         if (profile != EEsProfile) {
+            symbolTable.setVariableExtensions("gl_SIMDGroupSizeAMD", 1, &E_GL_AMD_gcn_shader);
+            SpecialQualifier("gl_SIMDGroupSizeAMD", EvqVaryingIn, EbvSubGroupSize, symbolTable);
+
             symbolTable.setFunctionExtensions("cubeFaceIndexAMD", 1, &E_GL_AMD_gcn_shader);
             symbolTable.setFunctionExtensions("cubeFaceCoordAMD", 1, &E_GL_AMD_gcn_shader);
             symbolTable.setFunctionExtensions("timeAMD",          1, &E_GL_AMD_gcn_shader);
@@ -8461,6 +8468,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
 
         symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);
 
+        symbolTable.setFunctionExtensions("clockARB",     1, &E_GL_ARB_shader_clock);
+        symbolTable.setFunctionExtensions("clock2x32ARB", 1, &E_GL_ARB_shader_clock);
+
+        symbolTable.setFunctionExtensions("clockRealtimeEXT",     1, &E_GL_EXT_shader_realtime_clock);
+        symbolTable.setFunctionExtensions("clockRealtime2x32EXT", 1, &E_GL_EXT_shader_realtime_clock);
+
         if (profile == EEsProfile && version < 320) {
             symbolTable.setVariableExtensions("gl_PrimitiveID",  Num_AEP_geometry_shader, AEP_geometry_shader);
             symbolTable.setVariableExtensions("gl_Layer",        Num_AEP_geometry_shader, AEP_geometry_shader);
@@ -9275,6 +9288,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
     symbolTable.relateToOperator("atomicCounterDecrement", EOpAtomicCounterDecrement);
     symbolTable.relateToOperator("atomicCounter",          EOpAtomicCounter);
 
+    symbolTable.relateToOperator("clockARB",     EOpReadClockSubgroupKHR);
+    symbolTable.relateToOperator("clock2x32ARB", EOpReadClockSubgroupKHR);
+
+    symbolTable.relateToOperator("clockRealtimeEXT",     EOpReadClockDeviceKHR);
+    symbolTable.relateToOperator("clockRealtime2x32EXT", EOpReadClockDeviceKHR);
+
     if (profile != EEsProfile && version >= 460) {
         symbolTable.relateToOperator("atomicCounterAdd",      EOpAtomicCounterAdd);
         symbolTable.relateToOperator("atomicCounterSubtract", EOpAtomicCounterSubtract);

+ 12 - 24
3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp

@@ -574,24 +574,6 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
 
     TOperator newOp = EOpNull;
 
-    // Certain explicit conversions are allowed conditionally
-    bool arithemeticInt8Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
-                                  extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
-#ifdef AMD_EXTENSIONS
-    bool arithemeticInt16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
-                                   extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16) ||
-                                   extensionRequested(E_GL_AMD_gpu_shader_int16);
-
-    bool arithemeticFloat16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
-                                     extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16) ||
-                                     extensionRequested(E_GL_AMD_gpu_shader_half_float);
-#else
-    bool arithemeticInt16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
-                                   extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
-
-    bool arithemeticFloat16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
-                                     extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
-#endif
     bool convertToIntTypes = (convertTo == EbtInt8  || convertTo == EbtUint8  ||
                               convertTo == EbtInt16 || convertTo == EbtUint16 ||
                               convertTo == EbtInt   || convertTo == EbtUint   ||
@@ -608,19 +590,19 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
                                   node->getBasicType() == EbtFloat ||
                                   node->getBasicType() == EbtDouble);
 
-    if (! arithemeticInt8Enabled) {
+    if (! getArithemeticInt8Enabled()) {
         if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) ||
             ((node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8) && ! convertToIntTypes))
             return nullptr;
     }
 
-    if (! arithemeticInt16Enabled) {
+    if (! getArithemeticInt16Enabled()) {
         if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) ||
             ((node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16) && ! convertToIntTypes))
             return nullptr;
     }
 
-    if (! arithemeticFloat16Enabled) {
+    if (! getArithemeticFloat16Enabled()) {
         if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) ||
             (node->getBasicType() == EbtFloat16 && ! convertToFloatTypes))
             return nullptr;
@@ -841,9 +823,15 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
     newNode = addUnaryNode(newOp, node, node->getLoc(), newType);
 
     if (node->getAsConstantUnion()) {
-        TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType);
-        if (folded)
-            return folded;
+        // 8/16-bit storage extensions don't support 8/16-bit constants, so don't fold conversions
+        // to those types
+        if ((getArithemeticInt8Enabled() || !(convertTo == EbtInt8 || convertTo == EbtUint8)) &&
+            (getArithemeticInt16Enabled() || !(convertTo == EbtInt16 || convertTo == EbtUint16)) &&
+            (getArithemeticFloat16Enabled() || !(convertTo == EbtFloat16))) {
+            TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType);
+            if (folded)
+                return folded;
+        }
     }
 
     // Propagate specialization-constant-ness, if allowed

+ 50 - 0
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp

@@ -6948,6 +6948,16 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
     case EOpConstructF16Mat4x4:
     case EOpConstructFloat16:
         basicOp = EOpConstructFloat16;
+        // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
+        // so construct a 32-bit type and convert
+        if (!intermediate.getArithemeticFloat16Enabled()) {
+            TType tempType(EbtFloat, EvqTemporary, type.getVectorSize());
+            newNode = node;
+            if (tempType != newNode->getType())
+                newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructVec2 + op - EOpConstructF16Vec2), tempType, node->getLoc());
+            newNode = intermediate.addConversion(EbtFloat16, newNode);
+            return newNode;
+        }
         break;
 
     case EOpConstructI8Vec2:
@@ -6955,6 +6965,16 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
     case EOpConstructI8Vec4:
     case EOpConstructInt8:
         basicOp = EOpConstructInt8;
+        // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
+        // so construct a 32-bit type and convert
+        if (!intermediate.getArithemeticInt8Enabled()) {
+            TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
+            newNode = node;
+            if (tempType != newNode->getType())
+                newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructIVec2 + op - EOpConstructI8Vec2), tempType, node->getLoc());
+            newNode = intermediate.addConversion(EbtInt8, newNode);
+            return newNode;
+        }
         break;
 
     case EOpConstructU8Vec2:
@@ -6962,6 +6982,16 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
     case EOpConstructU8Vec4:
     case EOpConstructUint8:
         basicOp = EOpConstructUint8;
+        // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
+        // so construct a 32-bit type and convert
+        if (!intermediate.getArithemeticInt8Enabled()) {
+            TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
+            newNode = node;
+            if (tempType != newNode->getType())
+                newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructUVec2 + op - EOpConstructU8Vec2), tempType, node->getLoc());
+            newNode = intermediate.addConversion(EbtUint8, newNode);
+            return newNode;
+        }
         break;
 
     case EOpConstructI16Vec2:
@@ -6969,6 +6999,16 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
     case EOpConstructI16Vec4:
     case EOpConstructInt16:
         basicOp = EOpConstructInt16;
+        // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
+        // so construct a 32-bit type and convert
+        if (!intermediate.getArithemeticInt16Enabled()) {
+            TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
+            newNode = node;
+            if (tempType != newNode->getType())
+                newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructIVec2 + op - EOpConstructI16Vec2), tempType, node->getLoc());
+            newNode = intermediate.addConversion(EbtInt16, newNode);
+            return newNode;
+        }
         break;
 
     case EOpConstructU16Vec2:
@@ -6976,6 +7016,16 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
     case EOpConstructU16Vec4:
     case EOpConstructUint16:
         basicOp = EOpConstructUint16;
+        // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types,
+        // so construct a 32-bit type and convert
+        if (!intermediate.getArithemeticInt16Enabled()) {
+            TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
+            newNode = node;
+            if (tempType != newNode->getType())
+                newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructUVec2 + op - EOpConstructU16Vec2), tempType, node->getLoc());
+            newNode = intermediate.addConversion(EbtUint16, newNode);
+            return newNode;
+        }
         break;
 
     case EOpConstructIVec2:

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

@@ -188,6 +188,7 @@ void TParseVersions::initializeExtensionBehavior()
     extensionBehavior[E_GL_ARB_post_depth_coverage]          = EBhDisable;
     extensionBehavior[E_GL_ARB_shader_viewport_layer_array]  = EBhDisable;
     extensionBehavior[E_GL_ARB_fragment_shader_interlock]    = EBhDisable;
+    extensionBehavior[E_GL_ARB_shader_clock]                 = EBhDisable;
 
     extensionBehavior[E_GL_KHR_shader_subgroup_basic]            = EBhDisable;
     extensionBehavior[E_GL_KHR_shader_subgroup_vote]             = EBhDisable;
@@ -285,6 +286,7 @@ void TParseVersions::initializeExtensionBehavior()
     // EXT extensions
     extensionBehavior[E_GL_EXT_device_group]             = EBhDisable;
     extensionBehavior[E_GL_EXT_multiview]                = EBhDisable;
+    extensionBehavior[E_GL_EXT_shader_realtime_clock]    = EBhDisable;
 
     // OVR extensions
     extensionBehavior[E_GL_OVR_multiview]                = EBhDisable;
@@ -408,6 +410,7 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define GL_KHR_shader_subgroup_quad 1\n"
 
             "#define E_GL_EXT_shader_atomic_int64 1\n"
+            "#define E_GL_EXT_shader_realtime_clock 1\n"
 
 #ifdef AMD_EXTENSIONS
             "#define GL_AMD_shader_ballot 1\n"

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

@@ -142,6 +142,7 @@ const char* const E_GL_ARB_shader_stencil_export        = "GL_ARB_shader_stencil
 const char* const E_GL_ARB_post_depth_coverage          = "GL_ARB_post_depth_coverage";
 const char* const E_GL_ARB_shader_viewport_layer_array  = "GL_ARB_shader_viewport_layer_array";
 const char* const E_GL_ARB_fragment_shader_interlock    = "GL_ARB_fragment_shader_interlock";
+const char* const E_GL_ARB_shader_clock                 = "GL_ARB_shader_clock";
 
 const char* const E_GL_KHR_shader_subgroup_basic            = "GL_KHR_shader_subgroup_basic";
 const char* const E_GL_KHR_shader_subgroup_vote             = "GL_KHR_shader_subgroup_vote";
@@ -174,6 +175,7 @@ const char* const E_GL_EXT_fragment_invocation_density      = "GL_EXT_fragment_i
 const char* const E_GL_EXT_buffer_reference                 = "GL_EXT_buffer_reference";
 const char* const E_GL_EXT_buffer_reference2                = "GL_EXT_buffer_reference2";
 const char* const E_GL_EXT_demote_to_helper_invocation      = "GL_EXT_demote_to_helper_invocation";
+const char* const E_GL_EXT_shader_realtime_clock            = "GL_EXT_shader_realtime_clock";
 
 // Arrays of extensions for the above viewportEXTs duplications
 

+ 21 - 0
3rdparty/glslang/glslang/MachineIndependent/localintermediate.h

@@ -780,6 +780,27 @@ public:
     const char* const implicitThisName;
     const char* const implicitCounterName;
 
+    // Certain explicit conversions are allowed conditionally
+    bool getArithemeticInt8Enabled() const {
+        return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
+               extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
+    }
+    bool getArithemeticInt16Enabled() const {
+        return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
+#ifdef AMD_EXTENSIONS
+               extensionRequested(E_GL_AMD_gpu_shader_int16) ||
+#endif
+               extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
+    }
+
+    bool getArithemeticFloat16Enabled() const {
+        return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
+#ifdef AMD_EXTENSIONS
+               extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
+#endif
+               extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
+    }
+
 protected:
     TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
     void error(TInfoSink& infoSink, const char*);

+ 1 - 1
3rdparty/glslang/known_good.json

@@ -5,7 +5,7 @@
       "site" : "github",
       "subrepo" : "KhronosGroup/SPIRV-Tools",
       "subdir" : "External/spirv-tools",
-      "commit" : "b4bf7bcf0ad3a7eb6857e8d6d594e23f1be6f27a"
+      "commit" : "456cc598afb6d7c264f20cd3a183d85e369bed9a"
     },
     {
       "name" : "spirv-tools/external/spirv-headers",