yum-mirror/slang

Making it easier to work with shaders

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

James Helferty (NVIDIA)Enable metal tests (#8446)8086adc90

master
1.4 KiB42 linesraw
1//TEST:REFLECTION(filecheck=METAL): -target metal
2//TEST(compute, metal):COMPARE_COMPUTE(filecheck-buffer=BUF):-metal -slang -compute -output-using-type
3//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -slang -compute -output-using-type
4
5
6// METAL: "name": "gParams",
7// METAL: "binding": {"kind": "constantBuffer", "index": 0},
8
9// METAL:"name": "pdata",
10// METAL:"binding": {"kind": "uniform", "offset": 0, "size": 16, "elementStride": 4}
11// METAL:"name": "tex",
12
13// Since we will apply MetalArgumentBufferTier2, 'tex' here will just be a uniform.
14// The pdata is a nested parameter block, so it will be a 64-bit device pointer which take
15// 8 bytes. So the offset of `tex` will be 8 bytes.
16// METAL:"binding": {"kind": "uniform", "offset": 8, "size": 8, "elementStride": 0}
17
18
19// Check that there will be only two bindings.
20//
21// METAL: "name": "output",
22// METAL: "binding": {"kind": "constantBuffer", "index": 1},
23//
24
25//TEST_INPUT: set gParams = new Params{new Data{{0,0,0}}, Texture2D(size=4, content=one)}
26struct Data { int3 content; }
27struct Params
28{
29    ParameterBlock<Data> pdata;
30    Texture2D tex;
31}
32ParameterBlock<Params> gParams;
33
34//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=output
35RWStructuredBuffer<float4> output;
36
37[numthreads(1,1,1)]
38void computeMain()
39{
40    // BUF-COUNT-4: 1.000000
41    output[0] = gParams.tex.Load(gParams.pdata.content);
42}