Browse Source

Updated glslang.

Бранимир Караџић 6 years ago
parent
commit
aa4020988c
24 changed files with 1619 additions and 764 deletions
  1. 23 3
      3rdparty/glslang/BUILD.gn
  2. 12 2
      3rdparty/glslang/README.md
  3. 4 0
      3rdparty/glslang/SPIRV/GlslangToSpv.cpp
  4. 2 10
      3rdparty/glslang/Test/baseResults/310.inheritMemory.frag.out
  5. 23 4
      3rdparty/glslang/Test/baseResults/glspv.esversion.vert.out
  6. 5 0
      3rdparty/glslang/Test/baseResults/reflection.options.vert.out
  7. 418 0
      3rdparty/glslang/Test/baseResults/spv.intcoopmat.comp.out
  8. 6 0
      3rdparty/glslang/Test/reflection.options.vert
  9. 117 0
      3rdparty/glslang/Test/spv.intcoopmat.comp
  10. 27 6
      3rdparty/glslang/glslang/Include/Types.h
  11. 60 3
      3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp
  12. 80 11
      3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
  13. 10 0
      3rdparty/glslang/glslang/MachineIndependent/Scan.cpp
  14. 2 7
      3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp
  15. 12 1
      3rdparty/glslang/glslang/MachineIndependent/Versions.cpp
  16. 1 0
      3rdparty/glslang/glslang/MachineIndependent/Versions.h
  17. 13 1
      3rdparty/glslang/glslang/MachineIndependent/glslang.m4
  18. 13 1
      3rdparty/glslang/glslang/MachineIndependent/glslang.y
  19. 484 440
      3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp
  20. 260 258
      3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h
  21. 1 0
      3rdparty/glslang/glslang/MachineIndependent/parseVersions.h
  22. 7 4
      3rdparty/glslang/glslang/MachineIndependent/reflection.cpp
  23. 38 13
      3rdparty/glslang/glslang/Public/ShaderLang.h
  24. 1 0
      3rdparty/glslang/gtests/Spv.FromFile.cpp

+ 23 - 3
3rdparty/glslang/BUILD.gn

