Skip to content

Commit eb63746

Browse files
committed
[mlir][dxsa] Add dcl_input_siv instruction
Example: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z, w>, index = [0]>, <position> Signed-off-by: Vladimir Shiryaev <tagolog@users.noreply.github.com>
1 parent 888ee0b commit eb63746

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,24 @@ def DXSA_DclInputSgv : DXSA_Op<"dcl_input_sgv"> {
777777
let assemblyFormat = "$operand `,` $name attr-dict";
778778
}
779779

780+
def DXSA_DclInputSiv : DXSA_Op<"dcl_input_siv"> {
781+
let summary = "declares an input register as a System Interpreted Value";
782+
let description = [{
783+
The `dxsa.dcl_input_siv` operation declares an input register
784+
that expects a System Interpreted Value to be provided
785+
from the upstream Stage.
786+
787+
Example:
788+
789+
```mlir
790+
dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z, w>, index = [0]>, <position>
791+
```
792+
}];
793+
let arguments = (ins DXSA_InlineOperandAttr:$operand,
794+
DXSA_SystemValueNameAttr:$name);
795+
let assemblyFormat = "$operand `,` $name attr-dict";
796+
}
797+
780798
def DXSA_DclOutputSgv : DXSA_Op<"dcl_output_sgv"> {
781799
let summary = "declares an output as a System Generated Value";
782800
let description = [{

mlir/lib/Target/DXSA/BinaryParser.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,12 @@ class DXBuilder {
657657
return dxsa::DclInputSgv::create(builder, loc, operand, nameAttr);
658658
}
659659

660+
Instruction buildDclInputSiv(dxsa::InlineOperandAttr operand,
661+
dxsa::SystemValueName name, Location loc) {
662+
auto nameAttr = dxsa::SystemValueNameAttr::get(builder.getContext(), name);
663+
return dxsa::DclInputSiv::create(builder, loc, operand, nameAttr);
664+
}
665+
660666
Instruction buildDclOutputSgv(dxsa::InlineOperandAttr operand,
661667
dxsa::SystemValueName name, Location loc) {
662668
auto nameAttr = dxsa::SystemValueNameAttr::get(builder.getContext(), name);
@@ -1281,6 +1287,14 @@ class Parser {
12811287
return builder.buildDclIndexRange(*operand, *count, loc);
12821288
}
12831289

1290+
FailureOr<Instruction> parseDclInputSiv(Location loc) {
1291+
auto operand = parseInlineOperand();
1292+
FAILURE_IF_FAILED(operand);
1293+
auto name = parseSystemValueName(getLocation());
1294+
FAILURE_IF_FAILED(name);
1295+
return builder.buildDclInputSiv(*operand, *name, loc);
1296+
}
1297+
12841298
FailureOr<Instruction> parseDclOutputSgv(Location loc) {
12851299
auto operand = parseInlineOperand();
12861300
FAILURE_IF_FAILED(operand);
@@ -1458,6 +1472,9 @@ class Parser {
14581472
case D3D10_SB_OPCODE_DCL_INPUT_SGV:
14591473
result = parseDclInputSgv(loc);
14601474
break;
1475+
case D3D10_SB_OPCODE_DCL_INPUT_SIV:
1476+
result = parseDclInputSiv(loc);
1477+
break;
14611478
case D3D10_SB_OPCODE_DCL_OUTPUT_SGV:
14621479
result = parseDclOutputSgv(loc);
14631480
break;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: mlir-translate --import-dxsa-bin %S/inputs/dcl_input_siv.bin | FileCheck %s
2+
3+
// CHECK: module {
4+
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z, w>, index = [0]>, <position>
5+
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z>, index = [1]>, <clipDistance>
6+
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y>, index = [2]>, <cullDistance>
7+
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x>, index = [3]>, <finalQuadUInsideTessFactor>
8+
// CHECK-NEXT: }
64 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)