-
Notifications
You must be signed in to change notification settings - Fork 692
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support SV_DispatchGrid semantic in a nested record
The SV_DispatchGrid DXIL metadata for a node input record was not generated in cases where: - the field with the SV_DispatchGrid semantic was in a nested record - the field with the SV_DispatchGrid semantic was in a record field - the field with the SV_DispatchGrid semantic was inherited from a base record - in any combinations of the above Added FindDispatchGridSemantic() to be used by the AddHLSLNodeRecordTypeInfo() function, and added a test case. Fixes #6928
- Loading branch information
Tim Corringham
committed
Sep 24, 2024
1 parent
97af068
commit 48b89fc
Showing
2 changed files
with
153 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
tools/clang/test/HLSLFileCheck/hlsl/workgraph/nested_sv_dispatchgrid.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// RUN: %dxc -T lib_6_8 %s | FileCheck %s | ||
|
||
// Check that the SV_DispatchGrid DXIL metadata for a node input record is | ||
// 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 | ||
|
||
struct Record1 { | ||
struct { | ||
// SV_DispatchGrid is within a nested record | ||
uint3 grid : SV_DispatchGrid; | ||
}; | ||
}; | ||
|
||
[Shader("node")] | ||
[NodeMaxDispatchGrid(32,16,1)] | ||
[NumThreads(32,1,1)] | ||
void node1(DispatchNodeInputRecord<Record1> input) {} | ||
// CHECK: , i32 1, ![[SVDG_1:[0-9]+]] | ||
// CHECK: [[SVDG_1]] = !{i32 0, i32 5, i32 3} | ||
|
||
struct Record2a { | ||
uint u; | ||
uint2 grid : SV_DispatchGrid; | ||
}; | ||
|
||
struct Record2 { | ||
uint a; | ||
// SV_DispatchGrid is within a record field | ||
Record2a b; | ||
}; | ||
|
||
[Shader("node")] | ||
[NodeMaxDispatchGrid(32,16,1)] | ||
[NumThreads(32,1,1)] | ||
void node2(DispatchNodeInputRecord<Record2> input) {} | ||
// CHECK: , i32 1, ![[SVDG_2:[0-9]+]] | ||
// CHECK: [[SVDG_2]] = !{i32 8, i32 5, i32 2} | ||
|
||
struct Record3 : Record2a { | ||
// SV_DispatchGrid is inherited | ||
uint4 n; | ||
}; | ||
|
||
[Shader("node")] | ||
[NodeMaxDispatchGrid(32,16,1)] | ||
[NumThreads(32,1,1)] | ||
void node3(DispatchNodeInputRecord<Record3> input) {} | ||
// 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: , i32 1, ![[SVDG_2]] | ||
|
||
struct Record5 { | ||
uint4 x; | ||
// SV_DispatchGrid is in a base record of a record field | ||
Record3 r; | ||
}; | ||
|
||
[Shader("node")] | ||
[NodeLaunch("broadcasting")] | ||
[NodeMaxDispatchGrid(32,16,1)] | ||
[NumThreads(32,1,1)] | ||
void node5(DispatchNodeInputRecord<Record5> input) {} | ||
// CHECK: , i32 1, ![[SVDG_5:[0-9]+]] | ||
// CHECK: [[SVDG_5]] = !{i32 20, i32 5, i32 2} |