diff --git a/mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td b/mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td index 4726b0243f87..2acad50bd633 100644 --- a/mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td +++ b/mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td @@ -949,6 +949,66 @@ def DXSA_DclHsForkPhaseInstanceCount : let assemblyFormat = "$count attr-dict"; } +//===----------------------------------------------------------------------===// +// Hull shader phase markers +//===----------------------------------------------------------------------===// + +def DXSA_HsDecls : DXSA_NullaryOp<"hs_decls"> { + let summary = "marks the hull shader declaration section"; + let description = [{ + The `dxsa.hs_decls` operation marks the declaration section of a hull + shader program. + + Example: + + ```mlir + dxsa.hs_decls + ``` + }]; +} + +def DXSA_HsControlPointPhase : DXSA_NullaryOp<"hs_control_point_phase"> { + let summary = "marks the hull shader control point phase"; + let description = [{ + The `dxsa.hs_control_point_phase` operation marks the control point phase + of a hull shader program. + + Example: + + ```mlir + dxsa.hs_control_point_phase + ``` + }]; +} + +def DXSA_HsForkPhase : DXSA_NullaryOp<"hs_fork_phase"> { + let summary = "marks the hull shader fork phase"; + let description = [{ + The `dxsa.hs_fork_phase` operation marks the fork phase of a hull shader + program. + + Example: + + ```mlir + dxsa.hs_fork_phase + ``` + }]; +} + +def DXSA_HsJoinPhase : DXSA_NullaryOp<"hs_join_phase"> { + let summary = "marks the hull shader join phase"; + let description = [{ + The `dxsa.hs_join_phase` operation marks the join phase of a hull shader + program. + + Example: + + ```mlir + dxsa.hs_join_phase + ``` + }]; +} + def DXSA_DclGsInstanceCount : DXSA_Op<"dcl_gs_instance_count"> { let summary = "declares instance count for the geometry shader"; let description = [{ diff --git a/mlir/lib/Target/DXSA/BinaryParser.cpp b/mlir/lib/Target/DXSA/BinaryParser.cpp index 2699500833c2..00a64ede09d6 100644 --- a/mlir/lib/Target/DXSA/BinaryParser.cpp +++ b/mlir/lib/Target/DXSA/BinaryParser.cpp @@ -2447,6 +2447,14 @@ class Parser { return STREAM_INDEX_OP(CutStream); case D3D11_SB_OPCODE_EMITTHENCUT_STREAM: return STREAM_INDEX_OP(EmitThenCutStream); + case D3D11_SB_OPCODE_HS_DECLS: + return PLAIN_OP(HsDecls, 0, 0); + case D3D11_SB_OPCODE_HS_CONTROL_POINT_PHASE: + return PLAIN_OP(HsControlPointPhase, 0, 0); + case D3D11_SB_OPCODE_HS_FORK_PHASE: + return PLAIN_OP(HsForkPhase, 0, 0); + case D3D11_SB_OPCODE_HS_JOIN_PHASE: + return PLAIN_OP(HsJoinPhase, 0, 0); } #undef SATURABLE_OP #undef PLAIN_OP diff --git a/mlir/test/Target/DXSA/hull_shader_phases.test b/mlir/test/Target/DXSA/hull_shader_phases.test new file mode 100644 index 000000000000..65b59301b175 --- /dev/null +++ b/mlir/test/Target/DXSA/hull_shader_phases.test @@ -0,0 +1,28 @@ +// RUN: mlir-translate --split-input-file --import-dxsa-hex %s | FileCheck %s +// RUN: mlir-translate --split-input-file --import-dxsa-hex %s | mlir-opt --split-input-file --verify-roundtrip + +// CHECK-LABEL: dxsa.module { +// CHECK-NEXT: dxsa.hs_decls +// CHECK-NEXT: } +0x01000071 + +// ----- + +// CHECK-LABEL: dxsa.module { +// CHECK-NEXT: dxsa.hs_control_point_phase +// CHECK-NEXT: } +0x01000072 + +// ----- + +// CHECK-LABEL: dxsa.module { +// CHECK-NEXT: dxsa.hs_fork_phase +// CHECK-NEXT: } +0x01000073 + +// ----- + +// CHECK-LABEL: dxsa.module { +// CHECK-NEXT: dxsa.hs_join_phase +// CHECK-NEXT: } +0x01000074