https://github.com/shader-slang/slang
Raw File
Tip revision: cfb41bb61d63d45aa47ccf9580414545630f0d97 authored by Dietrich Geisler on 07 July 2020, 21:46:02 UTC
Public Keyword for Functions (#1432)
Tip revision: cfb41bb
gh-357.slang
//TEST(compute):COMPARE_COMPUTE:
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):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;
};

[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