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

Side by Side Diff: conformance/ogles/GL/asin/asin_float_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, 2 months 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 /* The following files are direct copies of each other:
27 *
28 * GL/acos/acos_float_frag_xvary_ref.frag
29 * GL/asin/asin_float_frag_xvary_ref.frag
30 *
31 * Care should be taken to apply any changes to both. Only the last
32 * line where gl_FragColor is assigned should be different.
33 */
34
35 #ifdef GL_ES
36 precision mediump float;
37 #endif
38 varying vec4 color;
39
40 float lerp(float a, float b, float s)
41 {
42 return a + (b - a) * s;
43 }
44
45 void main (void)
46 {
47 float asinValues[17];
48 asinValues[0] = -1.5708;
49 asinValues[1] = -1.06544;
50 asinValues[2] = -0.848062;
51 asinValues[3] = -0.675132;
52 asinValues[4] = -0.523599;
53 asinValues[5] = -0.384397;
54 asinValues[6] = -0.25268;
55 asinValues[7] = -0.125328;
56 asinValues[8] = 0.0;
57 asinValues[9] = 0.125328;
58 asinValues[10] = 0.25268;
59 asinValues[11] = 0.384397;
60 asinValues[12] = 0.523599;
61 asinValues[13] = 0.675132;
62 asinValues[14] = 0.848062;
63 asinValues[15] = 1.06544;
64 asinValues[16] = 1.5708;
65
66 const float M_PI = 3.14159265358979323846;
67 float c = 2.0 * (color.r - 0.5);
68
69 float arrVal = (c + 1.0) * 8.0;
70 int arr0 = int(floor(arrVal));
71 float weight = arrVal - floor(arrVal);
72 float asin_c = 0.0;
73
74 if (arr0 == 0)
75 asin_c = lerp(asinValues[0], asinValues[1], weight);
76 else if (arr0 == 1)
77 asin_c = lerp(asinValues[1], asinValues[2], weight);
78 else if (arr0 == 2)
79 asin_c = lerp(asinValues[2], asinValues[3], weight);
80 else if (arr0 == 3)
81 asin_c = lerp(asinValues[3], asinValues[4], weight);
82 else if (arr0 == 4)
83 asin_c = lerp(asinValues[4], asinValues[5], weight);
84 else if (arr0 == 5)
85 asin_c = lerp(asinValues[5], asinValues[6], weight);
86 else if (arr0 == 6)
87 asin_c = lerp(asinValues[6], asinValues[7], weight);
88 else if (arr0 == 7)
89 asin_c = lerp(asinValues[7], asinValues[8], weight);
90 else if (arr0 == 8)
91 asin_c = lerp(asinValues[8], asinValues[9], weight);
92 else if (arr0 == 9)
93 asin_c = lerp(asinValues[9], asinValues[10], weight);
94 else if (arr0 == 10)
95 asin_c = lerp(asinValues[10], asinValues[11], weight);
96 else if (arr0 == 11)
97 asin_c = lerp(asinValues[11], asinValues[12], weight);
98 else if (arr0 == 12)
99 asin_c = lerp(asinValues[12], asinValues[13], weight);
100 else if (arr0 == 13)
101 asin_c = lerp(asinValues[13], asinValues[14], weight);
102 else if (arr0 == 14)
103 asin_c = lerp(asinValues[14], asinValues[15], weight);
104 else if (arr0 == 15)
105 asin_c = lerp(asinValues[15], asinValues[16], weight);
106 else if (arr0 == 16)
107 asin_c = asinValues[16];
108
109 gl_FragColor = vec4(asin_c / M_PI + 0.5, 0.0, 0.0, 1.0);
110 }
OLDNEW
« no previous file with comments | « conformance/ogles/GL/asin/asin_float_frag_xvary.frag ('k') | conformance/ogles/GL/asin/asin_float_vert_xvary.vert » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698