diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-10-08 08:37:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-08 08:37:53 -0400 |
| commit | dc1e735bbc6a35d4a1d5c1ec720a7a95c0555f49 (patch) | |
| tree | 7020737abd74ccfcb6d24e1f294b3193867b3042 /source/slang/slang-emit-hlsl.cpp | |
| parent | 7c8527d20e433c3a10736136d31e4cd882a3baaa (diff) | |
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).
Diffstat (limited to 'source/slang/slang-emit-hlsl.cpp')
| -rw-r--r-- | source/slang/slang-emit-hlsl.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
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<IREntryPointDecoration>(); + 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<IRLayoutDecoration>()) + if (auto decor = param->findDecoration<IRGeometryPrimitiveTypeDecoration>()) { - Layout* layout = layoutDecor->getLayout(); - VarLayout* varLayout = as<VarLayout>(layout); - - if (varLayout) + switch (decor->op) { - auto var = varLayout->getVariable(); - - if (auto primTypeModifier = var->FindModifier<HLSLGeometryShaderInputPrimitiveTypeModifier>()) - { - if (as<HLSLTriangleModifier>(primTypeModifier)) - m_writer->emit("triangle "); - else if (as<HLSLPointModifier>(primTypeModifier)) - m_writer->emit("point "); - else if (as<HLSLLineModifier>(primTypeModifier)) - m_writer->emit("line "); - else if (as<HLSLLineAdjModifier>(primTypeModifier)) - m_writer->emit("lineadj "); - else if (as<HLSLTriangleAdjModifier>(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; } } |
