https://github.com/shader-slang/slang
Raw File
Tip revision: e698b4ae92b996ac54d023c831170a5467b2d1a0 authored by Sai Praveen Bangaru on 28 September 2023, 05:45:09 UTC
Remove `[NoSideEffect]` from `DiffTensorView.store()` (#3247)
Tip revision: e698b4a
typedef-member.slang
//TEST(compute):COMPARE_COMPUTE: -shaderobj

// Confirm that a struct type defined in a generic parent works

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;

struct SubType<T>
{
    T x;
};

struct GenStruct<T>
{
    typedef SubType<T> SubTypeT;
    T getVal(SubTypeT v)
    {
        return v.x;
    }
};

float test(float val)
{
    GenStruct<float>.SubTypeT sb;
    sb.x = val;
    GenStruct<float> obj;
    return obj.getVal(sb);
}


[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint tid = dispatchThreadID.x;
    float inVal = float(tid);
    float outVal = test(inVal);
    outputBuffer[tid] = outVal.x;
}
back to top