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
2.3 KiB88 linesraw
1//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-dx12 -compute -output-using-type
2
3// Vulkan/GLSL doesn't support 1-dimensional matrix.
4//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-vk -compute -output-using-type -emit-spirv-via-glsl
5//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-vk -compute -output-using-type -emit-spirv-directly
6
7//TEST_INPUT: ubuffer(data=[0.0 1.0 2.0 3.0], stride=4):name=inputBuffer
8RWStructuredBuffer<float> inputBuffer;
9
10//TEST_INPUT: ubuffer(data=[0], stride=4):out,name=outputBuffer
11RWStructuredBuffer<int> outputBuffer;
12
13[numthreads(1,1,1)]
14void computeMain()
15{
16    float v0 = inputBuffer[0];
17    float v1 = inputBuffer[1];
18    float v2 = inputBuffer[2];
19    float v3 = inputBuffer[3];
20    float result = 0.f;
21
22    {
23        float1x1 a = v0;
24        float1x1 b = v1;
25        b += a;
26        result += b[0][0];
27
28        float1x1 c = v2;
29        float1x1 d = v3;
30        d -= c;
31        result += d[0][0];
32
33        float1x1 e = v0;
34        float1x1 f = v1;
35        f *= e;
36        result += f[0][0];
37
38        float1x1 g = v2;
39        float1x1 h = v3;
40        g /= h;
41        result += g[0][0];
42    }
43    {
44        float1x2 a = float1x2(v0, v1);
45        float1x2 b = float1x2(v2, v3);
46        b += a;
47        result += b[0][0] + b[0][1];
48
49        float1x2 c = float1x2(v0, v1);
50        float1x2 d = float1x2(v2, v3);
51        d -= c;
52        result += d[0][0] + d[0][1];
53
54        float1x2 e = float1x2(v0, v1);
55        float1x2 f = float1x2(v2, v3);
56        f *= e;
57        result += f[0][0] + f[0][1];
58
59        float1x2 g = float1x2(v0, v1);
60        float1x2 h = float1x2(v2, v3);
61        g /= h;
62        result += g[0][0] + g[0][1];
63    }
64    {
65        float2x1 a = float2x1(v0, v1);
66        float2x1 b = float2x1(v2, v3);
67        b += a;
68        result += b[0][0] + b[0][1];
69
70        float2x1 c = float2x1(v0, v1);
71        float2x1 d = float2x1(v2, v3);
72        d -= c;
73        result += d[0][0] + d[0][1];
74
75        float2x1 e = float2x1(v0, v1);
76        float2x1 f = float2x1(v2, v3);
77        f *= e;
78        result += f[0][0] + f[0][1];
79
80        float2x1 g = float2x1(v0, v1);
81        float2x1 h = float2x1(v2, v3);
82        g /= h;
83        result += g[0][0] + g[0][1];
84    }
85
86    //CHK:24
87    outputBuffer[0] = int(result);
88}