yum-mirror/slang

Making it easier to work with shaders

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

Anders LeinoAdd parentheses to make precedence explicit (#6030)dab6cec1e

master
1.0 KiB45 linesraw
1//TEST(compute):COMPARE_COMPUTE:-shaderobj
2
3//TEST_INPUT:ubuffer(data=[3 7 8], stride=4):name=inputBuffer
4RWStructuredBuffer<uint> inputBuffer;
5
6//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
7RWStructuredBuffer<uint> outputBuffer;
8
9[numthreads(1,1,1)]
10void computeMain()
11{
12    uint a = inputBuffer[0];
13    uint b = inputBuffer[1];
14    uint c = inputBuffer[2];
15
16    outputBuffer[0] = a+b ^ c;
17    outputBuffer[1] = a ^ b+c;
18
19    outputBuffer[2] = a-b | c;
20    outputBuffer[3] = a | b-c;
21
22    outputBuffer[4] = a+b & c;
23    outputBuffer[5] = a & b+c;
24
25    outputBuffer[6] = a<<b ^ c;
26    outputBuffer[7] = a ^ b<<c;
27
28    outputBuffer[8] = a>>b | c;
29    outputBuffer[9] = a | b>>c;
30
31    outputBuffer[10] = a<<b & c;
32    outputBuffer[11] = a & b<<c;
33
34    outputBuffer[12] = a<b && b!=c;
35    outputBuffer[13] = a==b || b>=c;
36
37    outputBuffer[14] = a*b ^ c;
38    outputBuffer[15] = a ^ b*c;
39
40    outputBuffer[16] = a/b | c;
41    outputBuffer[17] = a | b/c;
42
43    outputBuffer[18] = a*b & c;
44    outputBuffer[19] = a & b*c;
45}