diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-01-22 11:57:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-22 08:57:53 -0800 |
| commit | 14211ec3c4e56e59f479dbac23123ea61eab7d91 (patch) | |
| tree | 2ccc5c02bfbdfc3d34f077036b9ab8cd8c4d4def /tests | |
| parent | ea98e24d304f99f9d49daa8d870a953bdf3d49e7 (diff) | |
Remove unnecessary parameters from Metal entry point signature (#6131)
* fix metal entry point global params
* address review comments, cleanup and test
* remove dead code
* undo accidental change
* address review comments and cleanup
* minor fix and cleanup
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/metal/multi-entry-point-params.slang | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/metal/multi-entry-point-params.slang b/tests/metal/multi-entry-point-params.slang new file mode 100644 index 000000000..11aefe267 --- /dev/null +++ b/tests/metal/multi-entry-point-params.slang @@ -0,0 +1,57 @@ +//TEST:SIMPLE(filecheck=CHECK): -target metal -fvk-use-entrypoint-name + +struct FirstStruct { + uint a; +} + +struct SecondStruct { + uint a; +} + +struct ThirdStruct { + uint a; +} + +struct FourthStruct { + uint a; +} + +StructuredBuffer<uint> globalScopeBuffer; + +RWStructuredBuffer<uint> outBuffer; + +// +// Checks for the following: +// - Output entry points will only contain parameters that they originally have from the Slang source. +// - Binding offset calculation for global params originating from entry point parameters are done per-whole file. +// - Binding offset for global params in global scope are the same for each generated entry point. +// + +// CHECK: main1({{.*}}globalScopeBuffer{{.*}}buffer(0)]], FirstStruct{{.*}}buffer(2)]], SecondStruct{{.*}}buffer(3)]], float{{.*}}buffer(4)]]) +[shader("compute")] +[numthreads(5, 1, 1)] +void main1( + uint3 dispatchThreadID: SV_DispatchThreadID, + RWStructuredBuffer<FirstStruct> custom, + RWStructuredBuffer<SecondStruct> other, + ConstantBuffer<float> factor +) { + uint index = dispatchThreadID.x; + outBuffer[index] = globalScopeBuffer[index] * custom[index].a * other[index].a * uint(factor); +} + + +// CHECK-NOT: FirstStruct +// CHECK-NOT: SecondStruct +// CHECK: main2({{.*}}globalScopeBuffer{{.*}}buffer(0)]], ThirdStruct{{.*}}buffer(5)]], FourthStruct{{.*}}buffer(6)]]) +[shader("compute")] +[numthreads(5, 1, 1)] +void main2( + uint3 dispatchThreadID: SV_DispatchThreadID, + RWStructuredBuffer<ThirdStruct> custom, + RWStructuredBuffer<FourthStruct> other, +) { + uint index = dispatchThreadID.x; + outBuffer[index] = globalScopeBuffer[index] * custom[index].a * other[index].a; +} + |
