From 14b85d3ff35922c927749caa6cd82a07ca5049bf Mon Sep 17 00:00:00 2001
From: John Kessenich <cepheus@frii.com>
Date: Mon, 4 Jun 2018 15:36:03 -0600
Subject: [PATCH] Fix #1395: GLSL volatile maps to SPIR-V Volatile and
 Coherent.

The major version number was bumped in the previous commit to support
this.
---
 SPIRV/GlslangToSpv.cpp                        | 4 +++-
 Test/baseResults/spv.memoryQualifier.frag.out | 2 ++
 glslang/Include/revision.h                    | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 749d01334..6d8910938 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -340,8 +340,10 @@ void TranslateMemoryDecoration(const glslang::TQualifier& qualifier, std::vector
 {
     if (qualifier.coherent)
         memory.push_back(spv::DecorationCoherent);
-    if (qualifier.volatil)
+    if (qualifier.volatil) {
         memory.push_back(spv::DecorationVolatile);
+        memory.push_back(spv::DecorationCoherent);
+    }
     if (qualifier.restrict)
         memory.push_back(spv::DecorationRestrict);
     if (qualifier.readonly)
diff --git a/Test/baseResults/spv.memoryQualifier.frag.out b/Test/baseResults/spv.memoryQualifier.frag.out
index d6ae535cb..02783b983 100644
--- a/Test/baseResults/spv.memoryQualifier.frag.out
+++ b/Test/baseResults/spv.memoryQualifier.frag.out
@@ -35,6 +35,7 @@ spv.memoryQualifier.frag
                               Decorate 19(i2D) DescriptorSet 0
                               Decorate 19(i2D) Binding 1
                               Decorate 19(i2D) Volatile
+                              Decorate 19(i2D) Coherent
                               Decorate 28(i2DRect) DescriptorSet 0
                               Decorate 28(i2DRect) Binding 2
                               Decorate 28(i2DRect) Restrict
@@ -48,6 +49,7 @@ spv.memoryQualifier.frag
                               MemberDecorate 49(Data) 1 Offset 8
                               MemberDecorate 50(Buffer) 0 Coherent
                               MemberDecorate 50(Buffer) 0 Volatile
+                              MemberDecorate 50(Buffer) 0 Coherent
                               MemberDecorate 50(Buffer) 0 Offset 0
                               MemberDecorate 50(Buffer) 1 Coherent
                               MemberDecorate 50(Buffer) 1 Restrict
diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h
index 13807bc6c..d18126d00 100644
--- a/glslang/Include/revision.h
+++ b/glslang/Include/revision.h
@@ -1,3 +1,3 @@
 // This header is generated by the make-revision script.
 
-#define GLSLANG_PATCH_LEVEL 2764
+#define GLSLANG_PATCH_LEVEL 2765
-- 
GitLab