summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-glsl.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-08-30 12:03:23 -0700
committerGitHub <noreply@github.com>2024-08-30 12:03:23 -0700
commitde83628070614ec37349c9f334ed72a54a6889da (patch)
treebc97f74013a073fc958b75e68089696e14d71412 /source/slang/slang-emit-glsl.cpp
parentf428a058ea48535a323c32d206ebc7e551c3c3e9 (diff)
Support specialization constants. (#4963)
* Support specialization constants. * Fix. * Fix. * Fix. * Fix. * Make sure specialization constants have names. * Clean up and support the dxc [vk::constant_id] syntax. * Fix. * Fix. * Fix.
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
-rw-r--r--source/slang/slang-emit-glsl.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 902030791..fff1cddbe 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -385,6 +385,15 @@ void GLSLSourceEmitter::_emitGLSLSSBO(IRGlobalParam* varDecl, IRGLSLShaderStorag
m_writer->emit(";\n");
}
+void GLSLSourceEmitter::emitGlobalParamDefaultVal(IRGlobalParam* param)
+{
+ if (auto defaultValDecor = param->findDecoration<IRDefaultValueDecoration>())
+ {
+ m_writer->emit(" = ");
+ emitInstExpr(defaultValDecor->getOperand(0), EmitOpInfo());
+ }
+}
+
void GLSLSourceEmitter::_emitGLSLParameterGroup(IRGlobalParam* varDecl, IRUniformParameterGroupType* type)
{
auto varLayout = getVarLayout(varDecl);
@@ -418,6 +427,8 @@ void GLSLSourceEmitter::_emitGLSLParameterGroup(IRGlobalParam* varDecl, IRUnifor
}
_emitGLSLLayoutQualifier(LayoutResourceKind::PushConstantBuffer, &containerChain);
+ _emitGLSLLayoutQualifier(LayoutResourceKind::SpecializationConstant, &containerChain);
+
bool isShaderRecord = _emitGLSLLayoutQualifier(LayoutResourceKind::ShaderRecord, &containerChain);
if (isShaderRecord)