https://github.com/shader-slang/slang
Raw File
Tip revision: 4f7d1f44a4b2a5eab2e2dec1edf3a156da78aae3 authored by Yong He on 11 February 2024, 09:05:37 UTC
Fix type checking around generic array types. (#3568)
Tip revision: 4f7d1f4
gh-357.slang
//DISABLED_TEST(compute):COMPARE_COMPUTE: -shaderobj

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer

//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;
};

[numthreads(4, 1, 1)]
void computeMain<T:IAssoc>(
    uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint tid = dispatchThreadID.x;
    T.TBase base;
    float rs = base.getVal();
    outputBuffer[tid] = rs;
}
back to top