yum-mirror/slang

Making it easier to work with shaders

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

James Helferty (NVIDIA)render-test: Change D3D12 default to sm_6_5 (#8320)f02b08490

master
1.5 KiB48 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-dx12 -compute -output-using-type
2//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -output-using-type
3//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cuda -compute -output-using-type
4
5//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly
6
7// To check that our counter-initialization works correctly, set the initial
8// counter to 1 instead of 0
9//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4, counter=1):out,name=outputBuffer
10AppendStructuredBuffer<int> outputBuffer;
11
12//TEST_INPUT:set inBuffer = ubuffer(data=[1 2 3 4], stride=4)
13RWStructuredBuffer<int> inBuffer;
14
15// Make sure the bindings are correct. outputBuffer should take two slots, and inBuffer
16// should be at binding 2.
17// CHECK: OpDecorate %inBuffer Binding 2
18
19[numthreads(4, 1, 1)]
20void computeMain(uint i : SV_GroupIndex)
21{
22    int g = inBuffer[i];
23    outputBuffer.Append(g);
24
25    GroupMemoryBarrier();
26
27    uint numStructs, stride;
28    outputBuffer.GetDimensions(numStructs, stride);
29    if(i == 0)
30        outputBuffer.Append(int(numStructs));
31
32    // BUF: type: int32_t
33    // Never assigned, as we set the initial counter to 1
34    // BUF: 0
35
36    // The values from inBuffer in any order
37    // BUF-DAG: 1
38    // BUF-DAG: 3
39    // BUF-DAG: 2
40    // BUF-DAG: 4
41
42    // The total size of the AppendStructuredBuffer (from GetDimensions)
43    // BUF: 8
44
45    // Never assigned
46    // BUF: 0
47    // BUF: 0
48}