Skip to content

Commit

Permalink
Add template test cases for nested SV_DispatchGrid
Browse files Browse the repository at this point in the history
Added test cases to cover nested SV_DispatchGrid used in
records using templates.
  • Loading branch information
Tim Corringham committed Dec 12, 2024
1 parent 4c74ce1 commit a2df420
Showing 1 changed file with 56 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
// generated in cases where:
// node1 - the field with the SV_DispatchGrid semantic is in a nested record
// node2 - the field with the SV_DispatchGrid semantic is in a record field
// node3 - the field with the SV_DispatchGrid semantic is inherited from a base record
// node4 - the field with the SV_DispatchGrid semantic is within a nested record inherited from a base record
// node5 - the field with the SV_DispatchGrid semantic is within a base record of a nested record
// node3 - the field with the SV_DispatchGrid semantic is inherited from a base record
// node4 - the field with the SV_DispatchGrid semantic is within a nested record inherited from a base record
// node5 - the field with the SV_DispatchGrid semantic is within a base record of a nested record
// node6 - the field with the SV_DispatchGrid semantic is within a templated base record
// node7 - the field with the SV_DispatchGrid semantic is within a templated base record of a templated record
// node8 - the field with the SV_DispatchGrid semantic has templated type

struct Record1 {
struct {
Expand All @@ -19,6 +22,7 @@ struct Record1 {
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node1(DispatchNodeInputRecord<Record1> input) {}
// CHECK: {!"node1"
// CHECK: , i32 1, ![[SVDG_1:[0-9]+]]
// CHECK: [[SVDG_1]] = !{i32 0, i32 5, i32 3}

Expand All @@ -37,6 +41,7 @@ struct Record2 {
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node2(DispatchNodeInputRecord<Record2> input) {}
// CHECK: {!"node2"
// CHECK: , i32 1, ![[SVDG_2:[0-9]+]]
// CHECK: [[SVDG_2]] = !{i32 8, i32 5, i32 2}

Expand All @@ -49,18 +54,20 @@ struct Record3 : Record2a {
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node3(DispatchNodeInputRecord<Record3> input) {}
// CHECK: {!"node3"
// CHECK: , i32 1, ![[SVDG_3:[0-9]+]]
// CHECK: [[SVDG_3]] = !{i32 4, i32 5, i32 2}

struct Record4 : Record2 {
// SV_DispatchGrid is in a nested field in a base record
float f;
};

[Shader("node")]
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node4(DispatchNodeInputRecord<Record4> input) {}
// CHECK: {!"node4"
// CHECK: , i32 1, ![[SVDG_2]]

struct Record5 {
Expand All @@ -74,5 +81,50 @@ struct Record5 {
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node5(DispatchNodeInputRecord<Record5> input) {}
// CHECK: {!"node5"
// CHECK: , i32 1, ![[SVDG_5:[0-9]+]]
// CHECK: [[SVDG_5]] = !{i32 20, i32 5, i32 2}

template <typename T>
struct Base {
T DG : SV_DispatchGrid;
};

struct Derived1 : Base<uint3> {
int4 x;
};

[Shader("node")]
[NodeLaunch("broadcasting")]
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node6(DispatchNodeInputRecord<Derived1 > input) {}
// CHECK: {!"node6"
// CHECK: , i32 1, ![[SVDG_1]]

template <typename T>
struct Derived2 : Base<T> {
T Y;
};

[Shader("node")]
[NodeLaunch("broadcasting")]
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node7(DispatchNodeInputRecord<Derived2<uint2> > input) {}
// CHECK: {!"node7"
// CHECK: , i32 1, ![[SVDG_7:[0-9]+]]
// CHECK: [[SVDG_7]] = !{i32 0, i32 5, i32 2}

template <typename T>
struct Derived3 {
Derived2<T> V;
};

[Shader("node")]
[NodeLaunch("broadcasting")]
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node8(DispatchNodeInputRecord< Derived3 <uint3> > input) {}
// CHECK: {!"node8"
// CHECK: , i32 1, ![[SVDG_1]]

0 comments on commit a2df420

Please sign in to comment.