summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-08-13 00:04:15 -0400
committerGitHub <noreply@github.com>2024-08-12 21:04:15 -0700
commit127f0c5848f405f9d4f4b1f7f27006c26db748ed (patch)
tree143c10877887fd157bdf6e52b722e176cf0cbb5e
parentb390566b55700582321b09b72c726b8dff9bd819 (diff)
Emit memory qualifier once for GLSL targets (#4819)
Fixes #4818 Emit memory qualifier once for GLSL targets. Co-authored-by: Yong He <yonghe@outlook.com>
-rw-r--r--source/slang/slang-emit-glsl.cpp1
-rw-r--r--tests/bugs/gh-4818-1.slang11
-rw-r--r--tests/bugs/gh-4818-2.slang11
3 files changed, 22 insertions, 1 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 0fb868342..86ad0be6e 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -228,7 +228,6 @@ void GLSLSourceEmitter::_emitGLSLStructuredBuffer(IRGlobalParam* varDecl, IRHLSL
HLSLAppendStructuredBufferType - Write
HLSLConsumeStructuredBufferType - TODO (JS): Its possible that this can be readonly, but we currently don't support on GLSL
*/
- _emitMemoryQualifierDecorations(varDecl);
if (as<IRHLSLStructuredBufferType>(structuredBufferType))
{
m_writer->emit("readonly ");
diff --git a/tests/bugs/gh-4818-1.slang b/tests/bugs/gh-4818-1.slang
new file mode 100644
index 000000000..4832bb5fd
--- /dev/null
+++ b/tests/bugs/gh-4818-1.slang
@@ -0,0 +1,11 @@
+//TEST:SIMPLE(filecheck=CHECK): -target glsl -entry computeMain -stage compute
+
+// CHECK: coherent
+// CHECK-NOT: coherent
+
+globallycoherent RWByteAddressBuffer bab;
+RWStructuredBuffer<uint> output;
+void computeMain()
+{
+ output[0] = bab.Load<uint>(0);
+} \ No newline at end of file
diff --git a/tests/bugs/gh-4818-2.slang b/tests/bugs/gh-4818-2.slang
new file mode 100644
index 000000000..e2a582434
--- /dev/null
+++ b/tests/bugs/gh-4818-2.slang
@@ -0,0 +1,11 @@
+//TEST:SIMPLE(filecheck=CHECK): -target glsl -entry computeMain -stage compute
+
+// CHECK: coherent
+// CHECK-NOT: coherent
+
+globallycoherent StructuredBuffer<uint> sb;
+RWStructuredBuffer<uint> output;
+void computeMain()
+{
+ output[0] = sb.Load(0);
+} \ No newline at end of file