Browse Source

Updated glslang.

Branimir Karadžić 7 years ago
parent
commit
36942f50b7

+ 1 - 0
3rdparty/glslang/CODE_OF_CONDUCT.md

@@ -0,0 +1 @@
+A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil.

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

@@ -554,11 +554,11 @@ spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCohere
     flags.subgroupcoherent = type.getQualifier().subgroupcoherent;
     // *coherent variables are implicitly nonprivate in GLSL
     flags.nonprivate = type.getQualifier().nonprivate ||
-                       type.getQualifier().subgroupcoherent ||
-                       type.getQualifier().workgroupcoherent ||
-                       type.getQualifier().queuefamilycoherent ||
-                       type.getQualifier().devicecoherent ||
-                       type.getQualifier().coherent;
+                       flags.subgroupcoherent ||
+                       flags.workgroupcoherent ||
+                       flags.queuefamilycoherent ||
+                       flags.devicecoherent ||
+                       flags.coherent;
     flags.volatil = type.getQualifier().volatil;
     flags.isImage = type.getBasicType() == glslang::EbtSampler;
     return flags;

+ 58 - 31
3rdparty/glslang/Test/baseResults/spv.image.frag.out

@@ -5,7 +5,7 @@ error: Capability ImageRect is not allowed by Vulkan 1.0 specification (or requi
 
 // Module Version 10000
 // Generated by (magic number): 80007
-// Id's are bound by 376
+// Id's are bound by 395
 
                               Capability Shader
                               Capability StorageImageMultisample
@@ -19,7 +19,7 @@ error: Capability ImageRect is not allowed by Vulkan 1.0 specification (or requi
                               Capability StorageImageWriteWithoutFormat
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 132 142 152 248 362 375
+                              EntryPoint Fragment 4  "main" 132 142 152 248 381 394
                               ExecutionMode 4 OriginUpperLeft
                               Source GLSL 450
                               Name 4  "main"
@@ -43,9 +43,11 @@ error: Capability ImageRect is not allowed by Vulkan 1.0 specification (or requi
                               Name 232  "ii1D"
                               Name 245  "ui2D"
                               Name 248  "value"
-                              Name 357  "wo2D"
-                              Name 362  "fragData"
-                              Name 375  "ic4D"
+                              Name 357  "ii2DMS"
+                              Name 367  "ui2DMSArray"
+                              Name 376  "wo2D"
+                              Name 381  "fragData"
+                              Name 394  "ic4D"
                               Decorate 15(i1D) DescriptorSet 0
                               Decorate 15(i1D) Binding 0
                               Decorate 27(i2D) DescriptorSet 0
@@ -76,10 +78,14 @@ error: Capability ImageRect is not allowed by Vulkan 1.0 specification (or requi
                               Decorate 245(ui2D) DescriptorSet 0
                               Decorate 245(ui2D) Binding 12
                               Decorate 248(value) Flat
-                              Decorate 357(wo2D) DescriptorSet 0
-                              Decorate 357(wo2D) Binding 1
-                              Decorate 357(wo2D) NonReadable
-                              Decorate 375(ic4D) Flat
+                              Decorate 357(ii2DMS) DescriptorSet 0
+                              Decorate 357(ii2DMS) Binding 13
+                              Decorate 367(ui2DMSArray) DescriptorSet 0
+                              Decorate 367(ui2DMSArray) Binding 14
+                              Decorate 376(wo2D) DescriptorSet 0
+                              Decorate 376(wo2D) Binding 1
+                              Decorate 376(wo2D) NonReadable
+                              Decorate 394(ic4D) Flat
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
@@ -161,16 +167,22 @@ error: Capability ImageRect is not allowed by Vulkan 1.0 specification (or requi
              340:      6(int) Constant 18
              341:      6(int) Constant 17
              349:     18(int) Constant 19
-             355:             TypeImage 12(float) 2D nonsampled format:Unknown
+             355:             TypeImage 6(int) 2D multi-sampled nonsampled format:R32i
              356:             TypePointer UniformConstant 355
-       357(wo2D):    356(ptr) Variable UniformConstant
-             361:             TypePointer Output 125(fvec4)
-   362(fragData):    361(ptr) Variable Output
-             367:             TypeBool
-             370:             TypeVector 367(bool) 4
-             373:             TypeVector 6(int) 4
-             374:             TypePointer Input 373(ivec4)
-       375(ic4D):    374(ptr) Variable Input
+     357(ii2DMS):    356(ptr) Variable UniformConstant
+             365:             TypeImage 18(int) 2D array multi-sampled nonsampled format:R32ui
+             366:             TypePointer UniformConstant 365
+367(ui2DMSArray):    366(ptr) Variable UniformConstant
+             374:             TypeImage 12(float) 2D nonsampled format:Unknown
+             375:             TypePointer UniformConstant 374
+       376(wo2D):    375(ptr) Variable UniformConstant
+             380:             TypePointer Output 125(fvec4)
+   381(fragData):    380(ptr) Variable Output
+             386:             TypeBool
+             389:             TypeVector 386(bool) 4
+             392:             TypeVector 6(int) 4
+             393:             TypePointer Input 392(ivec4)
+       394(ic4D):    393(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
            9(iv):      8(ptr) Variable Function
@@ -497,18 +509,33 @@ error: Capability ImageRect is not allowed by Vulkan 1.0 specification (or requi
              353:     18(int) Load 229(ui)
              354:     18(int) IAdd 353 352
                               Store 229(ui) 354
-             358:         355 Load 357(wo2D)
-             359:   29(ivec2) Load 142(ic2D)
-             360:  125(fvec4) Load 127(v)
-                              ImageWrite 358 359 360
-             363:     18(int) Load 229(ui)
-             364:     20(ptr) AccessChain 9(iv) 237
-             365:      6(int) Load 364
-             366:     18(int) Bitcast 365
-             368:   367(bool) INotEqual 363 366
-             369:  125(fvec4) Load 127(v)
-             371:  370(bvec4) CompositeConstruct 368 368 368 368
-             372:  125(fvec4) Select 371 369 129
-                              Store 362(fragData) 372
+             358:   29(ivec2) Load 142(ic2D)
+             359:    235(ptr) ImageTexelPointer 357(ii2DMS) 358 216
+             360:      6(int) AtomicCompareExchange 359 237 19 19 341 340
+             361:     20(ptr) AccessChain 9(iv) 19
+             362:      6(int) Load 361
+             363:      6(int) IAdd 362 360
+             364:     20(ptr) AccessChain 9(iv) 19
+                              Store 364 363
+             368:    7(ivec3) Load 152(ic3D)
+             369:     18(int) Load 248(value)
+             370:    250(ptr) ImageTexelPointer 367(ui2DMSArray) 368 220
+             371:     18(int) AtomicCompareExchange 370 237 19 19 369 349
+             372:     18(int) Load 229(ui)
+             373:     18(int) IAdd 372 371
+                              Store 229(ui) 373
+             377:         374 Load 376(wo2D)
+             378:   29(ivec2) Load 142(ic2D)
+             379:  125(fvec4) Load 127(v)
+                              ImageWrite 377 378 379
+             382:     18(int) Load 229(ui)
+             383:     20(ptr) AccessChain 9(iv) 237
+             384:      6(int) Load 383
+             385:     18(int) Bitcast 384
+             387:   386(bool) INotEqual 382 385
+             388:  125(fvec4) Load 127(v)
+             390:  389(bvec4) CompositeConstruct 387 387 387 387
+             391:  125(fvec4) Select 390 388 129
+                              Store 381(fragData) 391
                               Return
                               FunctionEnd

+ 6 - 6
3rdparty/glslang/Test/baseResults/spv.memoryScopeSemantics.comp.out

@@ -158,12 +158,12 @@ spv.memoryScopeSemantics.comp
            72(y):     20(ptr) Variable Function
               19:      6(int) AtomicIAdd 10(atomi) 12 18 11
                               Store 8(origi) 19
-              25:     15(int) Load 24(value) MakePointerVisibleKHR 26
+              25:     15(int) Load 24(value) MakePointerVisibleKHR NonPrivatePointerKHR 26
               27:     15(int) AtomicAnd 23(atomu) 16 17 25
                               Store 21(origu) 27
               31:      6(int) AtomicLoad 10(atomi) 12 30
                               Store 8(origi) 31
-              32:     15(int) Load 24(value) MakePointerVisibleKHR 26
+              32:     15(int) Load 24(value) MakePointerVisibleKHR NonPrivatePointerKHR 26
                               AtomicStore 23(atomu) 12 33 32
               41:     40(ptr) ImageTexelPointer 36(imagei) 39 17
               42:      6(int) AtomicLoad 41 12 30
@@ -177,7 +177,7 @@ spv.memoryScopeSemantics.comp
                               Store 21(origu) 53
               54:     15(int) AtomicXor 23(atomu) 12 17 52
                               Store 21(origu) 54
-              55:     15(int) Load 24(value) MakePointerVisibleKHR 26
+              55:     15(int) Load 24(value) MakePointerVisibleKHR NonPrivatePointerKHR 26
               56:     15(int) AtomicUMin 23(atomu) 12 17 55
                               Store 21(origu) 56
               58:      6(int) AtomicSMax 10(atomi) 12 17 57
@@ -185,7 +185,7 @@ spv.memoryScopeSemantics.comp
               59:      6(int) Load 8(origi)
               60:      6(int) AtomicExchange 10(atomi) 12 17 59
                               Store 8(origi) 60
-              62:     15(int) Load 24(value) MakePointerVisibleKHR 26
+              62:     15(int) Load 24(value) MakePointerVisibleKHR NonPrivatePointerKHR 26
               64:     15(int) AtomicCompareExchange 23(atomu) 12 63 63 62 61
                               Store 21(origu) 64
               69:     68(ptr) AccessChain 67(bufferu) 38
@@ -231,8 +231,8 @@ spv.memoryScopeSemantics.comp
              124:         118 Load 123
              129:  128(fvec4) ImageSampleExplicitLod 124 127 Lod NonPrivateTexelKHR 126
              134:130(int64_t) AtomicUMax 132(atomu64) 12 17 133
-                              Store 132(atomu64) 134 MakePointerAvailableKHR 26
-             139:130(int64_t) Load 132(atomu64) MakePointerVisibleKHR 26
+                              Store 132(atomu64) 134 MakePointerAvailableKHR NonPrivatePointerKHR 26
+             139:130(int64_t) Load 132(atomu64) MakePointerVisibleKHR NonPrivatePointerKHR 26
              140:135(int64_t) Bitcast 139
              141:135(int64_t) AtomicCompareExchange 137(atomi64) 12 63 63 140 138
                               Return

+ 4 - 0
3rdparty/glslang/Test/spv.image.frag

@@ -14,6 +14,8 @@ layout(rgba32f, binding = 10)   uniform image2DMSArray  i2DMSArray;
 
 layout(r32i,    binding = 11)   uniform iimage1D        ii1D;
 layout(r32ui,   binding = 12)   uniform uimage2D        ui2D;
+layout(r32i,    binding = 13)   uniform iimage2DMS      ii2DMS;
+layout(r32ui,   binding = 14)   uniform uimage2DMSArray ui2DMSArray;
 
 flat in int     ic1D;
 flat in ivec2   ic2D;
@@ -85,6 +87,8 @@ void main()
     ui      += imageAtomicExchange(ui2D, ic2D, value);
     iv.x    += imageAtomicCompSwap(ii1D, ic1D, 18, 17);
     ui      += imageAtomicCompSwap(ui2D, ic2D, 19u, value);
+    iv.x    += imageAtomicCompSwap(ii2DMS, ic2D, 2, 18, 17);
+    ui      += imageAtomicCompSwap(ui2DMSArray, ic3D, 3, 19u, value);
 
     imageStore(wo2D, ic2D, v);
 

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

@@ -1897,7 +1897,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
                 error(loc, "only supported on image with format r32f", fnCandidate.getName().c_str(), "");
         }
 
-        if (argp->size() > 4) {
+        const size_t maxArgs = imageType.getSampler().isMultiSample() ? 5 : 4;
+        if (argp->size() > maxArgs) {
             requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str());
             memorySemanticsCheck(loc, fnCandidate, callNode);
         }