summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-10-04 10:25:36 -0400
committerGitHub <noreply@github.com>2018-10-04 10:25:36 -0400
commit84a48475067af70c9acccc9816dd60e623714328 (patch)
treeecb4fbc2932a3a5771a0240af367c7712f5fc620 /source
parenteaafafe772366a23ed847cbb10770c72aa5cfc28 (diff)
Remove need of IRHightLevelDecoration in emit (#660)
* * Remove the need for IRHighLevelDecoration in Emit * Use the IRLayoutDecoration for GeometryShaderPrimitiveTypeModifier * Fixing problems with comparison due to naming differences with slang/fxc.
Diffstat (limited to 'source')
-rw-r--r--source/slang/emit.cpp42
1 files changed, 28 insertions, 14 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 1b527c01f..521a9fe1f 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -4654,36 +4654,50 @@ struct EmitVisitor
emitIREntryPointAttributes(func, ctx, entryPointLayout);
}
+ const CodeGenTarget target = ctx->shared->target;
+
auto name = getIRFuncName(func);
EmitType(resultType, name);
emit("(");
auto firstParam = func->getFirstParam();
- for( auto pp = firstParam; pp; pp = pp->getNextParam() )
+ for( auto pp = firstParam; pp; pp = pp->getNextParam())
{
if(pp != firstParam)
emit(", ");
auto paramName = getIRName(pp);
auto paramType = pp->getDataType();
- if (auto decor = pp->findDecoration<IRHighLevelDeclDecoration>())
+
+ if (target == CodeGenTarget::HLSL)
{
- if (decor->decl)
+ if (auto layoutDecor = pp->findDecoration<IRLayoutDecoration>())
{
- auto primType = decor->decl->FindModifier<HLSLGeometryShaderInputPrimitiveTypeModifier>();
- if (dynamic_cast<HLSLTriangleModifier*>(primType))
- emit("triangle ");
- else if (dynamic_cast<HLSLPointModifier*>(primType))
- emit("point ");
- else if (dynamic_cast<HLSLLineModifier*>(primType))
- emit("line ");
- else if (dynamic_cast<HLSLLineAdjModifier*>(primType))
- emit("lineadj ");
- else if (dynamic_cast<HLSLTriangleAdjModifier*>(primType))
- emit("triangleadj ");
+ Layout* layout = layoutDecor->layout;
+ VarLayout* varLayout = dynamic_cast<VarLayout*>(layout);
+
+ if (varLayout)
+ {
+ auto var = varLayout->getVariable();
+
+ if (auto primTypeModifier = var->FindModifier<HLSLGeometryShaderInputPrimitiveTypeModifier>())
+ {
+ if (dynamic_cast<HLSLTriangleModifier*>(primTypeModifier))
+ emit("triangle ");
+ else if (dynamic_cast<HLSLPointModifier*>(primTypeModifier))
+ emit("point ");
+ else if (dynamic_cast<HLSLLineModifier*>(primTypeModifier))
+ emit("line ");
+ else if (dynamic_cast<HLSLLineAdjModifier*>(primTypeModifier))
+ emit("lineadj ");
+ else if (dynamic_cast<HLSLTriangleAdjModifier*>(primTypeModifier))
+ emit("triangleadj ");
+ }
+ }
}
}
+
emitIRParamType(ctx, paramType, paramName);
emitIRSemantics(ctx, pp);