diff options
| author | Yong He <yonghe@outlook.com> | 2022-02-28 18:09:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-28 18:09:27 -0800 |
| commit | e6c9625e0f0d5d9703451fd2ebb8b206d210009c (patch) | |
| tree | ad2c46f5e9a5f7a6e67cacf5b7227d726f392088 /source/slang/slang-emit-glsl.cpp | |
| parent | c31577953d5041c82375c22d847c2eba06106c58 (diff) | |
Use GLSL scalar layout for constant buffers. (#2147)
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
| -rw-r--r-- | source/slang/slang-emit-glsl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index 44326a18e..044f93569 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -290,14 +290,18 @@ void GLSLSourceEmitter::_emitGLSLParameterGroup(IRGlobalParam* varDecl, IRUnifor } else if (as<IRGLSLShaderStorageBufferType>(type)) { - // Is writable - m_writer->emit("layout(std430) buffer "); + // Is writable + m_writer->emit("layout("); + m_writer->emit(m_targetRequest->getForceGLSLScalarBufferLayout() ? "scalar" : "std430"); + m_writer->emit(") buffer "); } // TODO: what to do with HLSL `tbuffer` style buffers? else { // uniform is implicitly read only - m_writer->emit("layout(std140) uniform "); + m_writer->emit("layout("); + m_writer->emit(m_targetRequest->getForceGLSLScalarBufferLayout() ? "scalar" : "std140"); + m_writer->emit(") uniform "); } // Generate a dummy name for the block |
