diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-10-08 14:29:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-08 14:29:15 -0400 |
| commit | 0b61643bf82e2dd44317f6ff83b1a088e337610f (patch) | |
| tree | 17ba46b9c42fdea9f9ac380215c51cc40740b0b5 | |
| parent | c61d529d9aec30dd80e0e915cfad01d42be7e153 (diff) | |
Fixed from Review of Entry Point decoration #1068 (#1072)
* Remove typo around GeometryPrimitiveTypeDecoration
* * GeometryPrimitiveTypeDecoration -> GeometryInputPrimitiveTypeDecoration (to try and closer match meaning and the Modifier name)
* Remove a small problem around definition of IRGeometryPrimitiveTypeDecoration
* Fix comment around IRStreamOutputTypeDecoration
| -rw-r--r-- | source/slang/slang-emit-glsl.cpp | 12 | ||||
| -rw-r--r-- | source/slang/slang-emit-hlsl.cpp | 12 | ||||
| -rw-r--r-- | source/slang/slang-ir-glsl-legalize.cpp | 6 | ||||
| -rw-r--r-- | source/slang/slang-ir-inst-defs.h | 16 | ||||
| -rw-r--r-- | source/slang/slang-ir-insts.h | 32 | ||||
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 10 |
6 files changed, 44 insertions, 44 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index 280eafd70..abaa89e08 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -699,15 +699,15 @@ void GLSLSourceEmitter::emitEntryPointAttributesImpl(IRFunc* irFunc, IREntryPoin // These decorations were moved from the parameters to the entry point by ir-glsl-legalize. // The actual parameters have become potentially multiple global parameters. - if (auto decor = irFunc->findDecoration<IRGeometryPrimitiveTypeDecoration>()) + if (auto decor = irFunc->findDecoration<IRGeometryInputPrimitiveTypeDecoration>()) { switch (decor->op) { - case kIROp_TrianglePrimitiveTypeDecoration: m_writer->emit("layout(triangles) in;\n"); break; - case kIROp_LinePrimitiveTypeDecoration: m_writer->emit("layout(lines) in;\n"); break; - case kIROp_LineAdjPrimitiveTypeDecoration: m_writer->emit("layout(lines_adjacency) in;\n"); break; - case kIROp_PointPrimitiveTypeDecoration: m_writer->emit("layout(points) in;\n"); break; - case kIROp_TriangleAdjPrimitiveTypeDecoration: m_writer->emit("layout(triangles_adjacency) in;\n"); break; + case kIROp_TriangleInputPrimitiveTypeDecoration: m_writer->emit("layout(triangles) in;\n"); break; + case kIROp_LineInputPrimitiveTypeDecoration: m_writer->emit("layout(lines) in;\n"); break; + case kIROp_LineAdjInputPrimitiveTypeDecoration: m_writer->emit("layout(lines_adjacency) in;\n"); break; + case kIROp_PointInputPrimitiveTypeDecoration: m_writer->emit("layout(points) in;\n"); break; + case kIROp_TriangleAdjInputPrimitiveTypeDecoration: m_writer->emit("layout(triangles_adjacency) in;\n"); break; default: { SLANG_ASSERT(!"Unknown primitive type"); diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp index 64dfb385a..565f5ae94 100644 --- a/source/slang/slang-emit-hlsl.cpp +++ b/source/slang/slang-emit-hlsl.cpp @@ -662,15 +662,15 @@ void HLSLSourceEmitter::emitSemanticsImpl(IRInst* inst) void HLSLSourceEmitter::emitSimpleFuncParamImpl(IRParam* param) { - if (auto decor = param->findDecoration<IRGeometryPrimitiveTypeDecoration>()) + if (auto decor = param->findDecoration<IRGeometryInputPrimitiveTypeDecoration>()) { switch (decor->op) { - 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; + case kIROp_TriangleInputPrimitiveTypeDecoration: m_writer->emit("triangle "); break; + case kIROp_PointInputPrimitiveTypeDecoration: m_writer->emit("point "); break; + case kIROp_LineInputPrimitiveTypeDecoration: m_writer->emit("line "); break; + case kIROp_LineAdjInputPrimitiveTypeDecoration: m_writer->emit("lineadj "); break; + case kIROp_TriangleAdjInputPrimitiveTypeDecoration: m_writer->emit("triangleadj "); break; default: SLANG_ASSERT(!"Unknown primitive type"); break; } } diff --git a/source/slang/slang-ir-glsl-legalize.cpp b/source/slang/slang-ir-glsl-legalize.cpp index 5f5db5f01..6ccff806f 100644 --- a/source/slang/slang-ir-glsl-legalize.cpp +++ b/source/slang/slang-ir-glsl-legalize.cpp @@ -1253,15 +1253,15 @@ void legalizeEntryPointParameterForGLSL( // // This is only appropriate of course if there is only one of each for all parameters... // which is what current emit code assumes, but may not be more generally applicable. - if (auto geomDecor = pp->findDecoration<IRGeometryPrimitiveTypeDecoration>()) + if (auto geomDecor = pp->findDecoration<IRGeometryInputPrimitiveTypeDecoration>()) { - if (!func->findDecoration<IRGeometryPrimitiveTypeDecoration>()) + if (!func->findDecoration<IRGeometryInputPrimitiveTypeDecoration>()) { builder->addDecoration(func, geomDecor->op); } else { - SLANG_UNEXPECTED("Only expected a single parameter to have IRGeometryPrimitiveTypeDecoration decoration"); + SLANG_UNEXPECTED("Only expected a single parameter to have IRGeometryInputPrimitiveTypeDecoration decoration"); } } diff --git a/source/slang/slang-ir-inst-defs.h b/source/slang/slang-ir-inst-defs.h index dee0ef2f8..26df8a5e3 100644 --- a/source/slang/slang-ir-inst-defs.h +++ b/source/slang/slang-ir-inst-defs.h @@ -423,15 +423,13 @@ INST(HighLevelDeclDecoration, highLevelDecl, 1, 0) INST(NumThreadsDecoration, numThreads, 3, 0) // Added to IRParam parameters to an entry point - INST(GeometryPrimitiveTypeDecoration, geometryPrimitiveTypeDecoration, 1, 0) - - /* GeometryPrimitiveTypeDecoration */ - INST(PointPrimitiveTypeDecoration, pointPrimitiveType, 0, 0) - INST(LinePrimitiveTypeDecoration, linePrimitiveType, 0, 0) - INST(TrianglePrimitiveTypeDecoration, trianglePrimitiveType, 0, 0) - INST(LineAdjPrimitiveTypeDecoration, lineAdjPrimitiveType, 0, 0) - INST(TriangleAdjPrimitiveTypeDecoration, triangleAdjPrimitiveType, 0, 0) - INST_RANGE(GeometryPrimitiveTypeDecoration, PointPrimitiveTypeDecoration, TriangleAdjPrimitiveTypeDecoration) + /* GeometryInputPrimitiveTypeDecoration */ + INST(PointInputPrimitiveTypeDecoration, pointPrimitiveType, 0, 0) + INST(LineInputPrimitiveTypeDecoration, linePrimitiveType, 0, 0) + INST(TriangleInputPrimitiveTypeDecoration, trianglePrimitiveType, 0, 0) + INST(LineAdjInputPrimitiveTypeDecoration, lineAdjPrimitiveType, 0, 0) + INST(TriangleAdjInputPrimitiveTypeDecoration, triangleAdjPrimitiveType, 0, 0) + INST_RANGE(GeometryInputPrimitiveTypeDecoration, PointInputPrimitiveTypeDecoration, TriangleAdjInputPrimitiveTypeDecoration) INST(StreamOutputTypeDecoration, streamOutputTypeDecoration, 1, 0) diff --git a/source/slang/slang-ir-insts.h b/source/slang/slang-ir-insts.h index 8122fb7b6..f8cb3a4ea 100644 --- a/source/slang/slang-ir-insts.h +++ b/source/slang/slang-ir-insts.h @@ -296,25 +296,23 @@ struct IREntryPointDecoration : IRDecoration Profile getProfile() { return Profile(Profile::RawVal(GetIntVal(getProfileInst()))); } }; -struct IRGeometryPrimitiveTypeDecoration: IRDecoration +struct IRGeometryInputPrimitiveTypeDecoration: IRDecoration { - enum { kOp = kIROp_GeometryPrimitiveTypeDecoration }; - IR_PARENT_ISA(GeometryPrimitiveTypeDecoration) + IR_PARENT_ISA(GeometryInputPrimitiveTypeDecoration) }; -IR_SIMPLE_DECORATION(PointPrimitiveTypeDecoration) -IR_SIMPLE_DECORATION(LinePrimitiveTypeDecoration) -IR_SIMPLE_DECORATION(TrianglePrimitiveTypeDecoration) -IR_SIMPLE_DECORATION(LineAdjPrimitiveTypeDecoration) -IR_SIMPLE_DECORATION(TriangleAdjPrimitiveTypeDecoration) +IR_SIMPLE_DECORATION(PointInputPrimitiveTypeDecoration) +IR_SIMPLE_DECORATION(LineInputPrimitiveTypeDecoration) +IR_SIMPLE_DECORATION(TriangleInputPrimitiveTypeDecoration) +IR_SIMPLE_DECORATION(LineAdjInputPrimitiveTypeDecoration) +IR_SIMPLE_DECORATION(TriangleAdjInputPrimitiveTypeDecoration) /// This is a bit of a hack. The problem is that when GLSL legalization takes place - /// A decoration that marks a value as having linkage. - /// - /// A value with linkage is either exported from its module, - /// or will have a definition imported from another module. - /// In either case, it requires a mangled name to use when - /// matching imports and exports. + /// the parameters from the entry point are globalized *and* potentially split + /// So even if we did copy a suitable decoration onto the globalized parameters, + /// it would potentially output multiple times without extra logic. + /// Using this decoration we can copy the StreamOut type to the entry point, and then + /// emit as part of entry point attribute emitting. struct IRStreamOutputTypeDecoration : IRDecoration { enum { kOp = kIROp_StreamOutputTypeDecoration }; @@ -323,7 +321,11 @@ struct IRStreamOutputTypeDecoration : IRDecoration IRHLSLStreamOutputType* getStreamType() { return cast<IRHLSLStreamOutputType>(getOperand(0)); } }; - + /// A decoration that marks a value as having linkage. + /// A value with linkage is either exported from its module, + /// or will have a definition imported from another module. + /// In either case, it requires a mangled name to use when + /// matching imports and exports. struct IRLinkageDecoration : IRDecoration { IR_PARENT_ISA(LinkageDecoration) diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index cec2bd988..08b8cb1bd 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -6356,15 +6356,15 @@ static void lowerFrontEndEntryPointToIR( IROp op = kIROp_Invalid; if (as<HLSLTriangleModifier>(modifier)) - op = kIROp_TrianglePrimitiveTypeDecoration; + op = kIROp_TriangleInputPrimitiveTypeDecoration; else if (as<HLSLPointModifier>(modifier)) - op = kIROp_PointPrimitiveTypeDecoration; + op = kIROp_PointInputPrimitiveTypeDecoration; else if (as<HLSLLineModifier>(modifier)) - op = kIROp_LinePrimitiveTypeDecoration; + op = kIROp_LineInputPrimitiveTypeDecoration; else if (as<HLSLLineAdjModifier>(modifier)) - op = kIROp_LineAdjPrimitiveTypeDecoration; + op = kIROp_LineAdjInputPrimitiveTypeDecoration; else if (as<HLSLTriangleAdjModifier>(modifier)) - op = kIROp_TriangleAdjPrimitiveTypeDecoration; + op = kIROp_TriangleAdjInputPrimitiveTypeDecoration; if (op != kIROp_Invalid) { |
