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-lower-to-ir.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-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index a622c9802..cec2bd988 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -6338,7 +6338,48 @@ static void lowerFrontEndEntryPointToIR( { instToDecorate = findGenericReturnVal(irGeneric); } - builder->addEntryPointDecoration(instToDecorate); + builder->addEntryPointDecoration(instToDecorate, entryPoint->getProfile()); + + // Go through the entry point parameters creating decorations from layout as appropriate + { + FilteredMemberList<ParamDecl> params = entryPointFuncDecl->GetParameters(); + + IRGlobalValueWithParams* valueWithParams = as<IRGlobalValueWithParams>(instToDecorate); + if (valueWithParams) + { + IRParam* irParam = valueWithParams->getFirstParam(); + + for (auto param : params) + { + if (auto modifier = param->FindModifier<HLSLGeometryShaderInputPrimitiveTypeModifier>()) + { + IROp op = kIROp_Invalid; + + if (as<HLSLTriangleModifier>(modifier)) + op = kIROp_TrianglePrimitiveTypeDecoration; + else if (as<HLSLPointModifier>(modifier)) + op = kIROp_PointPrimitiveTypeDecoration; + else if (as<HLSLLineModifier>(modifier)) + op = kIROp_LinePrimitiveTypeDecoration; + else if (as<HLSLLineAdjModifier>(modifier)) + op = kIROp_LineAdjPrimitiveTypeDecoration; + else if (as<HLSLTriangleAdjModifier>(modifier)) + op = kIROp_TriangleAdjPrimitiveTypeDecoration; + + if (op != kIROp_Invalid) + { + builder->addDecoration(irParam, op); + } + else + { + SLANG_UNEXPECTED("unhandled primitive type"); + } + } + + irParam = irParam->getNextParam(); + } + } + } } static void lowerProgramEntryPointToIR( |
