diff --git a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/nested_sv_dispatchgrid.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/nested_sv_dispatchgrid.hlsl index 5e9cb47cf1..1da45dae1d 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/workgraph/nested_sv_dispatchgrid.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/workgraph/nested_sv_dispatchgrid.hlsl @@ -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 { @@ -19,6 +22,7 @@ struct Record1 { [NodeMaxDispatchGrid(32,16,1)] [NumThreads(32,1,1)] void node1(DispatchNodeInputRecord input) {} +// CHECK: {!"node1" // CHECK: , i32 1, ![[SVDG_1:[0-9]+]] // CHECK: [[SVDG_1]] = !{i32 0, i32 5, i32 3} @@ -37,6 +41,7 @@ struct Record2 { [NodeMaxDispatchGrid(32,16,1)] [NumThreads(32,1,1)] void node2(DispatchNodeInputRecord input) {} +// CHECK: {!"node2" // CHECK: , i32 1, ![[SVDG_2:[0-9]+]] // CHECK: [[SVDG_2]] = !{i32 8, i32 5, i32 2} @@ -49,6 +54,7 @@ struct Record3 : Record2a { [NodeMaxDispatchGrid(32,16,1)] [NumThreads(32,1,1)] void node3(DispatchNodeInputRecord input) {} +// CHECK: {!"node3" // CHECK: , i32 1, ![[SVDG_3:[0-9]+]] // CHECK: [[SVDG_3]] = !{i32 4, i32 5, i32 2} @@ -56,11 +62,12 @@ 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 input) {} +// CHECK: {!"node4" // CHECK: , i32 1, ![[SVDG_2]] struct Record5 { @@ -74,5 +81,50 @@ struct Record5 { [NodeMaxDispatchGrid(32,16,1)] [NumThreads(32,1,1)] void node5(DispatchNodeInputRecord input) {} +// CHECK: {!"node5" // CHECK: , i32 1, ![[SVDG_5:[0-9]+]] // CHECK: [[SVDG_5]] = !{i32 20, i32 5, i32 2} + +template +struct Base { + T DG : SV_DispatchGrid; +}; + +struct Derived1 : Base { + int4 x; +}; + +[Shader("node")] +[NodeLaunch("broadcasting")] +[NodeMaxDispatchGrid(32,16,1)] +[NumThreads(32,1,1)] +void node6(DispatchNodeInputRecord input) {} +// CHECK: {!"node6" +// CHECK: , i32 1, ![[SVDG_1]] + +template +struct Derived2 : Base { + T Y; +}; + +[Shader("node")] +[NodeLaunch("broadcasting")] +[NodeMaxDispatchGrid(32,16,1)] +[NumThreads(32,1,1)] +void node7(DispatchNodeInputRecord > input) {} +// CHECK: {!"node7" +// CHECK: , i32 1, ![[SVDG_7:[0-9]+]] +// CHECK: [[SVDG_7]] = !{i32 0, i32 5, i32 2} + +template +struct Derived3 { + Derived2 V; +}; + +[Shader("node")] +[NodeLaunch("broadcasting")] +[NodeMaxDispatchGrid(32,16,1)] +[NumThreads(32,1,1)] +void node8(DispatchNodeInputRecord< Derived3 > input) {} +// CHECK: {!"node8" +// CHECK: , i32 1, ![[SVDG_1]]