Skip to content
Merged
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
18 changes: 18 additions & 0 deletions mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,24 @@ def DXSA_DclInputSgv : DXSA_Op<"dcl_input_sgv"> {
let assemblyFormat = "$operand `,` $name attr-dict";
}

def DXSA_DclInputSiv : DXSA_Op<"dcl_input_siv"> {
let summary = "declares an input register as a System Interpreted Value";
let description = [{
The `dxsa.dcl_input_siv` operation declares an input register
that expects a System Interpreted Value to be provided
from the upstream Stage.

Example:

```mlir
dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z, w>, index = [0]>, <position>
```
}];
let arguments = (ins DXSA_InlineOperandAttr:$operand,
DXSA_SystemValueNameAttr:$name);
let assemblyFormat = "$operand `,` $name attr-dict";
}

def DXSA_DclOutputSgv : DXSA_Op<"dcl_output_sgv"> {
let summary = "declares an output as a System Generated Value";
let description = [{
Expand Down
17 changes: 17 additions & 0 deletions mlir/lib/Target/DXSA/BinaryParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,12 @@ class DXBuilder {
return dxsa::DclInputSgv::create(builder, loc, operand, nameAttr);
}

Instruction buildDclInputSiv(dxsa::InlineOperandAttr operand,
dxsa::SystemValueName name, Location loc) {
auto nameAttr = dxsa::SystemValueNameAttr::get(builder.getContext(), name);
return dxsa::DclInputSiv::create(builder, loc, operand, nameAttr);
}

Instruction buildDclOutputSgv(dxsa::InlineOperandAttr operand,
dxsa::SystemValueName name, Location loc) {
auto nameAttr = dxsa::SystemValueNameAttr::get(builder.getContext(), name);
Expand Down Expand Up @@ -1281,6 +1287,14 @@ class Parser {
return builder.buildDclIndexRange(*operand, *count, loc);
}

FailureOr<Instruction> parseDclInputSiv(Location loc) {
auto operand = parseInlineOperand();
FAILURE_IF_FAILED(operand);
auto name = parseSystemValueName(getLocation());
FAILURE_IF_FAILED(name);
return builder.buildDclInputSiv(*operand, *name, loc);
}

FailureOr<Instruction> parseDclOutputSgv(Location loc) {
auto operand = parseInlineOperand();
FAILURE_IF_FAILED(operand);
Expand Down Expand Up @@ -1458,6 +1472,9 @@ class Parser {
case D3D10_SB_OPCODE_DCL_INPUT_SGV:
result = parseDclInputSgv(loc);
break;
case D3D10_SB_OPCODE_DCL_INPUT_SIV:
result = parseDclInputSiv(loc);
break;
case D3D10_SB_OPCODE_DCL_OUTPUT_SGV:
result = parseDclOutputSgv(loc);
break;
Expand Down
8 changes: 8 additions & 0 deletions mlir/test/Target/DXSA/dcl_input_siv.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: mlir-translate --import-dxsa-bin %S/inputs/dcl_input_siv.bin | FileCheck %s

// CHECK: module {
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z, w>, index = [0]>, <position>
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z>, index = [1]>, <clipDistance>
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y>, index = [2]>, <cullDistance>
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x>, index = [3]>, <finalQuadUInsideTessFactor>
// CHECK-NEXT: }
Binary file added mlir/test/Target/DXSA/inputs/dcl_input_siv.bin
Binary file not shown.