https://github.com/shader-slang/slang
Raw File
Tip revision: 348058f96e81d11da2698acf8343a99a199f1f24 authored by Dietrich Geisler on 27 July 2020, 16:14:17 UTC
Baseline Heterogeneous Example (#1460)
Tip revision: 348058f
gh-566.slang
// legalize-struct-init.slang

//TEST(compute):COMPARE_COMPUTE:
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out
//TEST_INPUT:ubuffer(data=[4 3 2 1], stride=4):


RWStructuredBuffer<uint> outputBuffer;
RWStructuredBuffer<uint> inputBuffer;

struct Helper
{
    RWStructuredBuffer<uint> o;
    RWStructuredBuffer<uint> i;
    uint                    t;  
};

void test(Helper h)
{
    h.o[h.t] = h.i[h.t] * 16 + h.t;    
}

void test(uint t)
{
    Helper h = { outputBuffer, inputBuffer, t };
    test(h);
}

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