-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIR-V] Lower templated enums correctly. (#6768)
Templated enums lowering was not supported. This commit fixes those cases. Fixes #6753 Signed-off-by: Nathan Gauër <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 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
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,29 @@ | ||
// RUN: %dxc -T cs_6_6 -E main -spirv %s -fcgl | FileCheck %s | ||
|
||
template<typename T> | ||
void templated_func() { | ||
T tmp; | ||
} | ||
|
||
template<typename T> | ||
void templated_func_deduced(T tmp) { | ||
} | ||
|
||
enum MyEnum { }; | ||
|
||
template<typename T> | ||
using TemplatedType = MyEnum; | ||
|
||
[numthreads(1, 1, 1)] | ||
void main() { | ||
// CHECK: %a = OpVariable %_ptr_Function_int Function | ||
TemplatedType<MyEnum> a; | ||
|
||
// CHECK: OpFunctionCall %void %templated_func | ||
templated_func<MyEnum>(); | ||
|
||
// CHECK: [[a:%[0-9]+]] = OpLoad %int %a | ||
// CHECK: OpStore %param_var_tmp [[a]] | ||
// CHECK: OpFunctionCall %void %templated_func_deduced %param_var_tmp | ||
templated_func_deduced(a); | ||
} |