From e7b6de334f320429462a0257e2191ccf3cbc9a0d Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 24 Jan 2024 15:36:49 -0800 Subject: [SPIRV] Support `globallycoherent` and `[vk::index()]`. (#3488) * [SPIRV] Support `globallycoherent` modifier. * Fix. * Disable executable cooperative vector tests. * Update expected failure. * [SPIRV] Emit varying output index decoration. * Add test. * Update tests. * Fix test. * Emit `SpvExecutionModeEarlyFragmentTests`. * Lower `StructuredBuffer`. * Support globallycoherent on ByteAddressBuffer. --------- Co-authored-by: Yong He --- source/slang/slang-emit-glsl.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/slang/slang-emit-glsl.cpp') diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index bff82acf3..0fc0c855a 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -179,7 +179,7 @@ void GLSLSourceEmitter::_emitGLSLStructuredBuffer(IRGlobalParam* varDecl, IRHLSL m_writer->emit(space); } } - + m_writer->emit(") "); /* @@ -194,7 +194,10 @@ 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 */ - + if (varDecl->findDecoration()) + { + m_writer->emit("coherent "); + } if (as(structuredBufferType)) { m_writer->emit("readonly "); @@ -264,9 +267,13 @@ void GLSLSourceEmitter::_emitGLSLByteAddressBuffer(IRGlobalParam* varDecl, IRByt m_writer->emit(space); } } - m_writer->emit(") "); + if (varDecl->findDecoration()) + { + m_writer->emit("coherent "); + } + /* If the output type is a buffer, and we can determine it is only readonly we can prefix before buffer with 'readonly' -- cgit v1.2.3