diff options
| author | Yong He <yonghe@outlook.com> | 2024-08-30 12:03:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-30 12:03:23 -0700 |
| commit | de83628070614ec37349c9f334ed72a54a6889da (patch) | |
| tree | bc97f74013a073fc958b75e68089696e14d71412 /source/slang/slang-emit-glsl.cpp | |
| parent | f428a058ea48535a323c32d206ebc7e551c3c3e9 (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.cpp | 11 |
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) |
