summaryrefslogtreecommitdiff
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-10-23 10:44:08 -0400
committerYong He <yonghe@outlook.com>2017-10-23 10:44:08 -0400
commit4d6be3588ac5b5b62e19900b12de90ce1e1ff744 (patch)
tree43fb004d9283849c670dfd869d75b8f621036b9e /source/slang/emit.cpp
parentcc6184ebc4d0611be892eaff119de99f8b9e1ca6 (diff)
parent624d122a3a110922cd54aab7bbf13f1cac8fbbff (diff)
Merge https://github.com/shader-slang/slang
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index da9489a75..f76ab1db1 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -5091,6 +5091,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 )
{