]> gitweb.factorcode.org Git - factor.git/blob - extra/gpu/render/render-tests.factor
factor: rename [ ] [ ] unit-test -> { } [ ] unit-test using a refactoring tool!
[factor.git] / extra / gpu / render / render-tests.factor
1 USING: accessors combinators gpu.render gpu.render.private kernel sequences tools.test ;
2 IN: gpu.render.tests
3
4 UNIFORM-TUPLE: two-textures
5     { "argyle"       texture-uniform f }
6     { "thread-count" float-uniform   f }
7     { "tweed"        texture-uniform f } ;
8
9 UNIFORM-TUPLE: inherited-textures < two-textures
10     { "paisley" texture-uniform f } ;
11
12 UNIFORM-TUPLE: array-of-textures < two-textures
13     { "plaids" texture-uniform 4 } ;
14
15 UNIFORM-TUPLE: struct-containing-texture
16     { "threads" two-textures f } ;
17
18 UNIFORM-TUPLE: array-of-struct-containing-texture
19     { "threads" inherited-textures 3 } ;
20
21 UNIFORM-TUPLE: array-of-struct-containing-array-of-texture
22     { "threads" array-of-textures 2 } ;
23
24 {  1 } [ texture-uniform uniform-type-texture-units ] unit-test
25 {  0 } [ float-uniform uniform-type-texture-units ] unit-test
26 {  2 } [ two-textures uniform-type-texture-units ] unit-test
27 {  3 } [ inherited-textures uniform-type-texture-units ] unit-test
28 {  6 } [ array-of-textures uniform-type-texture-units ] unit-test
29 {  2 } [ struct-containing-texture uniform-type-texture-units ] unit-test
30 {  9 } [ array-of-struct-containing-texture uniform-type-texture-units ] unit-test
31 { 12 } [ array-of-struct-containing-array-of-texture uniform-type-texture-units ] unit-test
32
33 { { [ ] } } [ texture-uniform f uniform-texture-accessors ] unit-test
34
35 { { } } [ float-uniform f uniform-texture-accessors ] unit-test
36
37 { { [ argyle>> ] [ tweed>> ] } } [ two-textures f uniform-texture-accessors ] unit-test
38
39 { { [ argyle>> ] [ tweed>> ] [ paisley>> ] } }
40 [ inherited-textures f uniform-texture-accessors ] unit-test
41
42 { {
43     [ argyle>> ]
44     [ tweed>> ]
45     [ plaids>> {
46         [ 0 swap nth ]
47         [ 1 swap nth ]
48         [ 2 swap nth ]
49         [ 3 swap nth ]
50     } ]
51 } } [ array-of-textures f uniform-texture-accessors ] unit-test
52
53 { {
54     [ threads>> {
55         [ argyle>> ]
56         [ tweed>> ]
57     } ]
58 } } [ struct-containing-texture f uniform-texture-accessors ] unit-test
59
60 { {
61     [ threads>> {
62         [ 0 swap nth {
63             [ argyle>> ]
64             [ tweed>> ]
65             [ paisley>> ]
66         } ]
67         [ 1 swap nth {
68             [ argyle>> ]
69             [ tweed>> ]
70             [ paisley>> ]
71         } ]
72         [ 2 swap nth {
73             [ argyle>> ]
74             [ tweed>> ]
75             [ paisley>> ]
76         } ]
77     } ]
78 } } [ array-of-struct-containing-texture f uniform-texture-accessors ] unit-test
79
80 { {
81     [ threads>> {
82         [ 0 swap nth {
83             [ argyle>> ]
84             [ tweed>> ]
85             [ plaids>> {
86                 [ 0 swap nth ]
87                 [ 1 swap nth ]
88                 [ 2 swap nth ]
89                 [ 3 swap nth ]
90             } ]
91         } ]
92         [ 1 swap nth {
93             [ argyle>> ]
94             [ tweed>> ]
95             [ plaids>> {
96                 [ 0 swap nth ]
97                 [ 1 swap nth ]
98                 [ 2 swap nth ]
99                 [ 3 swap nth ]
100             } ]
101         } ]
102     } ]
103 } } [ array-of-struct-containing-array-of-texture f uniform-texture-accessors ] unit-test
104
105 { [
106     nip {
107         [ argyle>> 0 (bind-texture-unit) ]
108         [ tweed>> 1 (bind-texture-unit) ]
109         [ plaids>> {
110             [ 0 swap nth 2 (bind-texture-unit) ]
111             [ 1 swap nth 3 (bind-texture-unit) ]
112             [ 2 swap nth 4 (bind-texture-unit) ]
113             [ 3 swap nth 5 (bind-texture-unit) ]
114         } cleave ]
115     } cleave
116 ] } [ array-of-textures [bind-uniform-textures] ] unit-test