Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: conformance/ogles/GL/atan/atan_vec3_frag_xvary_ref.frag

Issue 41993002: Add ToT WebGL conformance tests : part 9 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1
2 /*
3 ** Copyright (c) 2012 The Khronos Group Inc.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a
6 ** copy of this software and/or associated documentation files (the
7 ** "Materials"), to deal in the Materials without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Materials, and to
10 ** permit persons to whom the Materials are furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be included
14 ** in all copies or substantial portions of the Materials.
15 **
16 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
23 */
24
25
26 #ifdef GL_ES
27 precision mediump float;
28 #endif
29 varying vec4 color;
30
31 void main (void)
32 {
33 const float M_PI = 3.14159265358979323846;
34 vec3 c = 4.0 * 2.0 * (color.rgb - 0.5);
35 vec3 atan_c = vec3(0.0);
36 vec3 scale = vec3(1.0);
37 vec3 sign = vec3(1.0);
38 vec4 result = vec4(0.0, 0.0, 0.0, 1.0);
39
40
41 if(c[0] < 0.0)
42 {
43 sign[0] = -1.0;
44 c[0] *= -1.0;
45 }
46
47 if(c[0] <= 1.0)
48 {
49 // Taylors series expansion for atan
50 atan_c[0] += scale[0] * pow(c[0], float(1)) / float(1);
51 scale[0] *= -1.0;
52 atan_c[0] += scale[0] * pow(c[0], float(3)) / float(3);
53 scale[0] *= -1.0;
54 atan_c[0] += scale[0] * pow(c[0], float(5)) / float(5);
55 scale[0] *= -1.0;
56 atan_c[0] += scale[0] * pow(c[0], float(7)) / float(7);
57 scale[0] *= -1.0;
58 atan_c[0] += scale[0] * pow(c[0], float(9)) / float(9);
59 scale[0] *= -1.0;
60 atan_c[0] += scale[0] * pow(c[0], float(11)) / float(11);
61 scale[0] *= -1.0;
62
63 result[0] = sign[0] * atan_c[0] / M_PI + 0.5;
64 }
65 else
66 {
67 c[0] = 1.0 / c[0];
68
69 // Taylors series expansion for atan
70 atan_c[0] += scale[0] * pow(c[0], float(1)) / float(1);
71 scale[0] *= -1.0;
72 atan_c[0] += scale[0] * pow(c[0], float(3)) / float(3);
73 scale[0] *= -1.0;
74 atan_c[0] += scale[0] * pow(c[0], float(5)) / float(5);
75 scale[0] *= -1.0;
76 atan_c[0] += scale[0] * pow(c[0], float(7)) / float(7);
77 scale[0] *= -1.0;
78 atan_c[0] += scale[0] * pow(c[0], float(9)) / float(9);
79 scale[0] *= -1.0;
80 atan_c[0] += scale[0] * pow(c[0], float(11)) / float(11);
81 scale[0] *= -1.0;
82
83 result[0] = sign[0] * (M_PI / 2.0 - atan_c[0]) / M_PI + 0.5;
84 }
85
86 if(c[1] < 0.0)
87 {
88 sign[1] = -1.0;
89 c[1] *= -1.0;
90 }
91
92 if(c[1] <= 1.0)
93 {
94 // Taylors series expansion for atan
95 atan_c[1] += scale[1] * pow(c[1], float(1)) / float(1);
96 scale[1] *= -1.0;
97 atan_c[1] += scale[1] * pow(c[1], float(3)) / float(3);
98 scale[1] *= -1.0;
99 atan_c[1] += scale[1] * pow(c[1], float(5)) / float(5);
100 scale[1] *= -1.0;
101 atan_c[1] += scale[1] * pow(c[1], float(7)) / float(7);
102 scale[1] *= -1.0;
103 atan_c[1] += scale[1] * pow(c[1], float(9)) / float(9);
104 scale[1] *= -1.0;
105 atan_c[1] += scale[1] * pow(c[1], float(11)) / float(11);
106 scale[1] *= -1.0;
107
108 result[1] = sign[1] * atan_c[1] / M_PI + 0.5;
109 }
110 else
111 {
112 c[1] = 1.0 / c[1];
113
114 // Taylors series expansion for atan
115 atan_c[1] += scale[1] * pow(c[1], float(1)) / float(1);
116 scale[1] *= -1.0;
117 atan_c[1] += scale[1] * pow(c[1], float(3)) / float(3);
118 scale[1] *= -1.0;
119 atan_c[1] += scale[1] * pow(c[1], float(5)) / float(5);
120 scale[1] *= -1.0;
121 atan_c[1] += scale[1] * pow(c[1], float(7)) / float(7);
122 scale[1] *= -1.0;
123 atan_c[1] += scale[1] * pow(c[1], float(9)) / float(9);
124 scale[1] *= -1.0;
125 atan_c[1] += scale[1] * pow(c[1], float(11)) / float(11);
126 scale[1] *= -1.0;
127
128 result[1] = sign[1] * (M_PI / 2.0 - atan_c[1]) / M_PI + 0.5;
129 }
130
131
132 if(c[2] < 0.0)
133 {
134 sign[2] = -1.0;
135 c[2] *= -1.0;
136 }
137
138 if(c[2] <= 1.0)
139 {
140 // Taylors series expansion for atan
141 atan_c[2] += scale[2] * pow(c[2], float(1)) / float(1);
142 scale[2] *= -1.0;
143 atan_c[2] += scale[2] * pow(c[2], float(3)) / float(3);
144 scale[2] *= -1.0;
145 atan_c[2] += scale[2] * pow(c[2], float(5)) / float(5);
146 scale[2] *= -1.0;
147 atan_c[2] += scale[2] * pow(c[2], float(7)) / float(7);
148 scale[2] *= -1.0;
149 atan_c[2] += scale[2] * pow(c[2], float(9)) / float(9);
150 scale[2] *= -1.0;
151 atan_c[2] += scale[2] * pow(c[2], float(11)) / float(11);
152 scale[2] *= -1.0;
153
154 result[2] = sign[2] * atan_c[2] / M_PI + 0.5;
155 }
156 else
157 {
158 c[2] = 1.0 / c[2];
159
160 // Taylors series expansion for atan
161 atan_c[2] += scale[2] * pow(c[2], float(1)) / float(1);
162 scale[2] *= -1.0;
163 atan_c[2] += scale[2] * pow(c[2], float(3)) / float(3);
164 scale[2] *= -1.0;
165 atan_c[2] += scale[2] * pow(c[2], float(5)) / float(5);
166 scale[2] *= -1.0;
167 atan_c[2] += scale[2] * pow(c[2], float(7)) / float(7);
168 scale[2] *= -1.0;
169 atan_c[2] += scale[2] * pow(c[2], float(9)) / float(9);
170 scale[2] *= -1.0;
171 atan_c[2] += scale[2] * pow(c[2], float(11)) / float(11);
172 scale[2] *= -1.0;
173
174 result[2] = sign[2] * (M_PI / 2.0 - atan_c[2]) / M_PI + 0.5;
175 }
176
177 gl_FragColor = result;
178 }
OLDNEW
« no previous file with comments | « conformance/ogles/GL/atan/atan_vec3_frag_xvary.frag ('k') | conformance/ogles/GL/atan/atan_vec3_frag_xvaryyvary.frag » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698