diff options
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 971f0345b..1b5db065f 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -5090,6 +5090,37 @@ emitDeclImpl(decl, nullptr); EmitContext* context, IRValue* inst) { + // Don't emit semantics if we aren't translating down to HLSL + switch (context->shared->target) + { + case CodeGenTarget::HLSL: + break; + + default: + return; + } + + if(auto layoutDecoration = inst->findDecoration<IRLayoutDecoration>()) + { + if(auto varLayout = layoutDecoration->layout.As<VarLayout>()) + { + if(varLayout->flags & VarLayoutFlag::HasSemantic) + { + Emit(" : "); + emit(varLayout->semanticName); + if(varLayout->semanticIndex) + { + Emit(varLayout->semanticIndex); + } + + return; + } + } + } + + // TODO(tfoley): should we ever need to use the high-level declaration + // for this? It seems like the wrong approach... + auto decoration = inst->findDecoration<IRHighLevelDeclDecoration>(); if( decoration ) { |