@@ -37,6 +37,8 @@ spirv_tools_dir = glslang_spirv_tools_dir
 
 config("glslang_public") {
   include_dirs = [ "." ]
+
+  defines = [ "ENABLE_HLSL=1" ]
 }
 
 source_set("glslang_sources") {
@@ -129,9 +131,25 @@ source_set("glslang_sources") {
     "glslang/MachineIndependent/reflection.h",
     "glslang/OSDependent/osinclude.h",
     "glslang/Public/ShaderLang.h",
+    "hlsl/hlslAttributes.cpp",
+    "hlsl/hlslAttributes.h",
+    "hlsl/hlslGrammar.cpp",
+    "hlsl/hlslGrammar.h",
+    "hlsl/hlslOpMap.cpp",
+    "hlsl/hlslOpMap.h",
+    "hlsl/hlslParseHelper.cpp",
+    "hlsl/hlslParseHelper.h",
+    "hlsl/hlslParseables.cpp",
+    "hlsl/hlslParseables.h",
+    "hlsl/hlslScanContext.cpp",
+    "hlsl/hlslScanContext.h",
+    "hlsl/hlslTokenStream.cpp",
+    "hlsl/hlslTokenStream.h",
+    "hlsl/hlslTokens.h",
   ]
 
   defines = [ "ENABLE_OPT=1" ]
+
   if (is_win) {
     sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
     defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
@@ -153,8 +171,8 @@ source_set("glslang_sources") {
   }
   if (is_win && !is_clang) {
     cflags = [
-      "/wd4018", # signed/unsigned mismatch
-      "/wd4189", # local variable is initialized but not referenced
+      "/wd4018",  # signed/unsigned mismatch
+      "/wd4189",  # local variable is initialized but not referenced
     ]
   }
 
@@ -169,7 +187,9 @@ source_set("glslang_default_resource_limits_sources") {
     "StandAlone/ResourceLimits.cpp",
     "StandAlone/ResourceLimits.h",
   ]
-  deps = [ ":glslang_sources" ]
+  deps = [
+    ":glslang_sources",
+  ]
   public_configs = [ ":glslang_public" ]
 }
 

+ 12 - 2
3rdparty/glslang/README.md

@@ -267,7 +267,8 @@ The `main()` in `StandAlone/StandAlone.cpp` shows examples using both styles.
 ### C++ Class Interface (new, preferred)
 
 This interface is in roughly the last 1/3 of `ShaderLang.h`.  It is in the
-glslang namespace and contains the following.
+glslang namespace and contains the following, here with suggested calls
+for generating SPIR-V:
 
 ```cxx
 const char* GetEsslVersionString();
@@ -290,8 +291,17 @@ class TProgram
     Reflection queries
 ```
 
+For just validating (not generating code), subsitute these calls:
+
+```cxx
+    setEnvInput(EShSourceHlsl or EShSourceGlsl, stage,  EShClientNone, 0);
+    setEnvClient(EShClientNone, 0);
+    setEnvTarget(EShTargetNone, 0);
+```
+
 See `ShaderLang.h` and the usage of it in `StandAlone/StandAlone.cpp` for more
-details.
+details. There is a block comment giving more detail above the calls for
+`setEnvInput, setEnvClient, and setEnvTarget`.
 
 ### C Functional Interface (orignal)
 

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

@@ -3485,6 +3485,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
         builder.addExtension(spv::E_SPV_NV_cooperative_matrix);
         if (type.getBasicType() == glslang::EbtFloat16)
             builder.addCapability(spv::CapabilityFloat16);
+        if (type.getBasicType() == glslang::EbtUint8 ||
+            type.getBasicType() == glslang::EbtInt8) {
+            builder.addCapability(spv::CapabilityInt8);
+        }
 
         spv::Id scope = makeArraySizeId(*type.getTypeParameters(), 1);
         spv::Id rows = makeArraySizeId(*type.getTypeParameters(), 2);

+ 2 - 10
3rdparty/glslang/Test/baseResults/310.inheritMemory.frag.out

@@ -1,14 +1,6 @@
 310.inheritMemory.frag
-ERROR: 0:38: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
-ERROR: 0:39: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
-ERROR: 0:40: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
-ERROR: 0:41: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
-ERROR: 0:42: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
-ERROR: 5 compilation errors.  No code generated.
-
-
 Shader version: 310
-ERROR: node is still EOpNull!
+0:? Sequence
 0:18  Function Definition: non_ro_fun(f1[10]; ( global void)
 0:18    Function Parameters: 
 0:18      'buff' ( in 10-element array of mediump float)
@@ -120,7 +112,7 @@ Linked fragment stage:
 
 
 Shader version: 310
-ERROR: node is still EOpNull!
+0:? Sequence
 0:18  Function Definition: non_ro_fun(f1[10]; ( global void)
 0:18    Function Parameters: 
 0:18      'buff' ( in 10-element array of mediump float)

+ 23 - 4
3rdparty/glslang/Test/baseResults/glspv.esversion.vert.out

@@ -1,6 +1,25 @@
 glspv.esversion.vert
-ERROR: #version: ES shaders for OpenGL SPIR-V are not supported
-ERROR: 1 compilation errors.  No code generated.
+// Module Version 10000
+// Generated by (magic number): 80007
+// Id's are bound by 10
 
-
-SPIR-V is not generated for failed compile or link
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 8 9
+                              Source ESSL 310
+                              Name 4  "main"
+                              Name 8  "gl_VertexID"
+                              Name 9  "gl_InstanceID"
+                              Decorate 8(gl_VertexID) BuiltIn VertexId
+                              Decorate 9(gl_InstanceID) BuiltIn InstanceId
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeInt 32 1
+               7:             TypePointer Input 6(int)
+  8(gl_VertexID):      7(ptr) Variable Input
+9(gl_InstanceID):      7(ptr) Variable Input
+         4(main):           2 Function None 3
+               5:             Label
+                              Return
+                              FunctionEnd

+ 5 - 0
3rdparty/glslang/Test/baseResults/reflection.options.vert.out

@@ -51,10 +51,15 @@ MultipleArrays.tri[0].v[2].normal[0]: offset 60, type 1406, size 3, index 1, bin
 MultipleArrays.vert[0].position[0]: offset 360, type 1406, size 3, index 1, binding -1, stages 1, arrayStride 4, topLevelArrayStride 24
 MultipleArrays.vert[0].normal[0]: offset 372, type 1406, size 3, index 1, binding -1, stages 0, arrayStride 4, topLevelArrayStride 24
 MultipleArrays.f[0]: offset 480, type 1406, size 5, index 1, binding -1, stages 1, arrayStride 4, topLevelArrayStride 4
+ArrayedBind[0].a: offset 0, type 1406, size 1, index 4, binding -1, stages 0
+ArrayedBind[0].b: offset 4, type 1406, size 1, index 4, binding -1, stages 1
 
 Buffer block reflection:
 VertexCollection: offset -1, type ffffffff, size 400, index -1, binding -1, stages 1, numMembers 7
 MultipleArrays: offset -1, type ffffffff, size 500, index -1, binding -1, stages 1, numMembers 9
+ArrayedBind[0]: offset -1, type ffffffff, size 8, index -1, binding -1, stages 1, numMembers 2
+ArrayedBind[1]: offset -1, type ffffffff, size 8, index -1, binding -1, stages 1, numMembers 2
+ArrayedBind[2]: offset -1, type ffffffff, size 8, index -1, binding -1, stages 1, numMembers 2
 
 Pipeline input reflection:
 gl_InstanceID: offset 0, type 1404, size 1, index 0, binding -1, stages 1

+ 418 - 0
3rdparty/glslang/Test/baseResults/spv.intcoopmat.comp.out

@@ -0,0 +1,418 @@
+spv.intcoopmat.comp
+// Module Version 10000
+// Generated by (magic number): 80007
+// Id's are bound by 262
+
+                              Capability Shader
+                              Capability Float16
+                              Capability Int8
+                              Capability StorageBuffer8BitAccess
+                              Capability VulkanMemoryModelKHR
+                              Capability PhysicalStorageBufferAddressesEXT
+                              Capability CooperativeMatrixNV
+                              Extension  "SPV_EXT_physical_storage_buffer"
+                              Extension  "SPV_KHR_8bit_storage"
+                              Extension  "SPV_KHR_storage_buffer_storage_class"
+                              Extension  "SPV_KHR_vulkan_memory_model"
+                              Extension  "SPV_NV_cooperative_matrix"
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel PhysicalStorageBuffer64EXT VulkanKHR
+                              EntryPoint GLCompute 4  "main"
+                              ExecutionMode 4 LocalSize 64 1 1
+                              Source GLSL 450
+                              SourceExtension  "GL_EXT_buffer_reference"
+                              SourceExtension  "GL_EXT_shader_explicit_arithmetic_types"
+                              SourceExtension  "GL_KHR_memory_scope_semantics"
+                              SourceExtension  "GL_NV_cooperative_matrix"
+                              SourceExtension  "GL_NV_integer_cooperative_matrix"
+                              Name 4  "main"
+                              Name 14  "ineg(i81;"
+                              Name 13  "m"
+                              Name 21  "umul(u81;"
+                              Name 20  "m"
+                              Name 35  "mu"
+                              Name 39  "mi"
+                              Name 55  "mf16_0"
+                              Name 61  "mf32_0"
+                              Name 64  "mf16_1"
+                              Name 67  "mf32_1"
+                              Name 71  "x"
+                              Name 81  "tempArg"
+                              Name 85  "Block"
+                              MemberName 85(Block) 0  "y"
+                              MemberName 85(Block) 1  "x"
+                              Name 87  "block"
+                              Name 98  "tempArg"
+                              Name 103  "Block16"
+                              MemberName 103(Block16) 0  "y"
+                              MemberName 103(Block16) 1  "x"
+                              MemberName 103(Block16) 2  "b"
+                              Name 106  "Block"
+                              MemberName 106(Block) 0  "y"
+                              MemberName 106(Block) 1  "x"
+                              Name 108  "block8"
+                              Name 115  "tempArg"
+                              Name 128  "D"
+                              Name 129  "A"
+                              Name 131  "B"
+                              Name 133  "C"
+                              Name 137  "l"
+                              Name 142  "a"
+                              Name 146  "md1"
+                              Name 156  "Y"
+                              Name 157  "Z"
+                              Name 161  "muC2"
+                              Name 169  "miC2"
+                              Name 176  "tempArg"
+                              Name 182  "tempArg"
+                              Name 188  "p1"
+                              Name 189  "param"
+                              Name 192  "p2"
+                              Name 193  "param"
+                              Name 207  "tempArg"
+                              Name 212  "shmatrix"
+                              Name 217  "ms"
+                              Name 225  "miC"
+                              Name 226  "muC"
+                              Name 231  "iarr"
+                              Name 236  "iarr2"
+                              Name 241  "uarr"
+                              Name 246  "uarr2"
+                              Name 251  "S"
+                              MemberName 251(S) 0  "a"
+                              MemberName 251(S) 1  "b"
+                              MemberName 251(S) 2  "c"
+                              Name 256  "SC"
+                              Name 261  "scm"
+                              Decorate 83 ArrayStride 4
+                              Decorate 84 ArrayStride 4
+                              MemberDecorate 85(Block) 0 Offset 0
+                              MemberDecorate 85(Block) 1 Offset 4194304
+                              Decorate 85(Block) Block
+                              Decorate 87(block) DescriptorSet 0
+                              Decorate 87(block) Binding 0
+                              Decorate 99 ArrayStride 1
+                              Decorate 101 ArrayStride 1
+                              MemberDecorate 103(Block16) 0 Offset 0
+                              MemberDecorate 103(Block16) 1 Offset 1048576
+                              MemberDecorate 103(Block16) 2 Offset 1048584
+                              Decorate 103(Block16) Block
+                              Decorate 104 ArrayStride 4
+                              Decorate 105 ArrayStride 4
+                              MemberDecorate 106(Block) 0 Offset 0
+                              MemberDecorate 106(Block) 1 Offset 4194304
+                              Decorate 106(Block) Block
+                              Decorate 108(block8) DescriptorSet 0
+                              Decorate 108(block8) Binding 0
+                              Decorate 156(Y) SpecId 0
+                              Decorate 223 BuiltIn WorkgroupSize
+                              Decorate 256(SC) SpecId 2
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeInt 8 1
+               7:             TypeInt 32 0
+               8:      7(int) Constant 3
+               9:      7(int) Constant 8
+              10:             TypeCooperativeMatrixNV 6(int8_t) 8 9 9
+              11:             TypePointer Function 10
+              12:             TypeFunction 10 11(ptr)
+              16:             TypeInt 8 0
+              17:             TypeCooperativeMatrixNV 16(int8_t) 8 9 9
+              18:             TypePointer Function 17
+              19:             TypeFunction 17 18(ptr)
+              28:  16(int8_t) Constant 2
+              32:      7(int) Constant 16
+              33:             TypeCooperativeMatrixNV 16(int8_t) 8 32 9
+              34:             TypePointer Function 33
+              36:          33 ConstantComposite 28
+              37:             TypeCooperativeMatrixNV 6(int8_t) 8 32 9
+              38:             TypePointer Function 37
+              40:   6(int8_t) Constant 2
+              41:          37 ConstantComposite 40
+              52:             TypeFloat 16
+              53:             TypeCooperativeMatrixNV 52(float16_t) 8 32 9
+              54:             TypePointer Function 53
+              58:             TypeFloat 32
+              59:             TypeCooperativeMatrixNV 58(float) 8 32 9
+              60:             TypePointer Function 59
+              70:             TypePointer Function 16(int8_t)
+              72:             TypeInt 32 1
+              73:     72(int) Constant 1
+              76:     72(int) Constant 0
+              79:             TypePointer Function 6(int8_t)
+              82:      7(int) Constant 1048576
+              83:             TypeArray 7(int) 82
+              84:             TypeRuntimeArray 7(int)
+       85(Block):             TypeStruct 83 84
+              86:             TypePointer StorageBuffer 85(Block)
+       87(block):     86(ptr) Variable StorageBuffer
+              88:      7(int) Constant 5
+              89:             TypePointer StorageBuffer 7(int)
+              91:      7(int) Constant 128
+              92:             TypeBool
+              93:    92(bool) ConstantFalse
+              99:             TypeArray 6(int8_t) 82
+             100:      7(int) Constant 1
+             101:             TypeArray 6(int8_t) 100
+                              TypeForwardPointer 102 PhysicalStorageBufferEXT
+    103(Block16):             TypeStruct 99 101 102
+             104:             TypeArray 7(int) 82
+             105:             TypeRuntimeArray 7(int)
+      106(Block):             TypeStruct 104 105
+             102:             TypePointer PhysicalStorageBufferEXT 106(Block)
+             107:             TypePointer StorageBuffer 103(Block16)
+     108(block8):    107(ptr) Variable StorageBuffer
+             109:             TypePointer StorageBuffer 6(int8_t)
+             116:     72(int) Constant 2
+             117:             TypePointer StorageBuffer 102(ptr)
+             120:             TypePointer PhysicalStorageBufferEXT 7(int)
+             136:             TypePointer Function 72(int)
+             138:      7(int) SpecConstantOp 5362 33
+             139:     72(int) SpecConstantOp 128 138 76
+             140:             TypeArray 37 88
+             141:             TypePointer Function 140
+             143:     72(int) Constant 3
+             144:   6(int8_t) Constant 1
+             150:     72(int) Constant 1234
+             155:     72(int) Constant 8
+          156(Y):     72(int) SpecConstant 2
+          157(Z):     72(int) SpecConstantOp 132 155 156(Y)
+             158:             TypeCooperativeMatrixNV 16(int8_t) 8 157(Z) 9
+             159:             TypeArray 158 8
+             160:             TypePointer Private 159
+       161(muC2):    160(ptr) Variable Private
+             162:             TypePointer Private 158
+             166:             TypeCooperativeMatrixNV 6(int8_t) 8 157(Z) 9
+             167:             TypeArray 166 8
+             168:             TypePointer Private 167
+       169(miC2):    168(ptr) Variable Private
+             170:             TypePointer Private 6(int8_t)
+             174:             TypePointer Private 16(int8_t)
+             204:  16(int8_t) Constant 4
+             208:             TypeVector 7(int) 4
+             209:      7(int) Constant 32
+             210:             TypeArray 208(ivec4) 209
+             211:             TypePointer Workgroup 210
+   212(shmatrix):    211(ptr) Variable Workgroup
+             213:      7(int) Constant 2
+             214:             TypePointer Workgroup 208(ivec4)
+             221:             TypeVector 7(int) 3
+             222:      7(int) Constant 64
+             223:  221(ivec3) ConstantComposite 222 100 100
+             224:             TypePointer Private 166
+        225(miC):    224(ptr) Variable Private
+        226(muC):    162(ptr) Variable Private
+             227:      7(int) SpecConstantOp 5362 166
+             228:     72(int) SpecConstantOp 128 227 76
+             229:             TypeArray 72(int) 228
+             230:             TypePointer Private 229
+       231(iarr):    230(ptr) Variable Private
+             232:      7(int) SpecConstantOp 5362 166
+             233:     72(int) SpecConstantOp 128 232 76
+             234:             TypeArray 72(int) 233
+             235:             TypePointer Private 234
+      236(iarr2):    235(ptr) Variable Private
+             237:      7(int) SpecConstantOp 5362 158
+             238:     72(int) SpecConstantOp 128 237 76
+             239:             TypeArray 72(int) 238
+             240:             TypePointer Private 239
+       241(uarr):    240(ptr) Variable Private
+             242:      7(int) SpecConstantOp 5362 158
+             243:     72(int) SpecConstantOp 128 242 76
+             244:             TypeArray 72(int) 243
+             245:             TypePointer Private 244
+      246(uarr2):    245(ptr) Variable Private
+             247:             TypeCooperativeMatrixNV 72(int) 8 157(Z) 9
+             248:         247 ConstantComposite 73
+             249:  16(int8_t) Constant 1
+             250:          17 ConstantComposite 249
+          251(S):             TypeStruct 72(int) 72(int) 72(int)
+             252:     72(int) Constant 12
+             253:     72(int) Constant 23
+             254:     72(int) Constant 34
+             255:      251(S) ConstantComposite 252 253 254
+         256(SC):     72(int) SpecConstant 1
+             257:             TypeCooperativeMatrixNV 7(int) 8 256(SC) 256(SC)
+             258:             TypeArray 257 256(SC)
+             259:             TypeArray 258 256(SC)
+             260:             TypePointer Private 259
+        261(scm):    260(ptr) Variable Private
+         4(main):           2 Function None 3
+               5:             Label
+          35(mu):     34(ptr) Variable Function
+          39(mi):     38(ptr) Variable Function
+      55(mf16_0):     54(ptr) Variable Function
+      61(mf32_0):     60(ptr) Variable Function
+      64(mf16_1):     54(ptr) Variable Function
+      67(mf32_1):     60(ptr) Variable Function
+           71(x):     70(ptr) Variable Function
+     81(tempArg):     38(ptr) Variable Function
+     98(tempArg):     34(ptr) Variable Function
+    115(tempArg):     38(ptr) Variable Function
+          128(D):     34(ptr) Variable Function
+          129(A):     34(ptr) Variable Function
+          131(B):     18(ptr) Variable Function
+          133(C):     34(ptr) Variable Function
+          137(l):    136(ptr) Variable Function
+          142(a):    141(ptr) Variable Function
+        146(md1):    136(ptr) Variable Function
+    176(tempArg):     38(ptr) Variable Function
+    182(tempArg):     34(ptr) Variable Function
+         188(p1):     11(ptr) Variable Function
+      189(param):     11(ptr) Variable Function
+         192(p2):     18(ptr) Variable Function
+      193(param):     18(ptr) Variable Function
+    207(tempArg):     38(ptr) Variable Function
+         217(ms):     38(ptr) Variable Function
+                              Store 35(mu) 36
+                              Store 39(mi) 41
+              42:          33 Load 35(mu)
+              43:          33 Load 35(mu)
+              44:          33 IAdd 42 43
+                              Store 35(mu) 44
+              45:          33 Load 35(mu)
+              46:          33 Load 35(mu)
+              47:          33 ISub 45 46
+                              Store 35(mu) 47
+              48:          37 Load 39(mi)
+              49:          37 SNegate 48
+                              Store 39(mi) 49
+              50:          37 Load 39(mi)
+              51:          37 MatrixTimesScalar 50 40
+                              Store 39(mi) 51
+              56:          33 Load 35(mu)
+              57:          53 ConvertUToF 56
+                              Store 55(mf16_0) 57
+              62:          33 Load 35(mu)
+              63:          59 ConvertUToF 62
+                              Store 61(mf32_0) 63
+              65:          37 Load 39(mi)
+              66:          53 ConvertSToF 65
+                              Store 64(mf16_1) 66
+              68:          37 Load 39(mi)
+              69:          59 ConvertSToF 68
+                              Store 67(mf32_1) 69
+              74:     70(ptr) AccessChain 35(mu) 73
+              75:  16(int8_t) Load 74
+                              Store 71(x) 75
+              77:  16(int8_t) Load 71(x)
+              78:   6(int8_t) Bitcast 77
+              80:     79(ptr) AccessChain 39(mi) 76
+                              Store 80 78
+              90:     89(ptr) AccessChain 87(block) 73 32
+              94:          37 CooperativeMatrixLoadNV 90 91 93 MakePointerVisibleKHR NonPrivatePointerKHR 88
+                              Store 81(tempArg) 94
+              95:          37 Load 81(tempArg)
+                              Store 39(mi) 95
+              96:          37 Load 39(mi)
+              97:     89(ptr) AccessChain 87(block) 73 32
+                              CooperativeMatrixStoreNV 97 96 91 93 MakePointerAvailableKHR NonPrivatePointerKHR 88
+             110:    109(ptr) AccessChain 108(block8) 73 32
+             111:          33 CooperativeMatrixLoadNV 110 91 93 MakePointerVisibleKHR NonPrivatePointerKHR 88
+                              Store 98(tempArg) 111
+             112:          33 Load 98(tempArg)
+                              Store 35(mu) 112
+             113:          33 Load 35(mu)
+             114:    109(ptr) AccessChain 108(block8) 73 32
+                              CooperativeMatrixStoreNV 114 113 91 93 MakePointerAvailableKHR NonPrivatePointerKHR 88
+             118:    117(ptr) AccessChain 108(block8) 116
+             119:    102(ptr) Load 118 MakePointerVisibleKHR NonPrivatePointerKHR 88
+             121:    120(ptr) AccessChain 119 73 32
+             122:          37 CooperativeMatrixLoadNV 121 91 93 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 88
+                              Store 115(tempArg) 122
+             123:          37 Load 115(tempArg)
+                              Store 39(mi) 123
+             124:          37 Load 39(mi)
+             125:    117(ptr) AccessChain 108(block8) 116
+             126:    102(ptr) Load 125 MakePointerVisibleKHR NonPrivatePointerKHR 88
+             127:    120(ptr) AccessChain 126 73 32
+                              CooperativeMatrixStoreNV 127 124 91 93 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 88
+             130:          33 Load 129(A)
+             132:          17 Load 131(B)
+             134:          33 Load 133(C)
+             135:          33 CooperativeMatrixMulAddNV 130 132 134
+                              Store 128(D) 135
+                              Store 137(l) 139
+             145:     79(ptr) AccessChain 142(a) 143 76
+                              Store 145 144
+                              Store 146(md1) 73
+             147:          37 Load 39(mi)
+             148:          37 Load 39(mi)
+             149:          37 IAdd 148 147
+                              Store 39(mi) 149
+             151:   6(int8_t) CompositeExtract 149 1234
+             152:     72(int) SConvert 151
+             153:     72(int) Load 146(md1)
+             154:     72(int) IAdd 153 152
+                              Store 146(md1) 154
+             163:    162(ptr) AccessChain 161(muC2) 73
+             164:         158 Load 163
+             165:    162(ptr) AccessChain 161(muC2) 76
+                              Store 165 164
+             171:    170(ptr) AccessChain 169(miC2) 116 76
+             172:   6(int8_t) Load 171
+             173:  16(int8_t) Bitcast 172
+             175:    174(ptr) AccessChain 161(muC2) 73 76
+                              Store 175 173
+             177:     89(ptr) AccessChain 87(block) 76 32
+             178:          37 CooperativeMatrixLoadNV 177 91 93 MakePointerVisibleKHR NonPrivatePointerKHR 88
+                              Store 176(tempArg) 178
+             179:          37 Load 176(tempArg)
+                              Store 39(mi) 179
+             180:          37 Load 39(mi)
+             181:     89(ptr) AccessChain 87(block) 76 32
+                              CooperativeMatrixStoreNV 181 180 91 93 MakePointerAvailableKHR NonPrivatePointerKHR 88
+             183:    109(ptr) AccessChain 108(block8) 76 32
+             184:          33 CooperativeMatrixLoadNV 183 91 93 MakePointerVisibleKHR NonPrivatePointerKHR 88
+                              Store 182(tempArg) 184
+             185:          33 Load 182(tempArg)
+                              Store 35(mu) 185
+             186:          33 Load 35(mu)
+             187:    109(ptr) AccessChain 108(block8) 76 32
+                              CooperativeMatrixStoreNV 187 186 91 93 MakePointerAvailableKHR NonPrivatePointerKHR 88
+             190:          10 Load 188(p1)
+                              Store 189(param) 190
+             191:          10 FunctionCall 14(ineg(i81;) 189(param)
+                              Store 188(p1) 191
+             194:          17 Load 192(p2)
+                              Store 193(param) 194
+             195:          17 FunctionCall 21(umul(u81;) 193(param)
+                              Store 192(p2) 195
+             196:          10 Load 188(p1)
+             197:          10 Load 188(p1)
+             198:          10 SDiv 197 196
+                              Store 188(p1) 198
+             199:          17 Load 192(p2)
+             200:          17 Load 192(p2)
+             201:          17 UDiv 200 199
+                              Store 192(p2) 201
+             202:          10 Load 188(p1)
+             203:          10 MatrixTimesScalar 202 40
+                              Store 188(p1) 203
+             205:          17 Load 192(p2)
+             206:          17 MatrixTimesScalar 205 204
+                              Store 192(p2) 206
+             215:    214(ptr) AccessChain 212(shmatrix) 100
+             216:          37 CooperativeMatrixLoadNV 215 213 93 MakePointerVisibleKHR NonPrivatePointerKHR 213
+                              Store 207(tempArg) 216
+             218:          37 Load 207(tempArg)
+                              Store 217(ms) 218
+             219:          37 Load 217(ms)
+             220:    214(ptr) AccessChain 212(shmatrix) 100
+                              CooperativeMatrixStoreNV 220 219 213 93 MakePointerAvailableKHR NonPrivatePointerKHR 213
+                              Return
+                              FunctionEnd
+   14(ineg(i81;):          10 Function None 12
+           13(m):     11(ptr) FunctionParameter
+              15:             Label
+              23:          10 Load 13(m)
+              24:          10 SNegate 23
+                              ReturnValue 24
+                              FunctionEnd
+   21(umul(u81;):          17 Function None 19
+           20(m):     18(ptr) FunctionParameter
+              22:             Label
+              27:          17 Load 20(m)
+              29:          17 MatrixTimesScalar 27 28
+                              ReturnValue 29
+                              FunctionEnd

+ 6 - 0
3rdparty/glslang/Test/reflection.options.vert

@@ -20,6 +20,11 @@ buffer MultipleArrays {
     float f[5];
 } multiarray;
 
+buffer ArrayedBind {
+    float a;
+    float b;
+} buffers[3];
+
 uniform UBO {
     VertexInfo verts[2];
     float flt[8];
@@ -52,6 +57,7 @@ void main()
     f += ubo.flt[gl_InstanceID];
     f += ubo.uniform_multi[0][0][0];
     f += uniform_multi[gl_InstanceID][gl_InstanceID][gl_InstanceID];
+    f += buffers[gl_InstanceID].b;
     TriangleInfo tlocal[5] = t;
     outval.val = f;
     outarr[2] = f;

+ 117 - 0
3rdparty/glslang/Test/spv.intcoopmat.comp

@@ -0,0 +1,117 @@
+#version 450 core
+#extension GL_KHR_memory_scope_semantics : enable
+#extension GL_NV_cooperative_matrix : enable
+#extension GL_NV_integer_cooperative_matrix : enable
+#extension GL_EXT_shader_explicit_arithmetic_types : enable
+#extension GL_EXT_buffer_reference : enable
+
+layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
+
+const int X = 8;
+layout(constant_id = 0) const int Y = 2;
+const int Z = X*Y;
+
+icoopmatNV<8, gl_ScopeSubgroup, Z, 8> miC;
+icoopmatNV<8, gl_ScopeSubgroup, Z, 8> miC2[3];
+ucoopmatNV<8, gl_ScopeSubgroup, Z, 8> muC;
+ucoopmatNV<8, gl_ScopeSubgroup, Z, 8> muC2[3];
+
+int iarr[miC.length()];
+int iarr2[miC2[1].length()];
+int uarr[muC.length()];
+int uarr2[muC2[1].length()];
+
+const icoopmatNV<32, gl_ScopeSubgroup, Z, 8> mD = icoopmatNV<32, gl_ScopeSubgroup, Z, 8>(1);
+const ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> mD2 = ucoopmatNV<8, gl_ScopeSubgroup, 8, 8>(1);
+
+struct S { int a; int b; int c; };
+
+const S s = S(12, 23, 34);
+
+layout(set = 0, binding = 0, buffer_reference) coherent buffer Block {
+    uint y[1024*1024];
+    uint x[];
+} block;
+
+layout(set = 0, binding = 0) coherent buffer Block16 {
+    int8_t y[1024*1024];
+    int8_t x[];
+
+    Block b;
+} block8;
+
+icoopmatNV<8, gl_ScopeSubgroup, 8, 8> ineg(icoopmatNV<8, gl_ScopeSubgroup, 8, 8> m) { return -m; }
+ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> umul(ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> m) { return m * uint8_t(2); }
+
+layout(constant_id = 2) const int SC = 1;
+ucoopmatNV<32, gl_ScopeSubgroup, SC, SC> scm[SC][SC];
+
+// sized for icoopmatNV<8, gl_ScopeSubgroup, 16, 16>
+shared uvec4 shmatrix[16*16*2/16];
+
+void main()
+{
+    ucoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> mu = ucoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)>(2);
+    icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> mi = icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)>(2);
+
+    mu = mu + mu;
+    mu = mu - mu;
+    mi = -mi;
+    mi = mi * int8_t(2);
+
+    fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> mf16_0 = fcoopmatNV<16, gl_ScopeSubgroup, 16, 8>(mu);
+    fcoopmatNV<32, gl_ScopeSubgroup, 16, 8> mf32_0 = fcoopmatNV<32, gl_ScopeSubgroup, 16, 8>(mu);
+    fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> mf16_1 = fcoopmatNV<16, gl_ScopeSubgroup, 16, 8>(mi);
+    fcoopmatNV<32, gl_ScopeSubgroup, 16, 8> mf32_1 = fcoopmatNV<32, gl_ScopeSubgroup, 16, 8>(mi);
+
+    uint8_t x = mu[1];
+    mi[0] = int8_t(x);
+
+    coopMatLoadNV(mi, block.x, 16, 128, false);
+    coopMatStoreNV(mi, block.x, 16, 128, false);
+    coopMatLoadNV(mu, block8.x, 16, 128, false);
+    coopMatStoreNV(mu, block8.x, 16, 128, false);
+    coopMatLoadNV(mi, block8.b.x, 16, 128, false);
+    coopMatStoreNV(mi, block8.b.x, 16, 128, false);
+
+    ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> A;
+    ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> B;
+    ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> C;
+    ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> D;
+    D = coopMatMulAddNV(A, B, C);
+
+    int l = D.length();
+
+
+    icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> a[5];
+    a[3][0] = int8_t(1);
+
+    int md1 = mD[1];
+
+    md1 += (mi += mi)[1234];
+
+    muC2[0] = muC2[1];
+    muC2[1][0] = (miC2[2][0]);
+
+    coopMatLoadNV(mi, block.y, 16, 128, false);
+    coopMatStoreNV(mi, block.y, 16, 128, false);
+    coopMatLoadNV(mu, block8.y, 16, 128, false);
+    coopMatStoreNV(mu, block8.y, 16, 128, false);
+
+    icoopmatNV<8, gl_ScopeSubgroup, 8, 8> p1;
+    ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> p2;
+
+    p1 = ineg(p1);
+    p2 = umul(p2);
+
+    p1 /= p1;
+    p2 /= p2;
+
+    p1 *= int8_t(2);
+    p2 *= uint8_t(4);
+
+    icoopmatNV<8, gl_ScopeSubgroup, 16, 8> ms;
+    coopMatLoadNV(ms, shmatrix, 1, 2, false);
+    coopMatStoreNV(ms, shmatrix, 1, 2, false);
+
+}

+ 27 - 6
3rdparty/glslang/glslang/Include/Types.h

@@ -1433,11 +1433,18 @@ public:
                                     }
                                     typeName = NewPoolTString(p.userDef->getTypeName().c_str());
                                 }
-                                if (p.isCoopmat() && p.basicType == EbtFloat &&
-                                    p.typeParameters && p.typeParameters->getNumDims() > 0 &&
-                                    p.typeParameters->getDimSize(0) == 16) {
-                                    basicType = EbtFloat16;
-                                    qualifier.precision = EpqNone;
+                                if (p.isCoopmat() && p.typeParameters && p.typeParameters->getNumDims() > 0) {
+                                    int numBits = p.typeParameters->getDimSize(0);
+                                    if (p.basicType == EbtFloat && numBits == 16) {
+                                        basicType = EbtFloat16;
+                                        qualifier.precision = EpqNone;
+                                    } else if (p.basicType == EbtUint && numBits == 8) {
+                                        basicType = EbtUint8;
+                                        qualifier.precision = EpqNone;
+                                    } else if (p.basicType == EbtInt && numBits == 8) {
+                                        basicType = EbtInt8;
+                                        qualifier.precision = EpqNone;
+                                    }
                                 }
                             }
     // for construction of sampler types
@@ -2301,10 +2308,24 @@ public:
     // an OK function parameter
     bool coopMatParameterOK(const TType& right) const
     {
-        return isCoopMat() && right.isCoopMat() &&
+        return isCoopMat() && right.isCoopMat() && (getBasicType() == right.getBasicType()) &&
                typeParameters == nullptr && right.typeParameters != nullptr;
     }
 
+    bool sameCoopMatBaseType(const TType &right) const {
+        bool rv = coopmat && right.coopmat;
+        if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16)
+            rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16;
+        else if (getBasicType() == EbtUint || getBasicType() == EbtUint8)
+            rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8;
+        else if (getBasicType() == EbtInt || getBasicType() == EbtInt8)
+            rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8;
+        else
+            rv = false;
+        return rv;
+    }
+
+
     // See if two types match in all ways (just the actual type, not qualification)
     bool operator==(const TType& right) const
     {

+ 60 - 3
3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp

@@ -4797,6 +4797,60 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
             "void coopMatStoreNV(fcoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
 
             "fcoopmatNV coopMatMulAddNV(fcoopmatNV A, fcoopmatNV B, fcoopmatNV C);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
+
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
+
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
+
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
+            "void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
+
+            "icoopmatNV coopMatMulAddNV(icoopmatNV A, icoopmatNV B, icoopmatNV C);\n"
+            "ucoopmatNV coopMatMulAddNV(ucoopmatNV A, ucoopmatNV B, ucoopmatNV C);\n"
             );
     }
 
@@ -8527,9 +8581,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
             symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);
         }
 
