rev: 21c5e6d2f665d0e8b4ff917a51b664c895dab2ed tukan/testing/test_compute.sc -rw-r--r-- 1.2 KiB View raw Log this file
21c5e6d2f665 — Leonard Ritter * renamed project from Liminal to Tukan 2 years 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env scopes

import ..tukan.glmain
import ..tukan.screen
import glsl

let glmain = tukan.glmain
let screen = tukan.screen

using import glm
using import glsl
using import ..tukan.gl
using import ..tukan.imgui

glmain.init
    title = "Liminal"
    width = 800
    height = 600
    resizable = true

struct InVals
    x : i32
    y : i32
    data : (array u32 0:usize)
struct OutVals
    x : i32
    y : i32

let pg = (glCreateProgram)
let compute-code =
    do
        xvar uniform src_start_offsets : (iimage2D 'R32i)
            binding = 2
            \ coherent readonly restrict
        xvar buffer invals : InVals
            binding = 0
            \ coherent readonly
        xvar buffer outvals : OutVals
            binding = 1
            \ coherent writeonly
        fn main ()
            local_size 1 1 1
            outvals.x =
                (imageLoad src_start_offsets (ivec2 0 0)) . r
            outvals.y = invals.y

            return;

        compile-glsl 'compute
            typify main
            'dump-module
            'dump-disassembly
            #'no-opts

call
    attach-shaders pg
        compute = compute-code

glmain.shutdown;

print "done."