rev: 3827f53bae88e48a594610914ba74b9512ead6dd tukan/testing/test_compute.sc -rw-r--r-- 676 bytes View raw Log this file
3827f53bae88 — Leonard Ritter * more work on module system 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env scopes

using import ..tukan.gpucall
using import glsl
using import glm
using import testing

shared tmp : vec3

@@ gpufn
fn testfunc (x y)
    tmp =
        vec3
            x + y
            x - y
            x * y
    unpack (deref tmp)

print (testfunc 2.0 3.0)
print (testfunc 0.1 0.2)

test ((gpucall bitcount 5) == (bitcount 5))
test ((gpucall findlsb 32768) == (findlsb 32768))
test ((gpucall bitreverse 0b10010110) == (bitreverse 0b10010110))
test (all? ((gpucall findmsb (vectorof i32 1 3 5 9)) == (vectorof i32 0 1 2 3)))
test ((gpucall findmsb 6) == (findmsb 6))
test ((gpucall findmsb 0) == (findmsb 0))
test ((gpucall findlsb 0) == (findlsb 0))

;