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

Side by Side Diff: conformance/ogles/GL/functions/mat4_empty_out_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(out 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 be changed by the function and the function shou ld return 1.0.
59 if(is_all(par, mat_zeros) && 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(out mat4 par[2])
69 {
70 // Test parameter qualifier (default is "in").
71 set_all(par, mat_zeros);
72
73 return mat_ones;
74 }
75
76 bool is_all(const in mat4 par, const in float value)
77 {
78 bool ret = true;
79
80 if(par[0][0] != value)
81 ret = false;
82 if(par[0][1] != value)
83 ret = false;
84 if(par[0][2] != value)
85 ret = false;
86 if(par[0][3] != value)
87 ret = false;
88
89 if(par[1][0] != value)
90 ret = false;
91 if(par[1][1] != value)
92 ret = false;
93 if(par[1][2] != value)
94 ret = false;
95 if(par[1][3] != value)
96 ret = false;
97
98 if(par[2][0] != value)
99 ret = false;
100 if(par[2][1] != value)
101 ret = false;
102 if(par[2][2] != value)
103 ret = false;
104 if(par[2][3] != value)
105 ret = false;
106
107 if(par[3][0] != value)
108 ret = false;
109 if(par[3][1] != value)
110 ret = false;
111 if(par[3][2] != value)
112 ret = false;
113 if(par[3][3] != value)
114 ret = false;
115
116 return ret;
117 }
118
119 bool is_all(const in mat4 array[2], const in mat4 value)
120 {
121 bool ret = true;
122
123 if(array[0] != value)
124 ret = false;
125 if(array[1] != value)
126 ret = false;
127
128 return ret;
129 }
130
131 void set_all(out mat4 array[2], const in mat4 value)
132 {
133 array[0] = value;
134 array[1] = value;
135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698