Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [{
Expand Down
8 changes: 8 additions & 0 deletions mlir/lib/Target/DXSA/BinaryParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions mlir/test/Target/DXSA/hull_shader_phases.test
Original file line number Diff line number Diff line change
@@ -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