-        symbolTable.setFunctionExtensions("coopMatLoadNV",              1, &E_GL_NV_cooperative_matrix);
-        symbolTable.setFunctionExtensions("coopMatStoreNV",             1, &E_GL_NV_cooperative_matrix);
-        symbolTable.setFunctionExtensions("coopMatMulAddNV",            1, &E_GL_NV_cooperative_matrix);
+        {
+            const char *coopExt[2] = { E_GL_NV_cooperative_matrix, E_GL_NV_integer_cooperative_matrix };
+            symbolTable.setFunctionExtensions("coopMatLoadNV",   2, coopExt);
+            symbolTable.setFunctionExtensions("coopMatStoreNV",  2, coopExt);
+            symbolTable.setFunctionExtensions("coopMatMulAddNV", 2, coopExt);
+        }
 
         if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
             symbolTable.setFunctionExtensions("dFdx",                   1, &E_GL_NV_compute_shader_derivatives);

+ 80 - 11
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp

@@ -1152,8 +1152,9 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
                         if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped()))
                             error(arguments->getLoc(), "Non-L-value cannot be passed for 'out' or 'inout' parameters.", "out", "");
                     }
-                    TQualifier& argQualifier = arg->getAsTyped()->getQualifier();
-                    if (argQualifier.isMemory()) {
+                    const TType& argType = arg->getAsTyped()->getType();
+                    const TQualifier& argQualifier = argType.getQualifier();
+                    if (argQualifier.isMemory() && (argType.containsOpaque() || argType.isReference())) {
                         const char* message = "argument cannot drop memory qualifier when passed to formal parameter";
                         if (argQualifier.volatil && ! formalQualifier.volatil)
                             error(arguments->getLoc(), message, "volatile", "");
@@ -6192,6 +6193,8 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu
         }
         if (from.isArray() || to.isArray() || ! from.sameElementShape(to))
             return false;
+        if (from.isCoopMat() && to.isCoopMat())
+            return from.sameCoopMatBaseType(to);
         return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType());
     };
 
