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

Side by Side Diff: conformance/ogles/GL/functions/mat4_empty_empty_mat4_array_frag.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 const mat4 mat_ones = mat4(1.0, 1.0, 1.0, 1.0,
32 1.0, 1.0, 1.0, 1.0,
33 1.0, 1.0, 1.0, 1.0,
34 1.0, 1.0, 1.0, 1.0);
35 const mat4 mat_zeros = mat4(0.0, 0.0, 0.0, 0.0,
36 0.0, 0.0, 0.0, 0.0,
37 0.0, 0.0, 0.0, 0.0,
38 0.0, 0.0, 0.0, 0.0);
39
40 // Function declarations.
41 mat4 function(mat4 par[2]);
42 bool is_all(const in mat4 par, const in float value);
43 bool is_all(const in mat4 array[2], const in mat4 value);
44 void set_all(out mat4 array[2], const in mat4 value);
45
46 void main (void)
47 {
48 mat4 par[2];
49 mat4 ret = mat_zeros;
50
51 float gray = 0.0;
52
53 // Initialize the entire array to 1.0.
54 set_all(par, mat_ones);
55
56 ret = function(par);
57
58 // The parameter should remain unchanged by the function and the functio n should return 1.0.
59 if(is_all(par, mat_ones) && is_all(ret, 1.0))
60 {
61 gray = 1.0;
62 }
63
64 gl_FragColor = vec4(gray, gray, gray, 1.0);
65 }
66
67 // Function definitions.
68 mat4 function(mat4 par[2])
69 {
70 // Return the value of the array.
71 if(is_all(par, mat_ones))
72 {
73 // Test parameter qualifier (default is "in").
74 set_all(par, mat_zeros);
75
76 return mat_ones;
77 }
78 else
79 return mat_zeros;
80 }
81
82 bool is_all(const in mat4 par, const in float value)
83 {
84 bool ret = true;
85
86 if(par[0][0] != value)
87 ret = false;
88 if(par[0][1] != value)
89 ret = false;
90 if(par[0][2] != value)
91 ret = false;
92 if(par[0][3] != value)
93 ret = false;
94
95 if(par[1][0] != value)
96 ret = false;
97 if(par[1][1] != value)
98 ret = false;
99 if(par[1][2] != value)
100 ret = false;
101 if(par[1][3] != value)
102 ret = false;
103
104 if(par[2][0] != value)
105 ret = false;
106 if(par[2][1] != value)
107 ret = false;
108 if(par[2][2] != value)
109 ret = false;
110 if(par[2][3] != value)
111 ret = false;
112
113 if(par[3][0] != value)
114 ret = false;
115 if(par[3][1] != value)
116 ret = false;
117 if(par[3][2] != value)
118 ret = false;
119 if(par[3][3] != value)
120 ret = false;
121
122 return ret;
123 }
124
125 bool is_all(const in mat4 array[2], const in mat4 value)
126 {
127 bool ret = true;
128
129 if(array[0] != value)
130 ret = false;
131 if(array[1] != value)
132 ret = false;
133
134 return ret;
135 }
136
137 void set_all(out mat4 array[2], const in mat4 value)
138 {
139 array[0] = value;
140 array[1] = value;
141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698