diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-04-27 14:31:34 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-27 14:31:34 -0600 |
| commit | 8f6c6e333c06ae1c3b9f00396563c14a2ae09b4d (patch) | |
| tree | ca752d05329a697f46d7e047d7e7c1c5de9fdb7e /source/slang/slang-emit-glsl.cpp | |
| parent | a5efbb1b775afb2f6b29b37d39947c41744bb005 (diff) | |
Emit SPIRV NonReadable decoration for WTexture* (#6922)
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
| -rw-r--r-- | source/slang/slang-emit-glsl.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index 848d9c08d..5e9fa7f70 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -1837,8 +1837,9 @@ bool GLSLSourceEmitter::tryEmitGlobalParamImpl(IRGlobalParam* varDecl, IRType* v void GLSLSourceEmitter::emitImageFormatModifierImpl(IRInst* varDecl, IRType* varType) { - // As a special case, if we are emitting a GLSL declaration - // for an HLSL `RWTexture*` then we need to emit a `format` layout qualifier. + // Special cases when emitting a GLSL declaration for HLSL/Slang `RWTexture* and `WTexture*`: + // - Emit a `format` layout qualifier. + // - Emit `writeonly` memory qualifier for `WTexture*`. if (auto resourceType = as<IRTextureType>(unwrapArray(varType))) { @@ -1855,6 +1856,11 @@ void GLSLSourceEmitter::emitImageFormatModifierImpl(IRInst* varDecl, IRType* var default: break; } + + if (resourceType->getAccess() == SLANG_RESOURCE_ACCESS_WRITE) + { + m_writer->emit("writeonly\n"); + } } } |
