summaryrefslogtreecommitdiffstats
path: root/tests/metal/vector-argument-buffer-layout.slang
blob: dcc89be7cdffe53cc77427d3eec8bf71058c18b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//TEST:REFLECTION(filecheck=METAL): -target metal
//TEST(compute, metal):COMPARE_COMPUTE(filecheck-buffer=BUF):-metal -compute -entry computeMain -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type


//METAL: "name": "o",
//METAL: "binding": {"kind": "constantBuffer", "index": 0},

//METAL: "name": "gParams",
//METAL: "binding": {"kind": "constantBuffer", "index": 1},


//METAL: "dir"
//METAL: "binding": {"kind": "uniform", "offset": 0, "size": 16, "elementStride": 4}
//METAL: "color"
//METAL: "binding": {"kind": "uniform", "offset": 16, "size": 16, "elementStride": 4}

struct Params
{
    float3 dir;
    float4 color;
}

//TEST_INPUT: ubuffer(data=[0.0], stride=4):out,name o
RWStructuredBuffer<float> o;
//TEST_INPUT: set gParams = new Params{{3.0, 4.0, 5.0}, {6.0, 7.0 ,8.0, 9.0}}
ParameterBlock<Params> gParams;

[numthreads(1,1,1)]
void computeMain()
{
    // BUF: 3.0
    o[0] = gParams.dir.x;
}