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.0 KiB38 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECKOUT):-vk -compute -output-using-type
2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECKOUT):-hlsl -compute -output-using-type
3
4// CHECKOUT:      10
5// CHECKOUT-NEXT: 20
6// CHECKOUT-NEXT: 30
7// CHECKOUT-NEXT: 40
8
9struct Test {
10    int f_int;
11};
12
13ParameterBlock<Test> pb_struct;
14uniform Test u_struct;
15uniform Test u_struct_array[2];
16
17RWStructuredBuffer<int> results;
18
19//TEST_INPUT: set pb_struct = new Test{10};
20//TEST_INPUT: uniform(data=[20 0 0 0]):name=u_struct.f_int
21//TEST_INPUT: uniform(data=[30 0 0 0]):name=u_struct_array[0].f_int
22//TEST_INPUT: uniform(data=[40 0 0 0]):name=u_struct_array[1].f_int
23
24//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=results
25
26[shader("compute")]
27[numthreads(1, 1, 1)]
28void computeMain(uint3 tid: SV_DispatchThreadID)
29{
30    if (any(tid != uint3(0)))
31        return;
32
33    results[0] = pb_struct.f_int;
34    results[1] = u_struct.f_int;
35    results[2] = u_struct_array[0].f_int;
36    results[3] = u_struct_array[1].f_int;
37}
38