diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2025-02-05 12:37:03 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-05 10:37:03 -0800 |
| commit | 9ec6b91686b651d959fd9ffbec283845bd725dd6 (patch) | |
| tree | 2c48202cb04b76e5ddcb274be35529378ddf8f31 /tests/compute | |
| parent | 4b350645042b8e8fbdad19784ee745d11c7bc616 (diff) | |
Feature/initialize list side branch (#6058)
* SP004: implement initialize list translation to ctor
- We synthesize a member-wise constructor for each struct follow
the rules described in SP004.
- Add logic to translate the initialize list to constructor invoke
- Add cuda-host decoration for the synthesized constructor
- Remove the default constructor when we have a valid member init constructor
- Disable -zero-initialize option, will re-implement it in followup (#6109).
- Fix the overload lookup issue
When creating invoke expression for ctor, we need to call
ResolveInvoke() to find us the best candidates, however
the existing lookup logic could find us the base constructor
for child struct, we should eliminate this case by providing
the LookupOptions::IgnoreInheritance to lookup, this requires
us to create a subcontext on SemanticsVisitor to indicate that
we only want to use this option on looking the constructor.
- Do not implicit initialize a struct that doesn't have explicit default
constructor.
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/empty-struct2.slang | 2 | ||||
| -rw-r--r-- | tests/compute/struct-default-init.slang | 1 | ||||
| -rw-r--r-- | tests/compute/type-legalize-global-with-init.slang | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/tests/compute/empty-struct2.slang b/tests/compute/empty-struct2.slang index 303cfd234..4476bcaa1 100644 --- a/tests/compute/empty-struct2.slang +++ b/tests/compute/empty-struct2.slang @@ -48,7 +48,7 @@ void test<Obj : IInterface>(Obj obj) [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { - Empty<EmptyS> obj; + Empty<EmptyS> obj = {}; test(obj); outputBuffer[dispatchThreadID.x] = dispatchThreadID.x; } diff --git a/tests/compute/struct-default-init.slang b/tests/compute/struct-default-init.slang index 236fff57f..ce8979164 100644 --- a/tests/compute/struct-default-init.slang +++ b/tests/compute/struct-default-init.slang @@ -1,5 +1,6 @@ // struct-default-init.slang //TEST(compute):COMPARE_COMPUTE: -shaderobj +//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj struct Test { diff --git a/tests/compute/type-legalize-global-with-init.slang b/tests/compute/type-legalize-global-with-init.slang index 573ac9849..7316cad1d 100644 --- a/tests/compute/type-legalize-global-with-init.slang +++ b/tests/compute/type-legalize-global-with-init.slang @@ -5,6 +5,7 @@ // resources. // //TEST(compute):COMPARE_COMPUTE: -shaderobj +//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj // //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer RWStructuredBuffer<uint> outputBuffer; |
