From dc1e735bbc6a35d4a1d5c1ec720a7a95c0555f49 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 8 Oct 2019 08:37:53 -0400 Subject: Feature/ir entry point profile (#1068) * Split out EntryPointParamDecoration. * Add profile to EntryPointDecoration. * WIP for GS handling for GLSL. * WIP for StreamOut GLSL * Fixed GLSL geometry output. * Clean up - remove unneeded/commented out code from the entry point change. * Use Op nums to identify GeometryTypeDecorations (as opposed to contained enum). --- source/slang/slang-emit-hlsl.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'source/slang/slang-emit-hlsl.cpp') diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp index a5c4ae088..0ce3a682d 100644 --- a/source/slang/slang-emit-hlsl.cpp +++ b/source/slang/slang-emit-hlsl.cpp @@ -222,8 +222,13 @@ void HLSLSourceEmitter::_emitHLSLParameterGroup(IRGlobalParam* varDecl, IRUnifor void HLSLSourceEmitter::_emitHLSLEntryPointAttributes(IRFunc* irFunc, EntryPointLayout* entryPointLayout) { + SLANG_UNUSED(entryPointLayout); + + IREntryPointDecoration* entryPointDecor = irFunc->findDecoration(); + SLANG_ASSERT(entryPointDecor); + auto profile = m_effectiveProfile; - auto stage = entryPointLayout->profile.GetStage(); + auto stage = entryPointDecor->getProfile().GetStage(); if (profile.getFamily() == ProfileFamily::DX) { @@ -668,28 +673,16 @@ void HLSLSourceEmitter::emitSemanticsImpl(IRInst* inst) void HLSLSourceEmitter::emitSimpleFuncParamImpl(IRParam* param) { - if (auto layoutDecor = param->findDecoration()) + if (auto decor = param->findDecoration()) { - Layout* layout = layoutDecor->getLayout(); - VarLayout* varLayout = as(layout); - - if (varLayout) + switch (decor->op) { - auto var = varLayout->getVariable(); - - if (auto primTypeModifier = var->FindModifier()) - { - if (as(primTypeModifier)) - m_writer->emit("triangle "); - else if (as(primTypeModifier)) - m_writer->emit("point "); - else if (as(primTypeModifier)) - m_writer->emit("line "); - else if (as(primTypeModifier)) - m_writer->emit("lineadj "); - else if (as(primTypeModifier)) - m_writer->emit("triangleadj "); - } + case kIROp_TrianglePrimitiveTypeDecoration: m_writer->emit("triangle "); break; + case kIROp_PointPrimitiveTypeDecoration: m_writer->emit("point "); break; + case kIROp_LinePrimitiveTypeDecoration: m_writer->emit("line "); break; + case kIROp_LineAdjPrimitiveTypeDecoration: m_writer->emit("lineadj "); break; + case kIROp_TriangleAdjPrimitiveTypeDecoration: m_writer->emit("triangleadj "); break; + default: SLANG_ASSERT(!"Unknown primitive type"); break; } } -- cgit v1.2.3