@@ -6266,6 +6269,8 @@ const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc,
         }
         if (from.isArray() || to.isArray() || ! from.sameElementShape(to))
             return false;
+        if (from.isCoopMat() && to.isCoopMat())
+            return from.sameCoopMatBaseType(to);
         return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType());
     };
 
@@ -6365,12 +6370,20 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
         if (!publicType.typeParameters || publicType.typeParameters->getNumDims() != 4) {
             error(loc, "expected four type parameters", identifier.c_str(), "");
         }
-        if (publicType.typeParameters &&
-            publicType.typeParameters->getDimSize(0) != 16 &&
-            publicType.typeParameters->getDimSize(0) != 32 &&
-            publicType.typeParameters->getDimSize(0) != 64) {
-            error(loc, "expected 16, 32, or 64 bits for first type parameter", identifier.c_str(), "");
+        if (publicType.typeParameters) {
+            if (isTypeFloat(publicType.basicType) &&
+                publicType.typeParameters->getDimSize(0) != 16 &&
+                publicType.typeParameters->getDimSize(0) != 32 &&
+                publicType.typeParameters->getDimSize(0) != 64) {
+                error(loc, "expected 16, 32, or 64 bits for first type parameter", identifier.c_str(), "");
+            }
+            if (isTypeInt(publicType.basicType) &&
+                publicType.typeParameters->getDimSize(0) != 8 &&
+                publicType.typeParameters->getDimSize(0) != 32) {
+                error(loc, "expected 8 or 32 bits for first type parameter", identifier.c_str(), "");
+            }
         }
+
     } else {
         if (publicType.typeParameters && publicType.typeParameters->getNumDims() != 0) {
             error(loc, "unexpected type parameters", identifier.c_str(), "");
@@ -7065,19 +7078,75 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
             }
             node = intermediate.setAggregateOperator(node, EOpConstructCooperativeMatrix, type, node->getLoc());
         } else {
+            TOperator op = EOpNull;
             switch (type.getBasicType()) {
             default:
                 assert(0);
                 break;
+            case EbtInt:
+                switch (node->getType().getBasicType()) {
+                    case EbtFloat:   op = EOpConvFloatToInt;    break;
+                    case EbtFloat16: op = EOpConvFloat16ToInt;  break;
+                    case EbtUint8:   op = EOpConvUint8ToInt;    break;
+                    case EbtInt8:    op = EOpConvInt8ToInt;     break;
+                    case EbtUint:    op = EOpConvUintToInt;     break;
+                    default: assert(0);
+                }
+                break;
+            case EbtUint:
+                switch (node->getType().getBasicType()) {
+                    case EbtFloat:   op = EOpConvFloatToUint;    break;
+                    case EbtFloat16: op = EOpConvFloat16ToUint;  break;
+                    case EbtUint8:   op = EOpConvUint8ToUint;    break;
+                    case EbtInt8:    op = EOpConvInt8ToUint;     break;
+                    case EbtInt:     op = EOpConvIntToUint;      break;
+                    case EbtUint:    op = EOpConvUintToInt8;     break;
+                    default: assert(0);
+                }
+                break;
+            case EbtInt8:
+                switch (node->getType().getBasicType()) {
+                    case EbtFloat:   op = EOpConvFloatToInt8;    break;
+                    case EbtFloat16: op = EOpConvFloat16ToInt8;  break;
+                    case EbtUint8:   op = EOpConvUint8ToInt8;    break;
+                    case EbtInt:     op = EOpConvIntToInt8;      break;
+                    case EbtUint:    op = EOpConvUintToInt8;     break;
+                    default: assert(0);
+                }
+                break;
+            case EbtUint8:
+                switch (node->getType().getBasicType()) {
+                    case EbtFloat:   op = EOpConvFloatToUint8;   break;
+                    case EbtFloat16: op = EOpConvFloat16ToUint8; break;
+                    case EbtInt8:    op = EOpConvInt8ToUint8;    break;
+                    case EbtInt:     op = EOpConvIntToUint8;     break;
+                    case EbtUint:    op = EOpConvUintToUint8;    break;
+                    default: assert(0);
+                }
+                break;
             case EbtFloat:
-                assert(node->getType().getBasicType() == EbtFloat16);
-                node = intermediate.addUnaryNode(EOpConvFloat16ToFloat, node, node->getLoc(), type);
+                switch (node->getType().getBasicType()) {
+                    case EbtFloat16: op = EOpConvFloat16ToFloat;  break;
+                    case EbtInt8:    op = EOpConvInt8ToFloat;     break;
+                    case EbtUint8:   op = EOpConvUint8ToFloat;    break;
+                    case EbtInt:     op = EOpConvIntToFloat;      break;
+                    case EbtUint:    op = EOpConvUintToFloat;     break;
+                    default: assert(0);
+                }
                 break;
             case EbtFloat16:
-                assert(node->getType().getBasicType() == EbtFloat);
-                node = intermediate.addUnaryNode(EOpConvFloatToFloat16, node, node->getLoc(), type);
+                switch (node->getType().getBasicType()) {
+                    case EbtFloat:  op = EOpConvFloatToFloat16;  break;
+                    case EbtInt8:   op = EOpConvInt8ToFloat16;   break;
+                    case EbtUint8:  op = EOpConvUint8ToFloat16;  break;
+                    case EbtInt:    op = EOpConvIntToFloat16;    break;
+                    case EbtUint:   op = EOpConvUintToFloat16;   break;
+                    default: assert(0);
+                }
                 break;
             }
+
+            node = intermediate.addUnaryNode(op, node, node->getLoc(), type);
             // If it's a (non-specialization) constant, it must be folded.
             if (node->getAsUnaryNode()->getOperand()->getAsConstantUnion())
                 return node->getAsUnaryNode()->getOperand()->getAsConstantUnion()->fold(op, node->getType());

+ 10 - 0
3rdparty/glslang/glslang/MachineIndependent/Scan.cpp

@@ -713,6 +713,8 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["taskNV"] =                  PERTASKNV;
 
     (*KeywordMap)["fcoopmatNV"] =              FCOOPMATNV;
+    (*KeywordMap)["icoopmatNV"] =              ICOOPMATNV;
+    (*KeywordMap)["ucoopmatNV"] =              UCOOPMATNV;
 
     ReservedSet = new std::unordered_set<const char*, str_hash, str_eq>;
 
@@ -1599,6 +1601,14 @@ int TScanContext::tokenizeIdentifier()
             return keyword;
         return identifierOrType();
 
+    case UCOOPMATNV:
+    case ICOOPMATNV:
+        afterType = true;
+        if (parseContext.symbolTable.atBuiltInLevel() ||
+            parseContext.extensionTurnedOn(E_GL_NV_integer_cooperative_matrix))
+            return keyword;
+        return identifierOrType();
+
     case DEMOTE:
         if (parseContext.extensionTurnedOn(E_GL_EXT_demote_to_helper_invocation))
             return keyword;

+ 2 - 7
3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp

@@ -646,14 +646,9 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
     if (spvVersion.spv != 0) {
         switch (profile) {
         case EEsProfile:
-            if (spvVersion.vulkan > 0 && version < 310) {
+            if (version < 310) {
                 correct = false;
-                infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher");
-                version = 310;
-            }
-            if (spvVersion.openGl >= 100) {
-                correct = false;
-                infoSink.info.message(EPrefixError, "#version: ES shaders for OpenGL SPIR-V are not supported");
+                infoSink.info.message(EPrefixError, "#version: ES shaders for SPIR-V require version 310 or higher");
                 version = 310;
             }
             break;

+ 12 - 1
3rdparty/glslang/glslang/MachineIndependent/Versions.cpp

@@ -252,6 +252,7 @@ void TParseVersions::initializeExtensionBehavior()
 
     extensionBehavior[E_GL_NV_cooperative_matrix]                    = EBhDisable;
     extensionBehavior[E_GL_NV_shader_sm_builtins]                    = EBhDisable;
+    extensionBehavior[E_GL_NV_integer_cooperative_matrix]            = EBhDisable;
 
     // AEP
     extensionBehavior[E_GL_ANDROID_extension_pack_es31a]             = EBhDisable;
@@ -436,6 +437,7 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define GL_NV_shader_texture_footprint 1\n"
             "#define GL_NV_mesh_shader 1\n"
             "#define GL_NV_cooperative_matrix 1\n"
+            "#define GL_NV_integer_cooperative_matrix 1\n"
 
             "#define GL_EXT_shader_explicit_arithmetic_types 1\n"
             "#define GL_EXT_shader_explicit_arithmetic_types_int8 1\n"
@@ -822,6 +824,8 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
         updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
     else if (strcmp(extension, "GL_EXT_buffer_reference2") == 0)
         updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString);
+    else if (strcmp(extension, "GL_NV_integer_cooperative_matrix") == 0)
+        updateExtensionBehavior(line, "GL_NV_cooperative_matrix", behaviorString);
 }
 
 void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior)
@@ -1088,8 +1092,15 @@ void TParseVersions::fcoopmatCheck(const TSourceLoc& loc, const char* op, bool b
         requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
     }
 }
