forked from Edarke/131P4_Tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
64 lines (52 loc) · 1.72 KB
/
README.txt
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
63
64
How to run:
place repo folder in project directory.
run ./check from within repo folder (run chmod +x check if necessary)
How to write your own tests:
Use existing tests as a template to create .glsl and .dat files.
Create .out file either by running your program or computing the result by hand.
To verify your .out file is correct:
1) copy and paste your .glsl file here: http://shdr.bkcore.com/
2) Add 'precision highp float;' as the first line in the file
3) Add the following main method at the bottom
void main(){
if(_YourFunctionHere_() == _YourOuputHere_)
gl_FragColor = vec4(0,1,0,1.0); // green
else
gl_FragColor = vec4(1,0,0,1.0); // red
}
If your output is correct you will see a green monkey head. If your output is wrong, it'll be red.
Once you verify your test case is correct, create a pull request to share it.
Example (using swizzle.glsl):
/******Original test case *******/
vec2 v = // = .5, 1.5
float test(){
vec3 t;
t = v.xxx + v.xxx; // t = (1, 1, 1)
vec3 f;
f = t; // f = (1, 1, 1)
f.z = -1.0; // f = (1, 1, -1)
t.z = 0.0; // t = (1, 1, 0)
t.x = t.z + t.y; // t = (0, 1, -1)
t.yx = t.xy + t.xy; // t = (2, 0, -1)
return t.x; // 2.0
}
/***** Input for online compiler ******/
precision highp float; // This is always required for shdr.bkcore.com
vec2 v = vec2(.5, 1.5); // Add initializers that were declared in .dat file
float test(){
vec3 t;
t = v.xxx + v.xxx;
vec3 f;
f = t;
f.z = -1.0;
t.z = 0.0;
t.x = t.z + t.y;
t.yx = t.xy + t.xy;
return t.x;
}
void main() {
if(test() == 2.0) // Assert function call returns expected value
gl_FragColor = vec4(0,1,0,1.0); // green
else
gl_FragColor = vec4(1,0,0,1.0); // red
}