diff options
| author | Yong He <yonghe@outlook.com> | 2022-10-04 15:21:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-04 15:21:17 -0700 |
| commit | 364e43264b9f69957ddaed8890392d82fb25c822 (patch) | |
| tree | aa4d9b6a90ddf398c12f7cce6499e3946d8ffeb1 /tests/bugs | |
| parent | 8b1daa68a5ff1398cdf130aacad32d2e5646d1eb (diff) | |
Fix `ApplyExtensionToType` on own type being extended. (#2430)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/generic-extension.slang | 28 | ||||
| -rw-r--r-- | tests/bugs/generic-extension.slang.expected.txt | 4 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/bugs/generic-extension.slang b/tests/bugs/generic-extension.slang new file mode 100644 index 000000000..a3e039872 --- /dev/null +++ b/tests/bugs/generic-extension.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +interface IFoo +{ + static This myAdd(This v, float val); +} + +__generic<let N : int> +extension vector<float, N> : IFoo +{ + static vector<float, N> myAdd(vector<float, N> v, float val) + { + return v + vector<float, N>(val); + } +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + int index = int(dispatchThreadID.x); + float2 v = 1.0; + v = float2.myAdd(v, 2.0); + outputBuffer[index] = int(v.x); +} + diff --git a/tests/bugs/generic-extension.slang.expected.txt b/tests/bugs/generic-extension.slang.expected.txt new file mode 100644 index 000000000..463fa2702 --- /dev/null +++ b/tests/bugs/generic-extension.slang.expected.txt @@ -0,0 +1,4 @@ +3 +3 +3 +3 |