-#endif // GLSLANG_WEB
 
+void TParseVersions::intcoopmatCheck(const TSourceLoc& loc, const char* op, bool builtIn)
+{
+    if (!builtIn) {
+        const char* const extensions[] = {E_GL_NV_integer_cooperative_matrix};
+        requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
+    }
+}
+#endif // GLSLANG_WEB
 // Call for any operation removed because SPIR-V is in use.
 void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
 {

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

@@ -227,6 +227,7 @@ const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]);
 
 const char* const E_GL_NV_cooperative_matrix                    = "GL_NV_cooperative_matrix";
 const char* const E_GL_NV_shader_sm_builtins                    = "GL_NV_shader_sm_builtins";
+const char* const E_GL_NV_integer_cooperative_matrix            = "GL_NV_integer_cooperative_matrix";
 
 // AEP
 const char* const E_GL_ANDROID_extension_pack_es31a             = "GL_ANDROID_extension_pack_es31a";

+ 13 - 1
3rdparty/glslang/glslang/MachineIndependent/glslang.m4

@@ -200,7 +200,7 @@ GLSLANG_WEB_EXCLUDE_ON
 %token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
 %token <lex> ATOMIC_UINT
 %token <lex> ACCSTRUCTNV
-%token <lex> FCOOPMATNV
+%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
 
 // combined image/sampler
 %token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
