yum-mirror/slang

Making it easier to work with shaders

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

Mukund KeshavaEnable tests for CUDA (#7593)141eac9eb

master
2.4 KiB81 linesraw
1//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-vk -compute -shaderobj -output-using-type
2//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-cuda -compute -shaderobj -output-using-type
3
4//TEST_INPUT: ubuffer(data=[0], stride=4):out,name outputBuffer
5RWStructuredBuffer<int> outputBuffer;
6
7[numthreads(1,1,1)]
8void computeMain()
9{
10    bool result = true
11        && (0.x is int)
12        && 0 == 0.x
13        && all(uint2(0) == 0.xx)
14        && all(uint3(0) == 0.xxx)
15        && all(uint4(0) == 0.xxxx)
16        && (0.r is int)
17        && 0 == 0.r
18        && all(uint2(0) == 0.rr)
19        && all(uint3(0) == 0.rrr)
20        && all(uint4(0) == 0.rrrr)
21
22        && (123.x is int)
23        && 123 == 123.x
24        && all(uint2(123) == 123.xx)
25        && all(uint3(123) == 123.xxx)
26        && all(uint4(123) == 123.xxxx)
27        && (123.r is int)
28        && 123 == 123.r
29        && all(uint2(123) == 123.rr)
30        && all(uint3(123) == 123.rrr)
31        && all(uint4(123) == 123.rrrr)
32
33        && (0.f.x is float)
34        && 0.f == 0.f.x
35        && all(float2(0.f) == 0.f.xx)
36        && all(float3(0.f) == 0.f.xxx)
37        && all(float4(0.f) == 0.f.xxxx)
38        && (0.f.r is float)
39        && 0.f == 0.f.r
40        && all(float2(0.f) == 0.f.rr)
41        && all(float3(0.f) == 0.f.rrr)
42        && all(float4(0.f) == 0.f.rrrr)
43
44        && (123.f.x is float)
45        && 123.f == 123.f.x
46        && all(float2(123.f) == 123.f.xx)
47        && all(float3(123.f) == 123.f.xxx)
48        && all(float4(123.f) == 123.f.xxxx)
49        && (123.f.r is float)
50        && 123.f == 123.f.r
51        && all(float2(123.f) == 123.f.rr)
52        && all(float3(123.f) == 123.f.rrr)
53        && all(float4(123.f) == 123.f.rrrr)
54
55        && (0..x is float)
56        && 0.f == 0..x
57        && all(float2(0.f) == 0..xx)
58        && all(float3(0.f) == 0..xxx)
59        && all(float4(0.f) == 0..xxxx)
60        && (0..r is float)
61        && 0.f == 0..r
62        && all(float2(0.f) == 0..rr)
63        && all(float3(0.f) == 0..rrr)
64        && all(float4(0.f) == 0..rrrr)
65
66        && (123..x is float)
67        && 123.f == 123..x
68        && all(float2(123.f) == 123..xx)
69        && all(float3(123.f) == 123..xxx)
70        && all(float4(123.f) == 123..xxxx)
71        && (123..r is float)
72        && 123.f == 123..r
73        && all(float2(123.f) == 123..rr)
74        && all(float3(123.f) == 123..rrr)
75        && all(float4(123.f) == 123..rrrr)
76        ;
77
78    //CHK:1
79    outputBuffer[0] = int(result);
80}
81