@@ -516,6 +516,13 @@ class DXBuilder {
516516 builder.getI32IntegerAttr (count));
517517 }
518518
519+ Instruction buildDclOutputTopology (dxsa::OutputPrimitiveTopology topology,
520+ Location loc) {
521+ auto topologyAttr =
522+ dxsa::OutputPrimitiveTopologyAttr::get (builder.getContext (), topology);
523+ return dxsa::DclOutputTopology::create (builder, loc, topologyAttr);
524+ }
525+
519526private:
520527 MLIRContext *context;
521528 ModuleOp module ;
@@ -831,6 +838,24 @@ class Parser {
831838 return builder.buildDclTemps (count, loc);
832839 }
833840
841+ FailureOr<Instruction> parseDclOutputTopology (uint32_t opcodeToken,
842+ Location loc) {
843+ auto topology = DECODE_D3D10_SB_GS_OUTPUT_PRIMITIVE_TOPOLOGY (opcodeToken);
844+ switch (topology) {
845+ case D3D10_SB_PRIMITIVE_TOPOLOGY_POINTLIST:
846+ return builder.buildDclOutputTopology (
847+ dxsa::OutputPrimitiveTopology::pointlist, loc);
848+ case D3D10_SB_PRIMITIVE_TOPOLOGY_LINESTRIP:
849+ return builder.buildDclOutputTopology (
850+ dxsa::OutputPrimitiveTopology::linestrip, loc);
851+ case D3D10_SB_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP:
852+ return builder.buildDclOutputTopology (
853+ dxsa::OutputPrimitiveTopology::trianglestrip, loc);
854+ default :
855+ return emitError (loc, " invalid output primitive topology" );
856+ }
857+ }
858+
834859 OptionalParseResult parseDclInstruction (uint32_t opcodeToken, Location loc,
835860 Instruction &out) {
836861 FailureOr<Instruction> result;
@@ -841,6 +866,9 @@ class Parser {
841866 case D3D10_SB_OPCODE_DCL_TEMPS:
842867 result = parseDclTemps (loc);
843868 break ;
869+ case D3D10_SB_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY:
870+ result = parseDclOutputTopology (opcodeToken, loc);
871+ break ;
844872 default :
845873 return std::nullopt ;
846874 }
0 commit comments