@@ -3183,6 +3183,18 @@ GLSLANG_WEB_EXCLUDE_ON
         $$.basicType = EbtFloat;
         $$.coopmat = true;
     }
+    | ICOOPMATNV {
+        parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+        $$.coopmat = true;
+    }
+    | UCOOPMATNV {
+        parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+        $$.coopmat = true;
+    }
 GLSLANG_WEB_EXCLUDE_OFF
     | struct_specifier {
         $$ = $1;

+ 13 - 1
3rdparty/glslang/glslang/MachineIndependent/glslang.y

@@ -200,7 +200,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
 %token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
 %token <lex> ATOMIC_UINT
 %token <lex> ACCSTRUCTNV
-%token <lex> FCOOPMATNV
+%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
 
 // combined image/sampler
 %token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
@@ -3183,6 +3183,18 @@ type_specifier_nonarray
         $$.basicType = EbtFloat;
         $$.coopmat = true;
     }
+    | ICOOPMATNV {
+        parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+        $$.coopmat = true;
+    }
+    | UCOOPMATNV {
+        parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+        $$.coopmat = true;
+    }
 
     | struct_specifier {
         $$ = $1;

File diff suppressed because it is too large
+ 484 - 440
3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp


+ 260 - 258
3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h

@@ -194,263 +194,265 @@ extern int yydebug;
     ATOMIC_UINT = 404,
     ACCSTRUCTNV = 405,
     FCOOPMATNV = 406,
-    SAMPLER1D = 407,
-    SAMPLER1DARRAY = 408,
-    SAMPLER1DARRAYSHADOW = 409,
-    ISAMPLER1D = 410,
-    SAMPLER1DSHADOW = 411,
-    SAMPLER2DRECT = 412,
-    SAMPLER2DRECTSHADOW = 413,
-    ISAMPLER2DRECT = 414,
-    USAMPLER2DRECT = 415,
-    SAMPLERBUFFER = 416,
-    ISAMPLERBUFFER = 417,
-    USAMPLERBUFFER = 418,
-    SAMPLER2DMS = 419,
-    ISAMPLER2DMS = 420,
-    USAMPLER2DMS = 421,
-    SAMPLER2DMSARRAY = 422,
-    ISAMPLER2DMSARRAY = 423,
-    USAMPLER2DMSARRAY = 424,
-    SAMPLEREXTERNALOES = 425,
-    SAMPLEREXTERNAL2DY2YEXT = 426,
-    ISAMPLER1DARRAY = 427,
-    USAMPLER1D = 428,
-    USAMPLER1DARRAY = 429,
-    F16SAMPLER1D = 430,
-    F16SAMPLER2D = 431,
-    F16SAMPLER3D = 432,
-    F16SAMPLER2DRECT = 433,
-    F16SAMPLERCUBE = 434,
-    F16SAMPLER1DARRAY = 435,
-    F16SAMPLER2DARRAY = 436,
-    F16SAMPLERCUBEARRAY = 437,
-    F16SAMPLERBUFFER = 438,
-    F16SAMPLER2DMS = 439,
-    F16SAMPLER2DMSARRAY = 440,
-    F16SAMPLER1DSHADOW = 441,
-    F16SAMPLER2DSHADOW = 442,
-    F16SAMPLER1DARRAYSHADOW = 443,
-    F16SAMPLER2DARRAYSHADOW = 444,
-    F16SAMPLER2DRECTSHADOW = 445,
-    F16SAMPLERCUBESHADOW = 446,
-    F16SAMPLERCUBEARRAYSHADOW = 447,
-    IMAGE1D = 448,
-    IIMAGE1D = 449,
-    UIMAGE1D = 450,
-    IMAGE2D = 451,
-    IIMAGE2D = 452,
-    UIMAGE2D = 453,
-    IMAGE3D = 454,
-    IIMAGE3D = 455,
-    UIMAGE3D = 456,
-    IMAGE2DRECT = 457,
-    IIMAGE2DRECT = 458,
-    UIMAGE2DRECT = 459,
-    IMAGECUBE = 460,
-    IIMAGECUBE = 461,
-    UIMAGECUBE = 462,
-    IMAGEBUFFER = 463,
-    IIMAGEBUFFER = 464,
-    UIMAGEBUFFER = 465,
-    IMAGE1DARRAY = 466,
-    IIMAGE1DARRAY = 467,
-    UIMAGE1DARRAY = 468,
-    IMAGE2DARRAY = 469,
-    IIMAGE2DARRAY = 470,
-    UIMAGE2DARRAY = 471,
-    IMAGECUBEARRAY = 472,
-    IIMAGECUBEARRAY = 473,
-    UIMAGECUBEARRAY = 474,
-    IMAGE2DMS = 475,
-    IIMAGE2DMS = 476,
-    UIMAGE2DMS = 477,
-    IMAGE2DMSARRAY = 478,
-    IIMAGE2DMSARRAY = 479,
-    UIMAGE2DMSARRAY = 480,
-    F16IMAGE1D = 481,
-    F16IMAGE2D = 482,
-    F16IMAGE3D = 483,
-    F16IMAGE2DRECT = 484,
-    F16IMAGECUBE = 485,
-    F16IMAGE1DARRAY = 486,
-    F16IMAGE2DARRAY = 487,
-    F16IMAGECUBEARRAY = 488,
-    F16IMAGEBUFFER = 489,
-    F16IMAGE2DMS = 490,
-    F16IMAGE2DMSARRAY = 491,
-    SAMPLER = 492,
-    SAMPLERSHADOW = 493,
-    TEXTURE1D = 494,
-    TEXTURE2D = 495,
-    TEXTURE3D = 496,
-    TEXTURECUBE = 497,
-    TEXTURE1DARRAY = 498,
-    TEXTURE2DARRAY = 499,
-    ITEXTURE1D = 500,
-    ITEXTURE2D = 501,
-    ITEXTURE3D = 502,
-    ITEXTURECUBE = 503,
-    ITEXTURE1DARRAY = 504,
-    ITEXTURE2DARRAY = 505,
-    UTEXTURE1D = 506,
-    UTEXTURE2D = 507,
-    UTEXTURE3D = 508,
-    UTEXTURECUBE = 509,
-    UTEXTURE1DARRAY = 510,
-    UTEXTURE2DARRAY = 511,
-    TEXTURE2DRECT = 512,
-    ITEXTURE2DRECT = 513,
-    UTEXTURE2DRECT = 514,
-    TEXTUREBUFFER = 515,
-    ITEXTUREBUFFER = 516,
-    UTEXTUREBUFFER = 517,
-    TEXTURECUBEARRAY = 518,
-    ITEXTURECUBEARRAY = 519,
-    UTEXTURECUBEARRAY = 520,
-    TEXTURE2DMS = 521,
-    ITEXTURE2DMS = 522,
-    UTEXTURE2DMS = 523,
-    TEXTURE2DMSARRAY = 524,
-    ITEXTURE2DMSARRAY = 525,
-    UTEXTURE2DMSARRAY = 526,
-    F16TEXTURE1D = 527,
-    F16TEXTURE2D = 528,
-    F16TEXTURE3D = 529,
-    F16TEXTURE2DRECT = 530,
-    F16TEXTURECUBE = 531,
-    F16TEXTURE1DARRAY = 532,
-    F16TEXTURE2DARRAY = 533,
-    F16TEXTURECUBEARRAY = 534,
-    F16TEXTUREBUFFER = 535,
-    F16TEXTURE2DMS = 536,
-    F16TEXTURE2DMSARRAY = 537,
-    SUBPASSINPUT = 538,
-    SUBPASSINPUTMS = 539,
-    ISUBPASSINPUT = 540,
-    ISUBPASSINPUTMS = 541,
-    USUBPASSINPUT = 542,
-    USUBPASSINPUTMS = 543,
-    F16SUBPASSINPUT = 544,
-    F16SUBPASSINPUTMS = 545,
-    LEFT_OP = 546,
-    RIGHT_OP = 547,
-    INC_OP = 548,
-    DEC_OP = 549,
-    LE_OP = 550,
-    GE_OP = 551,
-    EQ_OP = 552,
-    NE_OP = 553,
-    AND_OP = 554,
-    OR_OP = 555,
-    XOR_OP = 556,
-    MUL_ASSIGN = 557,
-    DIV_ASSIGN = 558,
-    ADD_ASSIGN = 559,
-    MOD_ASSIGN = 560,
-    LEFT_ASSIGN = 561,
-    RIGHT_ASSIGN = 562,
-    AND_ASSIGN = 563,
-    XOR_ASSIGN = 564,
-    OR_ASSIGN = 565,
-    SUB_ASSIGN = 566,
-    LEFT_PAREN = 567,
-    RIGHT_PAREN = 568,
-    LEFT_BRACKET = 569,
-    RIGHT_BRACKET = 570,
-    LEFT_BRACE = 571,
-    RIGHT_BRACE = 572,
-    DOT = 573,
-    COMMA = 574,
-    COLON = 575,
-    EQUAL = 576,
-    SEMICOLON = 577,
-    BANG = 578,
-    DASH = 579,
-    TILDE = 580,
-    PLUS = 581,
-    STAR = 582,
-    SLASH = 583,
-    PERCENT = 584,
-    LEFT_ANGLE = 585,
-    RIGHT_ANGLE = 586,
-    VERTICAL_BAR = 587,
-    CARET = 588,
-    AMPERSAND = 589,
-    QUESTION = 590,
-    INVARIANT = 591,
-    HIGH_PRECISION = 592,
-    MEDIUM_PRECISION = 593,
-    LOW_PRECISION = 594,
-    PRECISION = 595,
-    PACKED = 596,
-    RESOURCE = 597,
-    SUPERP = 598,
-    FLOATCONSTANT = 599,
-    INTCONSTANT = 600,
-    UINTCONSTANT = 601,
-    BOOLCONSTANT = 602,
-    IDENTIFIER = 603,
-    TYPE_NAME = 604,
-    CENTROID = 605,
-    IN = 606,
-    OUT = 607,
-    INOUT = 608,
-    STRUCT = 609,
-    VOID = 610,
-    WHILE = 611,
-    BREAK = 612,
-    CONTINUE = 613,
-    DO = 614,
-    ELSE = 615,
-    FOR = 616,
-    IF = 617,
-    DISCARD = 618,
-    RETURN = 619,
-    SWITCH = 620,
-    CASE = 621,
-    DEFAULT = 622,
-    UNIFORM = 623,
-    SHARED = 624,
-    FLAT = 625,
-    SMOOTH = 626,
-    LAYOUT = 627,
-    DOUBLECONSTANT = 628,
-    INT16CONSTANT = 629,
-    UINT16CONSTANT = 630,
-    FLOAT16CONSTANT = 631,
-    INT32CONSTANT = 632,
-    UINT32CONSTANT = 633,
-    INT64CONSTANT = 634,
-    UINT64CONSTANT = 635,
-    SUBROUTINE = 636,
-    DEMOTE = 637,
-    PAYLOADNV = 638,
-    PAYLOADINNV = 639,
-    HITATTRNV = 640,
-    CALLDATANV = 641,
-    CALLDATAINNV = 642,
-    PATCH = 643,
-    SAMPLE = 644,
-    BUFFER = 645,
-    NONUNIFORM = 646,
-    COHERENT = 647,
-    VOLATILE = 648,
-    RESTRICT = 649,
-    READONLY = 650,
-    WRITEONLY = 651,
-    DEVICECOHERENT = 652,
-    QUEUEFAMILYCOHERENT = 653,
-    WORKGROUPCOHERENT = 654,
-    SUBGROUPCOHERENT = 655,
-    NONPRIVATE = 656,
-    NOPERSPECTIVE = 657,
-    EXPLICITINTERPAMD = 658,
-    PERVERTEXNV = 659,
-    PERPRIMITIVENV = 660,
-    PERVIEWNV = 661,
-    PERTASKNV = 662,
-    PRECISE = 663
+    ICOOPMATNV = 407,
+    UCOOPMATNV = 408,
+    SAMPLER1D = 409,
+    SAMPLER1DARRAY = 410,
+    SAMPLER1DARRAYSHADOW = 411,
+    ISAMPLER1D = 412,
+    SAMPLER1DSHADOW = 413,
+    SAMPLER2DRECT = 414,
+    SAMPLER2DRECTSHADOW = 415,
+    ISAMPLER2DRECT = 416,
+    USAMPLER2DRECT = 417,
+    SAMPLERBUFFER = 418,
+    ISAMPLERBUFFER = 419,
+    USAMPLERBUFFER = 420,
+    SAMPLER2DMS = 421,
+    ISAMPLER2DMS = 422,
+    USAMPLER2DMS = 423,
+    SAMPLER2DMSARRAY = 424,
+    ISAMPLER2DMSARRAY = 425,
+    USAMPLER2DMSARRAY = 426,
+    SAMPLEREXTERNALOES = 427,
+    SAMPLEREXTERNAL2DY2YEXT = 428,
+    ISAMPLER1DARRAY = 429,
+    USAMPLER1D = 430,
+    USAMPLER1DARRAY = 431,
+    F16SAMPLER1D = 432,
+    F16SAMPLER2D = 433,
+    F16SAMPLER3D = 434,
+    F16SAMPLER2DRECT = 435,
+    F16SAMPLERCUBE = 436,
+    F16SAMPLER1DARRAY = 437,
+    F16SAMPLER2DARRAY = 438,
+    F16SAMPLERCUBEARRAY = 439,
+    F16SAMPLERBUFFER = 440,
+    F16SAMPLER2DMS = 441,
+    F16SAMPLER2DMSARRAY = 442,
+    F16SAMPLER1DSHADOW = 443,
+    F16SAMPLER2DSHADOW = 444,
+    F16SAMPLER1DARRAYSHADOW = 445,
+    F16SAMPLER2DARRAYSHADOW = 446,
+    F16SAMPLER2DRECTSHADOW = 447,
+    F16SAMPLERCUBESHADOW = 448,
+    F16SAMPLERCUBEARRAYSHADOW = 449,
+    IMAGE1D = 450,
+    IIMAGE1D = 451,
+    UIMAGE1D = 452,
+    IMAGE2D = 453,
+    IIMAGE2D = 454,
+    UIMAGE2D = 455,
+    IMAGE3D = 456,
+    IIMAGE3D = 457,
+    UIMAGE3D = 458,
+    IMAGE2DRECT = 459,
+    IIMAGE2DRECT = 460,
+    UIMAGE2DRECT = 461,
+    IMAGECUBE = 462,
+    IIMAGECUBE = 463,
+    UIMAGECUBE = 464,
+    IMAGEBUFFER = 465,
+    IIMAGEBUFFER = 466,
+    UIMAGEBUFFER = 467,
+    IMAGE1DARRAY = 468,
+    IIMAGE1DARRAY = 469,
+    UIMAGE1DARRAY = 470,
+    IMAGE2DARRAY = 471,
+    IIMAGE2DARRAY = 472,
+    UIMAGE2DARRAY = 473,
+    IMAGECUBEARRAY = 474,
+    IIMAGECUBEARRAY = 475,
+    UIMAGECUBEARRAY = 476,
+    IMAGE2DMS = 477,
+    IIMAGE2DMS = 478,
+    UIMAGE2DMS = 479,
+    IMAGE2DMSARRAY = 480,
+    IIMAGE2DMSARRAY = 481,
+    UIMAGE2DMSARRAY = 482,
+    F16IMAGE1D = 483,
+    F16IMAGE2D = 484,
+    F16IMAGE3D = 485,
+    F16IMAGE2DRECT = 486,
+    F16IMAGECUBE = 487,
+    F16IMAGE1DARRAY = 488,
+    F16IMAGE2DARRAY = 489,
+    F16IMAGECUBEARRAY = 490,
+    F16IMAGEBUFFER = 491,
+    F16IMAGE2DMS = 492,
+    F16IMAGE2DMSARRAY = 493,
+    SAMPLER = 494,
+    SAMPLERSHADOW = 495,
+    TEXTURE1D = 496,
+    TEXTURE2D = 497,
+    TEXTURE3D = 498,
+    TEXTURECUBE = 499,
+    TEXTURE1DARRAY = 500,
+    TEXTURE2DARRAY = 501,
+    ITEXTURE1D = 502,
+    ITEXTURE2D = 503,
+    ITEXTURE3D = 504,
+    ITEXTURECUBE = 505,
+    ITEXTURE1DARRAY = 506,
+    ITEXTURE2DARRAY = 507,
+    UTEXTURE1D = 508,
+    UTEXTURE2D = 509,
+    UTEXTURE3D = 510,
+    UTEXTURECUBE = 511,
+    UTEXTURE1DARRAY = 512,
+    UTEXTURE2DARRAY = 513,
+    TEXTURE2DRECT = 514,
+    ITEXTURE2DRECT = 515,
+    UTEXTURE2DRECT = 516,
+    TEXTUREBUFFER = 517,
+    ITEXTUREBUFFER = 518,
+    UTEXTUREBUFFER = 519,
+    TEXTURECUBEARRAY = 520,
+    ITEXTURECUBEARRAY = 521,
+    UTEXTURECUBEARRAY = 522,
+    TEXTURE2DMS = 523,
+    ITEXTURE2DMS = 524,
+    UTEXTURE2DMS = 525,
+    TEXTURE2DMSARRAY = 526,
+    ITEXTURE2DMSARRAY = 527,
+    UTEXTURE2DMSARRAY = 528,
+    F16TEXTURE1D = 529,
+    F16TEXTURE2D = 530,
+    F16TEXTURE3D = 531,
+    F16TEXTURE2DRECT = 532,
+    F16TEXTURECUBE = 533,
+    F16TEXTURE1DARRAY = 534,
+    F16TEXTURE2DARRAY = 535,
+    F16TEXTURECUBEARRAY = 536,
+    F16TEXTUREBUFFER = 537,
+    F16TEXTURE2DMS = 538,
+    F16TEXTURE2DMSARRAY = 539,
+    SUBPASSINPUT = 540,
+    SUBPASSINPUTMS = 541,
+    ISUBPASSINPUT = 542,
+    ISUBPASSINPUTMS = 543,
+    USUBPASSINPUT = 544,
+    USUBPASSINPUTMS = 545,
+    F16SUBPASSINPUT = 546,
+    F16SUBPASSINPUTMS = 547,
+    LEFT_OP = 548,
+    RIGHT_OP = 549,
+    INC_OP = 550,
+    DEC_OP = 551,
+    LE_OP = 552,
+    GE_OP = 553,
+    EQ_OP = 554,
+    NE_OP = 555,
+    AND_OP = 556,
+    OR_OP = 557,
+    XOR_OP = 558,
+    MUL_ASSIGN = 559,
+    DIV_ASSIGN = 560,
+    ADD_ASSIGN = 561,
+    MOD_ASSIGN = 562,
+    LEFT_ASSIGN = 563,
+    RIGHT_ASSIGN = 564,
+    AND_ASSIGN = 565,
+    XOR_ASSIGN = 566,
+    OR_ASSIGN = 567,
+    SUB_ASSIGN = 568,
+    LEFT_PAREN = 569,
+    RIGHT_PAREN = 570,
+    LEFT_BRACKET = 571,
+    RIGHT_BRACKET = 572,
+    LEFT_BRACE = 573,
+    RIGHT_BRACE = 574,
+    DOT = 575,
+    COMMA = 576,
+    COLON = 577,
+    EQUAL = 578,
+    SEMICOLON = 579,
+    BANG = 580,
+    DASH = 581,
+    TILDE = 582,
+    PLUS = 583,
+    STAR = 584,
+    SLASH = 585,
+    PERCENT = 586,
+    LEFT_ANGLE = 587,
+    RIGHT_ANGLE = 588,
+    VERTICAL_BAR = 589,
+    CARET = 590,
+    AMPERSAND = 591,
+    QUESTION = 592,
+    INVARIANT = 593,
+    HIGH_PRECISION = 594,
+    MEDIUM_PRECISION = 595,
+    LOW_PRECISION = 596,
+    PRECISION = 597,
+    PACKED = 598,
+    RESOURCE = 599,
+    SUPERP = 600,
+    FLOATCONSTANT = 601,
+    INTCONSTANT = 602,
+    UINTCONSTANT = 603,
+    BOOLCONSTANT = 604,
+    IDENTIFIER = 605,
+    TYPE_NAME = 606,
+    CENTROID = 607,
+    IN = 608,
+    OUT = 609,
+    INOUT = 610,
+    STRUCT = 611,
+    VOID = 612,
+    WHILE = 613,
+    BREAK = 614,
+    CONTINUE = 615,
+    DO = 616,
+    ELSE = 617,
+    FOR = 618,
+    IF = 619,
+    DISCARD = 620,
+    RETURN = 621,
+    SWITCH = 622,
+    CASE = 623,
+    DEFAULT = 624,
+    UNIFORM = 625,
+    SHARED = 626,
+    FLAT = 627,
+    SMOOTH = 628,
+    LAYOUT = 629,
+    DOUBLECONSTANT = 630,
+    INT16CONSTANT = 631,
+    UINT16CONSTANT = 632,
+    FLOAT16CONSTANT = 633,
+    INT32CONSTANT = 634,
+    UINT32CONSTANT = 635,
+    INT64CONSTANT = 636,
+    UINT64CONSTANT = 637,
+    SUBROUTINE = 638,
+    DEMOTE = 639,
+    PAYLOADNV = 640,
+    PAYLOADINNV = 641,
+    HITATTRNV = 642,
+    CALLDATANV = 643,
+    CALLDATAINNV = 644,
+    PATCH = 645,
+    SAMPLE = 646,
+    BUFFER = 647,
+    NONUNIFORM = 648,
+    COHERENT = 649,
+    VOLATILE = 650,
+    RESTRICT = 651,
+    READONLY = 652,
+    WRITEONLY = 653,
+    DEVICECOHERENT = 654,
+    QUEUEFAMILYCOHERENT = 655,
+    WORKGROUPCOHERENT = 656,
+    SUBGROUPCOHERENT = 657,
+    NONPRIVATE = 658,
+    NOPERSPECTIVE = 659,
+    EXPLICITINTERPAMD = 660,
+    PERVERTEXNV = 661,
+    PERPRIMITIVENV = 662,
+    PERVIEWNV = 663,
+    PERTASKNV = 664,
+    PRECISE = 665
   };
 #endif
 
