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

Side by Side Diff: conformance/ogles/GL/sin/sin_vec2_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 float lerp(float a, float b, float s)
32 {
33 return a + (b - a) * s;
34 }
35
36 void main (void)
37 {
38 float sinValues[17];
39 sinValues[0] = 0.0;
40 sinValues[1] = 0.382683;
41 sinValues[2] = 0.707107;
42 sinValues[3] = 0.92388;
43 sinValues[4] = 1.0;
44 sinValues[5] = 0.92388;
45 sinValues[6] = 0.707107;
46 sinValues[7] = 0.382683;
47 sinValues[8] = 0.0;
48 sinValues[9] = -0.382683;
49 sinValues[10] = -0.707107;
50 sinValues[11] = -0.92388;
51 sinValues[12] = -1.0;
52 sinValues[13] = -0.923879;
53 sinValues[14] = -0.707107;
54 sinValues[15] = -0.382683;
55 sinValues[16] = 0.0;
56
57 const float M_PI = 3.14159265358979323846;
58 vec2 c = 2.0 * M_PI * color.rg;
59
60 vec2 arrVal = c * 2.546478971;
61 int arr0x = int(floor(arrVal.x));
62 int arr0y = int(floor(arrVal.y));
63 vec2 weight = arrVal - floor(arrVal);
64 vec2 sin_c = vec2(0.0, 0.0);
65
66 if (arr0x == 0)
67 sin_c.x = lerp(sinValues[0], sinValues[1], weight.x);
68 else if (arr0x == 1)
69 sin_c.x = lerp(sinValues[1], sinValues[2], weight.x);
70 else if (arr0x == 2)
71 sin_c.x = lerp(sinValues[2], sinValues[3], weight.x);
72 else if (arr0x == 3)
73 sin_c.x = lerp(sinValues[3], sinValues[4], weight.x);
74 else if (arr0x == 4)
75 sin_c.x = lerp(sinValues[4], sinValues[5], weight.x);
76 else if (arr0x == 5)
77 sin_c.x = lerp(sinValues[5], sinValues[6], weight.x);
78 else if (arr0x == 6)
79 sin_c.x = lerp(sinValues[6], sinValues[7], weight.x);
80 else if (arr0x == 7)
81 sin_c.x = lerp(sinValues[7], sinValues[8], weight.x);
82 else if (arr0x == 8)
83 sin_c.x = lerp(sinValues[8], sinValues[9], weight.x);
84 else if (arr0x == 9)
85 sin_c.x = lerp(sinValues[9], sinValues[10], weight.x);
86 else if (arr0x == 10)
87 sin_c.x = lerp(sinValues[10], sinValues[11], weight.x);
88 else if (arr0x == 11)
89 sin_c.x = lerp(sinValues[11], sinValues[12], weight.x);
90 else if (arr0x == 12)
91 sin_c.x = lerp(sinValues[12], sinValues[13], weight.x);
92 else if (arr0x == 13)
93 sin_c.x = lerp(sinValues[13], sinValues[14], weight.x);
94 else if (arr0x == 14)
95 sin_c.x = lerp(sinValues[14], sinValues[15], weight.x);
96 else if (arr0x == 15)
97 sin_c.x = lerp(sinValues[15], sinValues[16], weight.x);
98 else if (arr0x == 16)
99 sin_c.x = sinValues[16];
100
101 if (arr0y == 0)
102 sin_c.y = lerp(sinValues[0], sinValues[1], weight.y);
103 else if (arr0y == 1)
104 sin_c.y = lerp(sinValues[1], sinValues[2], weight.y);
105 else if (arr0y == 2)
106 sin_c.y = lerp(sinValues[2], sinValues[3], weight.y);
107 else if (arr0y == 3)
108 sin_c.y = lerp(sinValues[3], sinValues[4], weight.y);
109 else if (arr0y == 4)
110 sin_c.y = lerp(sinValues[4], sinValues[5], weight.y);
111 else if (arr0y == 5)
112 sin_c.y = lerp(sinValues[5], sinValues[6], weight.y);
113 else if (arr0y == 6)
114 sin_c.y = lerp(sinValues[6], sinValues[7], weight.y);
115 else if (arr0y == 7)
116 sin_c.y = lerp(sinValues[7], sinValues[8], weight.y);
117 else if (arr0y == 8)
118 sin_c.y = lerp(sinValues[8], sinValues[9], weight.y);
119 else if (arr0y == 9)
120 sin_c.y = lerp(sinValues[9], sinValues[10], weight.y);
121 else if (arr0y == 10)
122 sin_c.y = lerp(sinValues[10], sinValues[11], weight.y);
123 else if (arr0y == 11)
124 sin_c.y = lerp(sinValues[11], sinValues[12], weight.y);
125 else if (arr0y == 12)
126 sin_c.y = lerp(sinValues[12], sinValues[13], weight.y);
127 else if (arr0y == 13)
128 sin_c.y = lerp(sinValues[13], sinValues[14], weight.y);
129 else if (arr0y == 14)
130 sin_c.y = lerp(sinValues[14], sinValues[15], weight.y);
131 else if (arr0y == 15)
132 sin_c.y = lerp(sinValues[15], sinValues[16], weight.y);
133 else if (arr0y == 16)
134 sin_c.y = sinValues[16];
135
136 gl_FragColor = vec4(0.5 * sin_c + 0.5, 0.0, 1.0);
137 }
OLDNEW
« no previous file with comments | « conformance/ogles/GL/sin/sin_vec2_frag_xvary.frag ('k') | conformance/ogles/GL/sin/sin_vec2_vert_xvary.vert » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698