-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestglsl.cl
46 lines (35 loc) · 985 Bytes
/
testglsl.cl
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
//
// Created by tly on 17.03.2019.
//
#include <opencl_def>
#include <opencl_common>
#include <opencl_geometric>
#include <opengl_shader>
__uniform uint32_t test = 77;
constexpr bool isPrimeLoop(int i, int k) {
return (k*k > i) ? true : (i%k == 0) ? false : isPrimeLoop(i, k + 1);
}
constexpr bool isPrime(int i) {
return isPrimeLoop(i, 2);
}
constexpr int nextPrime(int k) {
return isPrime(k)?k:nextPrime(k + 1);
}
constexpr int getPrimeLoop(int i, int k) {
// i - nr of primes to advance
// k - some starting prime
return (i == 0)?k:getPrimeLoop(i - 1, nextPrime(k + 1));
}
constexpr int getPrime(int i) {
return getPrimeLoop(i, 2);
}
static_assert(getPrime(99) == 541, "computed incorrectly");
template<int N> float4 create_vector(){
return float4(N);
}
int test1 = 22545;
void main() {
int test2 = 2345 + test1;
gl_Position.xy += cl::dot(create_vector<getPrime(99)>(), float4{4,5,6,7}) + test1 + test2;
//gl_ClipDistance[2] = 0.34;
}