yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeFix parameter block loads in GLSL emit. (#2946)b45e5aa07

master
863 B31 linesraw
1// Test reading parameter block from a member function.
2
3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -vk -output-using-type
4//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx11 -profile sm_5_0 -output-using-type
5
6//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=gOutputBuffer
7RWStructuredBuffer<int> gOutputBuffer;
8
9struct MyParameters
10{
11    int x;
12    int y;
13    StructuredBuffer<float> buffer1;
14
15    RWStructuredBuffer<uint3> buffer;
16    int calc()
17    {
18        buffer[0].x = 3;
19        return x + y + buffer[0].x;
20    }
21}
22
23//TEST_INPUT: set gObj = new MyParameters{2, 3, new StructuredBuffer<float>{0.0}, new RWStructuredBuffer<uint3>{{0,0,0}}}
24ParameterBlock<MyParameters> gObj;
25
26[numthreads(1, 1, 1)]
27void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
28{
29    float result = 0.0;
30    gOutputBuffer[dispatchThreadID.x] = gObj.calc();
31}