diff options
| author | Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> | 2025-01-17 17:53:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-17 14:53:02 -0800 |
| commit | 9d99976703872d7608415da5a90d070bd5dec5b7 (patch) | |
| tree | ca167a7df8270f1853912846bac008a6faf0268e /tests | |
| parent | d046082c501d3501a24c143dff2cfa42939549b9 (diff) | |
Fix circularity issue when checking multiple generic interface constraints. (#6121)
* Fix circularity issue with checking multiple generic interface constraints
* Create multi-generic-interface-constraint.slang
* Update multi-generic-interface-constraint.slang
* Update slang-check-inheritance.cpp
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/language-feature/generics/multi-generic-interface-constraint.slang | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/language-feature/generics/multi-generic-interface-constraint.slang b/tests/language-feature/generics/multi-generic-interface-constraint.slang new file mode 100644 index 000000000..9c6918ed2 --- /dev/null +++ b/tests/language-feature/generics/multi-generic-interface-constraint.slang @@ -0,0 +1,36 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -output-using-type + +interface IFoo<T : __BuiltinFloatingPointType> +{ + bool requirement(T v1); +} + +struct Bar<T : __BuiltinFloatingPointType, A : IFoo<T>, B : IFoo<T>> +{ + [Differentiable] + T doThing(T a) + { + return a * T(2.0); + } +} + +struct Foo : IFoo<float> +{ + bool requirement(float v) + { + return v > 0.5; + } +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + int tid = dispatchThreadID.x; + Bar<float, Foo, Foo> obj; + outputBuffer[tid] = obj.doThing(2.0f); + // CHECK: 4 +} |
