diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-05-11 09:15:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-11 09:15:04 -0700 |
| commit | 10c0ffa7de111bd2c0096015bba5ca2110d03bc1 (patch) | |
| tree | 1d827af410633dea4b1332668db27afaaf23b673 | |
| parent | 2d96e1f7db60865acd96bebbb7cc7298ae1ff688 (diff) | |
Add test for associated type from global generic parameter (#561)
Resolves #357
The example shader from that issue has been added as a test case, and works with the top-of-tree Slang compiler (most likely due to the changes introduced with the IR-level type system).
| -rw-r--r-- | tests/bugs/gh-357.slang | 38 | ||||
| -rw-r--r-- | tests/bugs/gh-357.slang.expected.txt | 4 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/bugs/gh-357.slang b/tests/bugs/gh-357.slang new file mode 100644 index 000000000..be2ba95ed --- /dev/null +++ b/tests/bugs/gh-357.slang @@ -0,0 +1,38 @@ +//TEST(compute):COMPARE_COMPUTE: +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out +//TEST_INPUT:type AssocImpl + + +RWStructuredBuffer<float> outputBuffer; + +interface IBase +{ + float getVal(); +}; + +interface IAssoc +{ + associatedtype TBase : IBase; +}; + +struct BaseImpl : IBase +{ + float getVal() { return 1.0; } +}; + +struct AssocImpl : IAssoc +{ + typedef BaseImpl TBase; +}; + +__generic_param T : IAssoc; + + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + T.TBase base; + float rs = base.getVal(); + outputBuffer[tid] = rs; +} diff --git a/tests/bugs/gh-357.slang.expected.txt b/tests/bugs/gh-357.slang.expected.txt new file mode 100644 index 000000000..cc5e55ab6 --- /dev/null +++ b/tests/bugs/gh-357.slang.expected.txt @@ -0,0 +1,4 @@ +3F800000 +3F800000 +3F800000 +3F800000 |