@@ -495,7 +497,7 @@ union YYSTYPE
         glslang::TArraySizes* typeParameters;
     } interm;
 
-#line 499 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909  */
+#line 501 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909  */
 };
 
 typedef union YYSTYPE YYSTYPE;

+ 1 - 0
3rdparty/glslang/glslang/MachineIndependent/parseVersions.h

@@ -161,6 +161,7 @@ public:
     virtual void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false);
+    virtual void intcoopmatCheck(const TSourceLoc&, const char *op, bool builtIn = false);
     bool relaxedErrors()    const { return (messages & EShMsgRelaxedErrors) != 0; }
     bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
     bool isForwardCompatible() const { return forwardCompatible; }

+ 7 - 4
3rdparty/glslang/glslang/MachineIndependent/reflection.cpp

@@ -556,15 +556,18 @@ public:
                 bool blockParent = (base->getType().getBasicType() == EbtBlock && base->getQualifier().storage == EvqBuffer);
 
                 if (strictArraySuffix && blockParent) {
-                    const TTypeList& typeList = *base->getType().getStruct();
+                    TType structDerefType(base->getType(), 0);
+
+                    const TType &structType = base->getType().isArray() ? structDerefType : base->getType();
+                    const TTypeList& typeList = *structType.getStruct();
 
                     TVector<int> memberOffsets;
 
                     memberOffsets.resize(typeList.size());
-                    getOffsets(base->getType(), memberOffsets);
+                    getOffsets(structType, memberOffsets);
 
                     for (int i = 0; i < (int)typeList.size(); ++i) {
-                        TType derefType(base->getType(), i);
+                        TType derefType(structType, i);
                         TString name = baseName;
                         if (name.size() > 0)
                             name.append(".");
@@ -575,7 +578,7 @@ public:
                         if (derefType.isArray() && derefType.isStruct()) {
                             name.append("[0]");
                             blowUpActiveAggregate(TType(derefType, 0), name, derefs, derefs.end(), memberOffsets[i],
-                                                  blockIndex, 0, getArrayStride(base->getType(), derefType),
+                                                  blockIndex, 0, getArrayStride(structType, derefType),
                                                   base->getQualifier().storage, false);
                         } else {
                             blowUpActiveAggregate(derefType, name, derefs, derefs.end(), memberOffsets[i], blockIndex,

+ 38 - 13
3rdparty/glslang/glslang/Public/ShaderLang.h

@@ -126,36 +126,36 @@ class TType;
 
 typedef enum {
     EShSourceNone,
-    EShSourceGlsl,
-    EShSourceHlsl,
-} EShSource;                  // if EShLanguage were EShStage, this could be EShLanguage instead
+    EShSourceGlsl,               // GLSL, includes ESSL (OpenGL ES GLSL)
+    EShSourceHlsl,               // HLSL
+} EShSource;                     // if EShLanguage were EShStage, this could be EShLanguage instead
 
 typedef enum {
-    EShClientNone,
+    EShClientNone,               // use when there is no client, e.g. for validation
     EShClientVulkan,
     EShClientOpenGL,
 } EShClient;
 
 typedef enum {
     EShTargetNone,
-    EShTargetSpv,                 // preferred spelling
+    EShTargetSpv,                 // SPIR-V (preferred spelling)
     EshTargetSpv = EShTargetSpv,  // legacy spelling
 } EShTargetLanguage;
 
 typedef enum {
-    EShTargetVulkan_1_0 = (1 << 22),
-    EShTargetVulkan_1_1 = (1 << 22) | (1 << 12),
-    EShTargetOpenGL_450 = 450,
+    EShTargetVulkan_1_0 = (1 << 22),                  // Vulkan 1.0
+    EShTargetVulkan_1_1 = (1 << 22) | (1 << 12),      // Vulkan 1.1
+    EShTargetOpenGL_450 = 450,                        // OpenGL
 } EShTargetClientVersion;
 
 typedef EShTargetClientVersion EshTargetClientVersion;
 
 typedef enum {
-    EShTargetSpv_1_0 = (1 << 16),
-    EShTargetSpv_1_1 = (1 << 16) | (1 << 8),
-    EShTargetSpv_1_2 = (1 << 16) | (2 << 8),
-    EShTargetSpv_1_3 = (1 << 16) | (3 << 8),
-    EShTargetSpv_1_4 = (1 << 16) | (4 << 8),
+    EShTargetSpv_1_0 = (1 << 16),                     // SPIR-V 1.0
+    EShTargetSpv_1_1 = (1 << 16) | (1 << 8),          // SPIR-V 1.1
+    EShTargetSpv_1_2 = (1 << 16) | (2 << 8),          // SPIR-V 1.2
+    EShTargetSpv_1_3 = (1 << 16) | (3 << 8),          // SPIR-V 1.3
+    EShTargetSpv_1_4 = (1 << 16) | (4 << 8),          // SPIR-V 1.4
 } EShTargetLanguageVersion;
 
 struct TInputLanguage {
@@ -444,6 +444,30 @@ public:
     // These must be called so that parsing is done for the right source language and
     // target environment, either indirectly through TranslateEnvironment() based on
     // EShMessages et. al., or directly by the user.
+    //
+    // setEnvInput:    The input source language and stage. If generating code for a
+    //                 specific client, the input client semantics to use and the
+    //                 version of the that client's input semantics to use, otherwise
+    //                 use EShClientNone and version of 0, e.g. for validation mode.
+    //                 Note 'version' does not describe the target environment,
+    //                 just the version of the source dialect to compile under.
+    //
+    //                 See the definitions of TEnvironment, EShSource, EShLanguage,
+    //                 and EShClient for choices and more detail.
+    //
+    // setEnvClient:   The client that will be hosting the execution, and it's version.
+    //                 Note 'version' is not the version of the languages involved, but
+    //                 the version of the client environment.
+    //                 Use EShClientNone and version of 0 if there is no client, e.g.
+    //                 for validation mode.
+    //
+    //                 See EShTargetClientVersion for choices.
+    //
+    // setEnvTarget:   The language to translate to when generating code, and that
+    //                 language's version.
+    //                 Use EShTargetNone and version of 0 if there is no client, e.g.
+    //                 for validation mode.
+    //
     void setEnvInput(EShSource lang, EShLanguage envStage, EShClient client, int version)
     {
         environment.input.languageFamily = lang;
@@ -461,6 +485,7 @@ public:
         environment.target.language = lang;
         environment.target.version = version;
     }
+
 #ifdef ENABLE_HLSL
     void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
     bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }

+ 1 - 0
3rdparty/glslang/gtests/Spv.FromFile.cpp

@@ -325,6 +325,7 @@ INSTANTIATE_TEST_CASE_P(
         "spv.GeometryShaderPassthrough.geom",
         "spv.interpOps.frag",
         "spv.int64.frag",
+        "spv.intcoopmat.comp",
         "spv.intOps.vert",
         "spv.layoutNested.vert",
         "spv.length.frag",

Some files were not shown because too many files changed in this diff