OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is auto-generated from | 5 // This file is auto-generated from |
6 // gpu/command_buffer/build_gles2_cmd_buffer.py | 6 // gpu/command_buffer/build_gles2_cmd_buffer.py |
7 // DO NOT EDIT! | 7 // DO NOT EDIT! |
8 | 8 |
9 // This file is included by gles2_implementation.h to declare the | 9 // This file is included by gles2_implementation.h to declare the |
10 // GL api functions. | 10 // GL api functions. |
11 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ | 11 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ |
12 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ | 12 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ |
13 | 13 |
14 | 14 |
15 TEST_F(GLES2ImplementationTest, AttachShader) { | 15 TEST_F(GLES2ImplementationTest, AttachShader) { |
16 struct Cmds { | 16 struct Cmds { |
17 AttachShader cmd; | 17 cmds::AttachShader cmd; |
18 }; | 18 }; |
19 Cmds expected; | 19 Cmds expected; |
20 expected.cmd.Init(1, 2); | 20 expected.cmd.Init(1, 2); |
21 | 21 |
22 gl_->AttachShader(1, 2); | 22 gl_->AttachShader(1, 2); |
23 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 23 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
24 } | 24 } |
25 // TODO: Implement unit test for BindAttribLocation | 25 // TODO: Implement unit test for BindAttribLocation |
26 | 26 |
27 TEST_F(GLES2ImplementationTest, BindBuffer) { | 27 TEST_F(GLES2ImplementationTest, BindBuffer) { |
28 struct Cmds { | 28 struct Cmds { |
29 BindBuffer cmd; | 29 cmds::BindBuffer cmd; |
30 }; | 30 }; |
31 Cmds expected; | 31 Cmds expected; |
32 expected.cmd.Init(GL_ARRAY_BUFFER, 2); | 32 expected.cmd.Init(GL_ARRAY_BUFFER, 2); |
33 | 33 |
34 gl_->BindBuffer(GL_ARRAY_BUFFER, 2); | 34 gl_->BindBuffer(GL_ARRAY_BUFFER, 2); |
35 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 35 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
36 ClearCommands(); | 36 ClearCommands(); |
37 gl_->BindBuffer(GL_ARRAY_BUFFER, 2); | 37 gl_->BindBuffer(GL_ARRAY_BUFFER, 2); |
38 EXPECT_TRUE(NoCommandsWritten()); | 38 EXPECT_TRUE(NoCommandsWritten()); |
39 } | 39 } |
40 | 40 |
41 TEST_F(GLES2ImplementationTest, BindFramebuffer) { | 41 TEST_F(GLES2ImplementationTest, BindFramebuffer) { |
42 struct Cmds { | 42 struct Cmds { |
43 BindFramebuffer cmd; | 43 cmds::BindFramebuffer cmd; |
44 }; | 44 }; |
45 Cmds expected; | 45 Cmds expected; |
46 expected.cmd.Init(GL_FRAMEBUFFER, 2); | 46 expected.cmd.Init(GL_FRAMEBUFFER, 2); |
47 | 47 |
48 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2); | 48 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2); |
49 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 49 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
50 ClearCommands(); | 50 ClearCommands(); |
51 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2); | 51 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2); |
52 EXPECT_TRUE(NoCommandsWritten()); | 52 EXPECT_TRUE(NoCommandsWritten()); |
53 } | 53 } |
54 | 54 |
55 TEST_F(GLES2ImplementationTest, BindRenderbuffer) { | 55 TEST_F(GLES2ImplementationTest, BindRenderbuffer) { |
56 struct Cmds { | 56 struct Cmds { |
57 BindRenderbuffer cmd; | 57 cmds::BindRenderbuffer cmd; |
58 }; | 58 }; |
59 Cmds expected; | 59 Cmds expected; |
60 expected.cmd.Init(GL_RENDERBUFFER, 2); | 60 expected.cmd.Init(GL_RENDERBUFFER, 2); |
61 | 61 |
62 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2); | 62 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2); |
63 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 63 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
64 ClearCommands(); | 64 ClearCommands(); |
65 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2); | 65 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2); |
66 EXPECT_TRUE(NoCommandsWritten()); | 66 EXPECT_TRUE(NoCommandsWritten()); |
67 } | 67 } |
68 | 68 |
69 TEST_F(GLES2ImplementationTest, BlendColor) { | 69 TEST_F(GLES2ImplementationTest, BlendColor) { |
70 struct Cmds { | 70 struct Cmds { |
71 BlendColor cmd; | 71 cmds::BlendColor cmd; |
72 }; | 72 }; |
73 Cmds expected; | 73 Cmds expected; |
74 expected.cmd.Init(1, 2, 3, 4); | 74 expected.cmd.Init(1, 2, 3, 4); |
75 | 75 |
76 gl_->BlendColor(1, 2, 3, 4); | 76 gl_->BlendColor(1, 2, 3, 4); |
77 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 77 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
78 } | 78 } |
79 | 79 |
80 TEST_F(GLES2ImplementationTest, BlendEquation) { | 80 TEST_F(GLES2ImplementationTest, BlendEquation) { |
81 struct Cmds { | 81 struct Cmds { |
82 BlendEquation cmd; | 82 cmds::BlendEquation cmd; |
83 }; | 83 }; |
84 Cmds expected; | 84 Cmds expected; |
85 expected.cmd.Init(GL_FUNC_SUBTRACT); | 85 expected.cmd.Init(GL_FUNC_SUBTRACT); |
86 | 86 |
87 gl_->BlendEquation(GL_FUNC_SUBTRACT); | 87 gl_->BlendEquation(GL_FUNC_SUBTRACT); |
88 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 88 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
89 } | 89 } |
90 | 90 |
91 TEST_F(GLES2ImplementationTest, BlendEquationSeparate) { | 91 TEST_F(GLES2ImplementationTest, BlendEquationSeparate) { |
92 struct Cmds { | 92 struct Cmds { |
93 BlendEquationSeparate cmd; | 93 cmds::BlendEquationSeparate cmd; |
94 }; | 94 }; |
95 Cmds expected; | 95 Cmds expected; |
96 expected.cmd.Init(GL_FUNC_SUBTRACT, GL_FUNC_ADD); | 96 expected.cmd.Init(GL_FUNC_SUBTRACT, GL_FUNC_ADD); |
97 | 97 |
98 gl_->BlendEquationSeparate(GL_FUNC_SUBTRACT, GL_FUNC_ADD); | 98 gl_->BlendEquationSeparate(GL_FUNC_SUBTRACT, GL_FUNC_ADD); |
99 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 99 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
100 } | 100 } |
101 | 101 |
102 TEST_F(GLES2ImplementationTest, BlendFunc) { | 102 TEST_F(GLES2ImplementationTest, BlendFunc) { |
103 struct Cmds { | 103 struct Cmds { |
104 BlendFunc cmd; | 104 cmds::BlendFunc cmd; |
105 }; | 105 }; |
106 Cmds expected; | 106 Cmds expected; |
107 expected.cmd.Init(GL_ZERO, GL_ZERO); | 107 expected.cmd.Init(GL_ZERO, GL_ZERO); |
108 | 108 |
109 gl_->BlendFunc(GL_ZERO, GL_ZERO); | 109 gl_->BlendFunc(GL_ZERO, GL_ZERO); |
110 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 110 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
111 } | 111 } |
112 | 112 |
113 TEST_F(GLES2ImplementationTest, BlendFuncSeparate) { | 113 TEST_F(GLES2ImplementationTest, BlendFuncSeparate) { |
114 struct Cmds { | 114 struct Cmds { |
115 BlendFuncSeparate cmd; | 115 cmds::BlendFuncSeparate cmd; |
116 }; | 116 }; |
117 Cmds expected; | 117 Cmds expected; |
118 expected.cmd.Init(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO); | 118 expected.cmd.Init(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO); |
119 | 119 |
120 gl_->BlendFuncSeparate(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO); | 120 gl_->BlendFuncSeparate(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO); |
121 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 121 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
122 } | 122 } |
123 | 123 |
124 TEST_F(GLES2ImplementationTest, CheckFramebufferStatus) { | 124 TEST_F(GLES2ImplementationTest, CheckFramebufferStatus) { |
125 struct Cmds { | 125 struct Cmds { |
126 CheckFramebufferStatus cmd; | 126 cmds::CheckFramebufferStatus cmd; |
127 }; | 127 }; |
128 | 128 |
129 typedef CheckFramebufferStatus::Result Result; | 129 typedef cmds::CheckFramebufferStatus::Result Result; |
130 Cmds expected; | 130 Cmds expected; |
131 ExpectedMemoryInfo result1 = | 131 ExpectedMemoryInfo result1 = |
132 GetExpectedResultMemory(sizeof(CheckFramebufferStatus::Result)); | 132 GetExpectedResultMemory(sizeof(cmds::CheckFramebufferStatus::Result)); |
133 expected.cmd.Init(1, result1.id, result1.offset); | 133 expected.cmd.Init(1, result1.id, result1.offset); |
134 | 134 |
135 EXPECT_CALL(*command_buffer(), OnFlush()) | 135 EXPECT_CALL(*command_buffer(), OnFlush()) |
136 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 136 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
137 .RetiresOnSaturation(); | 137 .RetiresOnSaturation(); |
138 | 138 |
139 GLboolean result = gl_->CheckFramebufferStatus(1); | 139 GLboolean result = gl_->CheckFramebufferStatus(1); |
140 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 140 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
141 EXPECT_TRUE(result); | 141 EXPECT_TRUE(result); |
142 } | 142 } |
143 | 143 |
144 TEST_F(GLES2ImplementationTest, Clear) { | 144 TEST_F(GLES2ImplementationTest, Clear) { |
145 struct Cmds { | 145 struct Cmds { |
146 Clear cmd; | 146 cmds::Clear cmd; |
147 }; | 147 }; |
148 Cmds expected; | 148 Cmds expected; |
149 expected.cmd.Init(1); | 149 expected.cmd.Init(1); |
150 | 150 |
151 gl_->Clear(1); | 151 gl_->Clear(1); |
152 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 152 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
153 } | 153 } |
154 | 154 |
155 TEST_F(GLES2ImplementationTest, ClearColor) { | 155 TEST_F(GLES2ImplementationTest, ClearColor) { |
156 struct Cmds { | 156 struct Cmds { |
157 ClearColor cmd; | 157 cmds::ClearColor cmd; |
158 }; | 158 }; |
159 Cmds expected; | 159 Cmds expected; |
160 expected.cmd.Init(1, 2, 3, 4); | 160 expected.cmd.Init(1, 2, 3, 4); |
161 | 161 |
162 gl_->ClearColor(1, 2, 3, 4); | 162 gl_->ClearColor(1, 2, 3, 4); |
163 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 163 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
164 } | 164 } |
165 | 165 |
166 TEST_F(GLES2ImplementationTest, ClearDepthf) { | 166 TEST_F(GLES2ImplementationTest, ClearDepthf) { |
167 struct Cmds { | 167 struct Cmds { |
168 ClearDepthf cmd; | 168 cmds::ClearDepthf cmd; |
169 }; | 169 }; |
170 Cmds expected; | 170 Cmds expected; |
171 expected.cmd.Init(1); | 171 expected.cmd.Init(1); |
172 | 172 |
173 gl_->ClearDepthf(1); | 173 gl_->ClearDepthf(1); |
174 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 174 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
175 } | 175 } |
176 | 176 |
177 TEST_F(GLES2ImplementationTest, ClearStencil) { | 177 TEST_F(GLES2ImplementationTest, ClearStencil) { |
178 struct Cmds { | 178 struct Cmds { |
179 ClearStencil cmd; | 179 cmds::ClearStencil cmd; |
180 }; | 180 }; |
181 Cmds expected; | 181 Cmds expected; |
182 expected.cmd.Init(1); | 182 expected.cmd.Init(1); |
183 | 183 |
184 gl_->ClearStencil(1); | 184 gl_->ClearStencil(1); |
185 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 185 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
186 } | 186 } |
187 | 187 |
188 TEST_F(GLES2ImplementationTest, ColorMask) { | 188 TEST_F(GLES2ImplementationTest, ColorMask) { |
189 struct Cmds { | 189 struct Cmds { |
190 ColorMask cmd; | 190 cmds::ColorMask cmd; |
191 }; | 191 }; |
192 Cmds expected; | 192 Cmds expected; |
193 expected.cmd.Init(true, true, true, true); | 193 expected.cmd.Init(true, true, true, true); |
194 | 194 |
195 gl_->ColorMask(true, true, true, true); | 195 gl_->ColorMask(true, true, true, true); |
196 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 196 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
197 } | 197 } |
198 | 198 |
199 TEST_F(GLES2ImplementationTest, CompileShader) { | 199 TEST_F(GLES2ImplementationTest, CompileShader) { |
200 struct Cmds { | 200 struct Cmds { |
201 CompileShader cmd; | 201 cmds::CompileShader cmd; |
202 }; | 202 }; |
203 Cmds expected; | 203 Cmds expected; |
204 expected.cmd.Init(1); | 204 expected.cmd.Init(1); |
205 | 205 |
206 gl_->CompileShader(1); | 206 gl_->CompileShader(1); |
207 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 207 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
208 } | 208 } |
209 // TODO: Implement unit test for CompressedTexImage2D | 209 // TODO: Implement unit test for CompressedTexImage2D |
210 // TODO: Implement unit test for CompressedTexSubImage2D | 210 // TODO: Implement unit test for CompressedTexSubImage2D |
211 | 211 |
212 TEST_F(GLES2ImplementationTest, CopyTexImage2D) { | 212 TEST_F(GLES2ImplementationTest, CopyTexImage2D) { |
213 struct Cmds { | 213 struct Cmds { |
214 CopyTexImage2D cmd; | 214 cmds::CopyTexImage2D cmd; |
215 }; | 215 }; |
216 Cmds expected; | 216 Cmds expected; |
217 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 0); | 217 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 0); |
218 | 218 |
219 gl_->CopyTexImage2D(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 0); | 219 gl_->CopyTexImage2D(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 0); |
220 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 220 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
221 } | 221 } |
222 | 222 |
223 TEST_F(GLES2ImplementationTest, CopyTexSubImage2D) { | 223 TEST_F(GLES2ImplementationTest, CopyTexSubImage2D) { |
224 struct Cmds { | 224 struct Cmds { |
225 CopyTexSubImage2D cmd; | 225 cmds::CopyTexSubImage2D cmd; |
226 }; | 226 }; |
227 Cmds expected; | 227 Cmds expected; |
228 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8); | 228 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8); |
229 | 229 |
230 gl_->CopyTexSubImage2D(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8); | 230 gl_->CopyTexSubImage2D(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8); |
231 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 231 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
232 } | 232 } |
233 | 233 |
234 TEST_F(GLES2ImplementationTest, CullFace) { | 234 TEST_F(GLES2ImplementationTest, CullFace) { |
235 struct Cmds { | 235 struct Cmds { |
236 CullFace cmd; | 236 cmds::CullFace cmd; |
237 }; | 237 }; |
238 Cmds expected; | 238 Cmds expected; |
239 expected.cmd.Init(GL_FRONT); | 239 expected.cmd.Init(GL_FRONT); |
240 | 240 |
241 gl_->CullFace(GL_FRONT); | 241 gl_->CullFace(GL_FRONT); |
242 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 242 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
243 } | 243 } |
244 | 244 |
245 TEST_F(GLES2ImplementationTest, DeleteBuffers) { | 245 TEST_F(GLES2ImplementationTest, DeleteBuffers) { |
246 GLuint ids[2] = { kBuffersStartId, kBuffersStartId + 1 }; | 246 GLuint ids[2] = { kBuffersStartId, kBuffersStartId + 1 }; |
247 struct Cmds { | 247 struct Cmds { |
248 DeleteBuffersImmediate del; | 248 cmds::DeleteBuffersImmediate del; |
249 GLuint data[2]; | 249 GLuint data[2]; |
250 }; | 250 }; |
251 Cmds expected; | 251 Cmds expected; |
252 expected.del.Init(arraysize(ids), &ids[0]); | 252 expected.del.Init(arraysize(ids), &ids[0]); |
253 expected.data[0] = kBuffersStartId; | 253 expected.data[0] = kBuffersStartId; |
254 expected.data[1] = kBuffersStartId + 1; | 254 expected.data[1] = kBuffersStartId + 1; |
255 gl_->DeleteBuffers(arraysize(ids), &ids[0]); | 255 gl_->DeleteBuffers(arraysize(ids), &ids[0]); |
256 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 256 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
257 } | 257 } |
258 | 258 |
259 TEST_F(GLES2ImplementationTest, DeleteFramebuffers) { | 259 TEST_F(GLES2ImplementationTest, DeleteFramebuffers) { |
260 GLuint ids[2] = { kFramebuffersStartId, kFramebuffersStartId + 1 }; | 260 GLuint ids[2] = { kFramebuffersStartId, kFramebuffersStartId + 1 }; |
261 struct Cmds { | 261 struct Cmds { |
262 DeleteFramebuffersImmediate del; | 262 cmds::DeleteFramebuffersImmediate del; |
263 GLuint data[2]; | 263 GLuint data[2]; |
264 }; | 264 }; |
265 Cmds expected; | 265 Cmds expected; |
266 expected.del.Init(arraysize(ids), &ids[0]); | 266 expected.del.Init(arraysize(ids), &ids[0]); |
267 expected.data[0] = kFramebuffersStartId; | 267 expected.data[0] = kFramebuffersStartId; |
268 expected.data[1] = kFramebuffersStartId + 1; | 268 expected.data[1] = kFramebuffersStartId + 1; |
269 gl_->DeleteFramebuffers(arraysize(ids), &ids[0]); | 269 gl_->DeleteFramebuffers(arraysize(ids), &ids[0]); |
270 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 270 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
271 } | 271 } |
272 | 272 |
273 TEST_F(GLES2ImplementationTest, DeleteProgram) { | 273 TEST_F(GLES2ImplementationTest, DeleteProgram) { |
274 struct Cmds { | 274 struct Cmds { |
275 DeleteProgram cmd; | 275 cmds::DeleteProgram cmd; |
276 }; | 276 }; |
277 Cmds expected; | 277 Cmds expected; |
278 expected.cmd.Init(1); | 278 expected.cmd.Init(1); |
279 | 279 |
280 gl_->DeleteProgram(1); | 280 gl_->DeleteProgram(1); |
281 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 281 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
282 } | 282 } |
283 | 283 |
284 TEST_F(GLES2ImplementationTest, DeleteRenderbuffers) { | 284 TEST_F(GLES2ImplementationTest, DeleteRenderbuffers) { |
285 GLuint ids[2] = { kRenderbuffersStartId, kRenderbuffersStartId + 1 }; | 285 GLuint ids[2] = { kRenderbuffersStartId, kRenderbuffersStartId + 1 }; |
286 struct Cmds { | 286 struct Cmds { |
287 DeleteRenderbuffersImmediate del; | 287 cmds::DeleteRenderbuffersImmediate del; |
288 GLuint data[2]; | 288 GLuint data[2]; |
289 }; | 289 }; |
290 Cmds expected; | 290 Cmds expected; |
291 expected.del.Init(arraysize(ids), &ids[0]); | 291 expected.del.Init(arraysize(ids), &ids[0]); |
292 expected.data[0] = kRenderbuffersStartId; | 292 expected.data[0] = kRenderbuffersStartId; |
293 expected.data[1] = kRenderbuffersStartId + 1; | 293 expected.data[1] = kRenderbuffersStartId + 1; |
294 gl_->DeleteRenderbuffers(arraysize(ids), &ids[0]); | 294 gl_->DeleteRenderbuffers(arraysize(ids), &ids[0]); |
295 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 295 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
296 } | 296 } |
297 | 297 |
298 TEST_F(GLES2ImplementationTest, DeleteShader) { | 298 TEST_F(GLES2ImplementationTest, DeleteShader) { |
299 struct Cmds { | 299 struct Cmds { |
300 DeleteShader cmd; | 300 cmds::DeleteShader cmd; |
301 }; | 301 }; |
302 Cmds expected; | 302 Cmds expected; |
303 expected.cmd.Init(1); | 303 expected.cmd.Init(1); |
304 | 304 |
305 gl_->DeleteShader(1); | 305 gl_->DeleteShader(1); |
306 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 306 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
307 } | 307 } |
308 | 308 |
309 TEST_F(GLES2ImplementationTest, DeleteTextures) { | 309 TEST_F(GLES2ImplementationTest, DeleteTextures) { |
310 GLuint ids[2] = { kTexturesStartId, kTexturesStartId + 1 }; | 310 GLuint ids[2] = { kTexturesStartId, kTexturesStartId + 1 }; |
311 struct Cmds { | 311 struct Cmds { |
312 DeleteTexturesImmediate del; | 312 cmds::DeleteTexturesImmediate del; |
313 GLuint data[2]; | 313 GLuint data[2]; |
314 }; | 314 }; |
315 Cmds expected; | 315 Cmds expected; |
316 expected.del.Init(arraysize(ids), &ids[0]); | 316 expected.del.Init(arraysize(ids), &ids[0]); |
317 expected.data[0] = kTexturesStartId; | 317 expected.data[0] = kTexturesStartId; |
318 expected.data[1] = kTexturesStartId + 1; | 318 expected.data[1] = kTexturesStartId + 1; |
319 gl_->DeleteTextures(arraysize(ids), &ids[0]); | 319 gl_->DeleteTextures(arraysize(ids), &ids[0]); |
320 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 320 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
321 } | 321 } |
322 | 322 |
323 TEST_F(GLES2ImplementationTest, DepthFunc) { | 323 TEST_F(GLES2ImplementationTest, DepthFunc) { |
324 struct Cmds { | 324 struct Cmds { |
325 DepthFunc cmd; | 325 cmds::DepthFunc cmd; |
326 }; | 326 }; |
327 Cmds expected; | 327 Cmds expected; |
328 expected.cmd.Init(GL_NEVER); | 328 expected.cmd.Init(GL_NEVER); |
329 | 329 |
330 gl_->DepthFunc(GL_NEVER); | 330 gl_->DepthFunc(GL_NEVER); |
331 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 331 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
332 } | 332 } |
333 | 333 |
334 TEST_F(GLES2ImplementationTest, DepthMask) { | 334 TEST_F(GLES2ImplementationTest, DepthMask) { |
335 struct Cmds { | 335 struct Cmds { |
336 DepthMask cmd; | 336 cmds::DepthMask cmd; |
337 }; | 337 }; |
338 Cmds expected; | 338 Cmds expected; |
339 expected.cmd.Init(true); | 339 expected.cmd.Init(true); |
340 | 340 |
341 gl_->DepthMask(true); | 341 gl_->DepthMask(true); |
342 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 342 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
343 } | 343 } |
344 | 344 |
345 TEST_F(GLES2ImplementationTest, DepthRangef) { | 345 TEST_F(GLES2ImplementationTest, DepthRangef) { |
346 struct Cmds { | 346 struct Cmds { |
347 DepthRangef cmd; | 347 cmds::DepthRangef cmd; |
348 }; | 348 }; |
349 Cmds expected; | 349 Cmds expected; |
350 expected.cmd.Init(1, 2); | 350 expected.cmd.Init(1, 2); |
351 | 351 |
352 gl_->DepthRangef(1, 2); | 352 gl_->DepthRangef(1, 2); |
353 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 353 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
354 } | 354 } |
355 | 355 |
356 TEST_F(GLES2ImplementationTest, DetachShader) { | 356 TEST_F(GLES2ImplementationTest, DetachShader) { |
357 struct Cmds { | 357 struct Cmds { |
358 DetachShader cmd; | 358 cmds::DetachShader cmd; |
359 }; | 359 }; |
360 Cmds expected; | 360 Cmds expected; |
361 expected.cmd.Init(1, 2); | 361 expected.cmd.Init(1, 2); |
362 | 362 |
363 gl_->DetachShader(1, 2); | 363 gl_->DetachShader(1, 2); |
364 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 364 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
365 } | 365 } |
366 | 366 |
367 TEST_F(GLES2ImplementationTest, DisableVertexAttribArray) { | 367 TEST_F(GLES2ImplementationTest, DisableVertexAttribArray) { |
368 struct Cmds { | 368 struct Cmds { |
369 DisableVertexAttribArray cmd; | 369 cmds::DisableVertexAttribArray cmd; |
370 }; | 370 }; |
371 Cmds expected; | 371 Cmds expected; |
372 expected.cmd.Init(1); | 372 expected.cmd.Init(1); |
373 | 373 |
374 gl_->DisableVertexAttribArray(1); | 374 gl_->DisableVertexAttribArray(1); |
375 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 375 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
376 } | 376 } |
377 | 377 |
378 TEST_F(GLES2ImplementationTest, DrawArrays) { | 378 TEST_F(GLES2ImplementationTest, DrawArrays) { |
379 struct Cmds { | 379 struct Cmds { |
380 DrawArrays cmd; | 380 cmds::DrawArrays cmd; |
381 }; | 381 }; |
382 Cmds expected; | 382 Cmds expected; |
383 expected.cmd.Init(GL_POINTS, 2, 3); | 383 expected.cmd.Init(GL_POINTS, 2, 3); |
384 | 384 |
385 gl_->DrawArrays(GL_POINTS, 2, 3); | 385 gl_->DrawArrays(GL_POINTS, 2, 3); |
386 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 386 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
387 } | 387 } |
388 | 388 |
389 TEST_F(GLES2ImplementationTest, EnableVertexAttribArray) { | 389 TEST_F(GLES2ImplementationTest, EnableVertexAttribArray) { |
390 struct Cmds { | 390 struct Cmds { |
391 EnableVertexAttribArray cmd; | 391 cmds::EnableVertexAttribArray cmd; |
392 }; | 392 }; |
393 Cmds expected; | 393 Cmds expected; |
394 expected.cmd.Init(1); | 394 expected.cmd.Init(1); |
395 | 395 |
396 gl_->EnableVertexAttribArray(1); | 396 gl_->EnableVertexAttribArray(1); |
397 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 397 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
398 } | 398 } |
399 | 399 |
400 TEST_F(GLES2ImplementationTest, Flush) { | 400 TEST_F(GLES2ImplementationTest, Flush) { |
401 struct Cmds { | 401 struct Cmds { |
402 Flush cmd; | 402 cmds::Flush cmd; |
403 }; | 403 }; |
404 Cmds expected; | 404 Cmds expected; |
405 expected.cmd.Init(); | 405 expected.cmd.Init(); |
406 | 406 |
407 gl_->Flush(); | 407 gl_->Flush(); |
408 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 408 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
409 } | 409 } |
410 | 410 |
411 TEST_F(GLES2ImplementationTest, FramebufferRenderbuffer) { | 411 TEST_F(GLES2ImplementationTest, FramebufferRenderbuffer) { |
412 struct Cmds { | 412 struct Cmds { |
413 FramebufferRenderbuffer cmd; | 413 cmds::FramebufferRenderbuffer cmd; |
414 }; | 414 }; |
415 Cmds expected; | 415 Cmds expected; |
416 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4); | 416 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4); |
417 | 417 |
418 gl_->FramebufferRenderbuffer( | 418 gl_->FramebufferRenderbuffer( |
419 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4); | 419 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4); |
420 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 420 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
421 } | 421 } |
422 | 422 |
423 TEST_F(GLES2ImplementationTest, FramebufferTexture2D) { | 423 TEST_F(GLES2ImplementationTest, FramebufferTexture2D) { |
424 struct Cmds { | 424 struct Cmds { |
425 FramebufferTexture2D cmd; | 425 cmds::FramebufferTexture2D cmd; |
426 }; | 426 }; |
427 Cmds expected; | 427 Cmds expected; |
428 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0); | 428 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0); |
429 | 429 |
430 gl_->FramebufferTexture2D( | 430 gl_->FramebufferTexture2D( |
431 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0); | 431 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0); |
432 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 432 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
433 } | 433 } |
434 | 434 |
435 TEST_F(GLES2ImplementationTest, FrontFace) { | 435 TEST_F(GLES2ImplementationTest, FrontFace) { |
436 struct Cmds { | 436 struct Cmds { |
437 FrontFace cmd; | 437 cmds::FrontFace cmd; |
438 }; | 438 }; |
439 Cmds expected; | 439 Cmds expected; |
440 expected.cmd.Init(GL_CW); | 440 expected.cmd.Init(GL_CW); |
441 | 441 |
442 gl_->FrontFace(GL_CW); | 442 gl_->FrontFace(GL_CW); |
443 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 443 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
444 } | 444 } |
445 | 445 |
446 TEST_F(GLES2ImplementationTest, GenBuffers) { | 446 TEST_F(GLES2ImplementationTest, GenBuffers) { |
447 GLuint ids[2] = { 0, }; | 447 GLuint ids[2] = { 0, }; |
448 struct Cmds { | 448 struct Cmds { |
449 GenBuffersImmediate gen; | 449 cmds::GenBuffersImmediate gen; |
450 GLuint data[2]; | 450 GLuint data[2]; |
451 }; | 451 }; |
452 Cmds expected; | 452 Cmds expected; |
453 expected.gen.Init(arraysize(ids), &ids[0]); | 453 expected.gen.Init(arraysize(ids), &ids[0]); |
454 expected.data[0] = kBuffersStartId; | 454 expected.data[0] = kBuffersStartId; |
455 expected.data[1] = kBuffersStartId + 1; | 455 expected.data[1] = kBuffersStartId + 1; |
456 gl_->GenBuffers(arraysize(ids), &ids[0]); | 456 gl_->GenBuffers(arraysize(ids), &ids[0]); |
457 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 457 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
458 EXPECT_EQ(kBuffersStartId, ids[0]); | 458 EXPECT_EQ(kBuffersStartId, ids[0]); |
459 EXPECT_EQ(kBuffersStartId + 1, ids[1]); | 459 EXPECT_EQ(kBuffersStartId + 1, ids[1]); |
460 } | 460 } |
461 | 461 |
462 TEST_F(GLES2ImplementationTest, GenerateMipmap) { | 462 TEST_F(GLES2ImplementationTest, GenerateMipmap) { |
463 struct Cmds { | 463 struct Cmds { |
464 GenerateMipmap cmd; | 464 cmds::GenerateMipmap cmd; |
465 }; | 465 }; |
466 Cmds expected; | 466 Cmds expected; |
467 expected.cmd.Init(GL_TEXTURE_2D); | 467 expected.cmd.Init(GL_TEXTURE_2D); |
468 | 468 |
469 gl_->GenerateMipmap(GL_TEXTURE_2D); | 469 gl_->GenerateMipmap(GL_TEXTURE_2D); |
470 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 470 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
471 } | 471 } |
472 | 472 |
473 TEST_F(GLES2ImplementationTest, GenFramebuffers) { | 473 TEST_F(GLES2ImplementationTest, GenFramebuffers) { |
474 GLuint ids[2] = { 0, }; | 474 GLuint ids[2] = { 0, }; |
475 struct Cmds { | 475 struct Cmds { |
476 GenFramebuffersImmediate gen; | 476 cmds::GenFramebuffersImmediate gen; |
477 GLuint data[2]; | 477 GLuint data[2]; |
478 }; | 478 }; |
479 Cmds expected; | 479 Cmds expected; |
480 expected.gen.Init(arraysize(ids), &ids[0]); | 480 expected.gen.Init(arraysize(ids), &ids[0]); |
481 expected.data[0] = kFramebuffersStartId; | 481 expected.data[0] = kFramebuffersStartId; |
482 expected.data[1] = kFramebuffersStartId + 1; | 482 expected.data[1] = kFramebuffersStartId + 1; |
483 gl_->GenFramebuffers(arraysize(ids), &ids[0]); | 483 gl_->GenFramebuffers(arraysize(ids), &ids[0]); |
484 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 484 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
485 EXPECT_EQ(kFramebuffersStartId, ids[0]); | 485 EXPECT_EQ(kFramebuffersStartId, ids[0]); |
486 EXPECT_EQ(kFramebuffersStartId + 1, ids[1]); | 486 EXPECT_EQ(kFramebuffersStartId + 1, ids[1]); |
487 } | 487 } |
488 | 488 |
489 TEST_F(GLES2ImplementationTest, GenRenderbuffers) { | 489 TEST_F(GLES2ImplementationTest, GenRenderbuffers) { |
490 GLuint ids[2] = { 0, }; | 490 GLuint ids[2] = { 0, }; |
491 struct Cmds { | 491 struct Cmds { |
492 GenRenderbuffersImmediate gen; | 492 cmds::GenRenderbuffersImmediate gen; |
493 GLuint data[2]; | 493 GLuint data[2]; |
494 }; | 494 }; |
495 Cmds expected; | 495 Cmds expected; |
496 expected.gen.Init(arraysize(ids), &ids[0]); | 496 expected.gen.Init(arraysize(ids), &ids[0]); |
497 expected.data[0] = kRenderbuffersStartId; | 497 expected.data[0] = kRenderbuffersStartId; |
498 expected.data[1] = kRenderbuffersStartId + 1; | 498 expected.data[1] = kRenderbuffersStartId + 1; |
499 gl_->GenRenderbuffers(arraysize(ids), &ids[0]); | 499 gl_->GenRenderbuffers(arraysize(ids), &ids[0]); |
500 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 500 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
501 EXPECT_EQ(kRenderbuffersStartId, ids[0]); | 501 EXPECT_EQ(kRenderbuffersStartId, ids[0]); |
502 EXPECT_EQ(kRenderbuffersStartId + 1, ids[1]); | 502 EXPECT_EQ(kRenderbuffersStartId + 1, ids[1]); |
503 } | 503 } |
504 | 504 |
505 TEST_F(GLES2ImplementationTest, GenTextures) { | 505 TEST_F(GLES2ImplementationTest, GenTextures) { |
506 GLuint ids[2] = { 0, }; | 506 GLuint ids[2] = { 0, }; |
507 struct Cmds { | 507 struct Cmds { |
508 GenTexturesImmediate gen; | 508 cmds::GenTexturesImmediate gen; |
509 GLuint data[2]; | 509 GLuint data[2]; |
510 }; | 510 }; |
511 Cmds expected; | 511 Cmds expected; |
512 expected.gen.Init(arraysize(ids), &ids[0]); | 512 expected.gen.Init(arraysize(ids), &ids[0]); |
513 expected.data[0] = kTexturesStartId; | 513 expected.data[0] = kTexturesStartId; |
514 expected.data[1] = kTexturesStartId + 1; | 514 expected.data[1] = kTexturesStartId + 1; |
515 gl_->GenTextures(arraysize(ids), &ids[0]); | 515 gl_->GenTextures(arraysize(ids), &ids[0]); |
516 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 516 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
517 EXPECT_EQ(kTexturesStartId, ids[0]); | 517 EXPECT_EQ(kTexturesStartId, ids[0]); |
518 EXPECT_EQ(kTexturesStartId + 1, ids[1]); | 518 EXPECT_EQ(kTexturesStartId + 1, ids[1]); |
519 } | 519 } |
520 // TODO: Implement unit test for GetActiveAttrib | 520 // TODO: Implement unit test for GetActiveAttrib |
521 // TODO: Implement unit test for GetActiveUniform | 521 // TODO: Implement unit test for GetActiveUniform |
522 // TODO: Implement unit test for GetAttachedShaders | 522 // TODO: Implement unit test for GetAttachedShaders |
523 // TODO: Implement unit test for GetAttribLocation | 523 // TODO: Implement unit test for GetAttribLocation |
524 | 524 |
525 TEST_F(GLES2ImplementationTest, GetBooleanv) { | 525 TEST_F(GLES2ImplementationTest, GetBooleanv) { |
526 struct Cmds { | 526 struct Cmds { |
527 GetBooleanv cmd; | 527 cmds::GetBooleanv cmd; |
528 }; | 528 }; |
529 typedef GetBooleanv::Result Result; | 529 typedef cmds::GetBooleanv::Result Result; |
530 Result::Type result = 0; | 530 Result::Type result = 0; |
531 Cmds expected; | 531 Cmds expected; |
532 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 532 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
533 expected.cmd.Init(123, result1.id, result1.offset); | 533 expected.cmd.Init(123, result1.id, result1.offset); |
534 EXPECT_CALL(*command_buffer(), OnFlush()) | 534 EXPECT_CALL(*command_buffer(), OnFlush()) |
535 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 535 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
536 .RetiresOnSaturation(); | 536 .RetiresOnSaturation(); |
537 gl_->GetBooleanv(123, &result); | 537 gl_->GetBooleanv(123, &result); |
538 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 538 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
539 EXPECT_EQ(static_cast<Result::Type>(1), result); | 539 EXPECT_EQ(static_cast<Result::Type>(1), result); |
540 } | 540 } |
541 | 541 |
542 TEST_F(GLES2ImplementationTest, GetBufferParameteriv) { | 542 TEST_F(GLES2ImplementationTest, GetBufferParameteriv) { |
543 struct Cmds { | 543 struct Cmds { |
544 GetBufferParameteriv cmd; | 544 cmds::GetBufferParameteriv cmd; |
545 }; | 545 }; |
546 typedef GetBufferParameteriv::Result Result; | 546 typedef cmds::GetBufferParameteriv::Result Result; |
547 Result::Type result = 0; | 547 Result::Type result = 0; |
548 Cmds expected; | 548 Cmds expected; |
549 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 549 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
550 expected.cmd.Init(123, GL_BUFFER_SIZE, result1.id, result1.offset); | 550 expected.cmd.Init(123, GL_BUFFER_SIZE, result1.id, result1.offset); |
551 EXPECT_CALL(*command_buffer(), OnFlush()) | 551 EXPECT_CALL(*command_buffer(), OnFlush()) |
552 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 552 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
553 .RetiresOnSaturation(); | 553 .RetiresOnSaturation(); |
554 gl_->GetBufferParameteriv(123, GL_BUFFER_SIZE, &result); | 554 gl_->GetBufferParameteriv(123, GL_BUFFER_SIZE, &result); |
555 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 555 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
556 EXPECT_EQ(static_cast<Result::Type>(1), result); | 556 EXPECT_EQ(static_cast<Result::Type>(1), result); |
557 } | 557 } |
558 | 558 |
559 TEST_F(GLES2ImplementationTest, GetFloatv) { | 559 TEST_F(GLES2ImplementationTest, GetFloatv) { |
560 struct Cmds { | 560 struct Cmds { |
561 GetFloatv cmd; | 561 cmds::GetFloatv cmd; |
562 }; | 562 }; |
563 typedef GetFloatv::Result Result; | 563 typedef cmds::GetFloatv::Result Result; |
564 Result::Type result = 0; | 564 Result::Type result = 0; |
565 Cmds expected; | 565 Cmds expected; |
566 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 566 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
567 expected.cmd.Init(123, result1.id, result1.offset); | 567 expected.cmd.Init(123, result1.id, result1.offset); |
568 EXPECT_CALL(*command_buffer(), OnFlush()) | 568 EXPECT_CALL(*command_buffer(), OnFlush()) |
569 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 569 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
570 .RetiresOnSaturation(); | 570 .RetiresOnSaturation(); |
571 gl_->GetFloatv(123, &result); | 571 gl_->GetFloatv(123, &result); |
572 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 572 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
573 EXPECT_EQ(static_cast<Result::Type>(1), result); | 573 EXPECT_EQ(static_cast<Result::Type>(1), result); |
574 } | 574 } |
575 | 575 |
576 TEST_F(GLES2ImplementationTest, GetFramebufferAttachmentParameteriv) { | 576 TEST_F(GLES2ImplementationTest, GetFramebufferAttachmentParameteriv) { |
577 struct Cmds { | 577 struct Cmds { |
578 GetFramebufferAttachmentParameteriv cmd; | 578 cmds::GetFramebufferAttachmentParameteriv cmd; |
579 }; | 579 }; |
580 typedef GetFramebufferAttachmentParameteriv::Result Result; | 580 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result; |
581 Result::Type result = 0; | 581 Result::Type result = 0; |
582 Cmds expected; | 582 Cmds expected; |
583 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 583 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
584 expected.cmd.Init( | 584 expected.cmd.Init( |
585 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, | 585 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, |
586 result1.id, result1.offset); | 586 result1.id, result1.offset); |
587 EXPECT_CALL(*command_buffer(), OnFlush()) | 587 EXPECT_CALL(*command_buffer(), OnFlush()) |
588 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 588 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
589 .RetiresOnSaturation(); | 589 .RetiresOnSaturation(); |
590 gl_->GetFramebufferAttachmentParameteriv( | 590 gl_->GetFramebufferAttachmentParameteriv( |
591 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, | 591 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, |
592 &result); | 592 &result); |
593 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 593 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
594 EXPECT_EQ(static_cast<Result::Type>(1), result); | 594 EXPECT_EQ(static_cast<Result::Type>(1), result); |
595 } | 595 } |
596 | 596 |
597 TEST_F(GLES2ImplementationTest, GetIntegerv) { | 597 TEST_F(GLES2ImplementationTest, GetIntegerv) { |
598 struct Cmds { | 598 struct Cmds { |
599 GetIntegerv cmd; | 599 cmds::GetIntegerv cmd; |
600 }; | 600 }; |
601 typedef GetIntegerv::Result Result; | 601 typedef cmds::GetIntegerv::Result Result; |
602 Result::Type result = 0; | 602 Result::Type result = 0; |
603 Cmds expected; | 603 Cmds expected; |
604 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 604 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
605 expected.cmd.Init(123, result1.id, result1.offset); | 605 expected.cmd.Init(123, result1.id, result1.offset); |
606 EXPECT_CALL(*command_buffer(), OnFlush()) | 606 EXPECT_CALL(*command_buffer(), OnFlush()) |
607 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 607 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
608 .RetiresOnSaturation(); | 608 .RetiresOnSaturation(); |
609 gl_->GetIntegerv(123, &result); | 609 gl_->GetIntegerv(123, &result); |
610 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 610 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
611 EXPECT_EQ(static_cast<Result::Type>(1), result); | 611 EXPECT_EQ(static_cast<Result::Type>(1), result); |
612 } | 612 } |
613 | 613 |
614 TEST_F(GLES2ImplementationTest, GetProgramiv) { | 614 TEST_F(GLES2ImplementationTest, GetProgramiv) { |
615 struct Cmds { | 615 struct Cmds { |
616 GetProgramiv cmd; | 616 cmds::GetProgramiv cmd; |
617 }; | 617 }; |
618 typedef GetProgramiv::Result Result; | 618 typedef cmds::GetProgramiv::Result Result; |
619 Result::Type result = 0; | 619 Result::Type result = 0; |
620 Cmds expected; | 620 Cmds expected; |
621 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 621 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
622 expected.cmd.Init(123, GL_DELETE_STATUS, result1.id, result1.offset); | 622 expected.cmd.Init(123, GL_DELETE_STATUS, result1.id, result1.offset); |
623 EXPECT_CALL(*command_buffer(), OnFlush()) | 623 EXPECT_CALL(*command_buffer(), OnFlush()) |
624 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 624 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
625 .RetiresOnSaturation(); | 625 .RetiresOnSaturation(); |
626 gl_->GetProgramiv(123, GL_DELETE_STATUS, &result); | 626 gl_->GetProgramiv(123, GL_DELETE_STATUS, &result); |
627 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 627 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
628 EXPECT_EQ(static_cast<Result::Type>(1), result); | 628 EXPECT_EQ(static_cast<Result::Type>(1), result); |
629 } | 629 } |
630 // TODO: Implement unit test for GetProgramInfoLog | 630 // TODO: Implement unit test for GetProgramInfoLog |
631 | 631 |
632 TEST_F(GLES2ImplementationTest, GetRenderbufferParameteriv) { | 632 TEST_F(GLES2ImplementationTest, GetRenderbufferParameteriv) { |
633 struct Cmds { | 633 struct Cmds { |
634 GetRenderbufferParameteriv cmd; | 634 cmds::GetRenderbufferParameteriv cmd; |
635 }; | 635 }; |
636 typedef GetRenderbufferParameteriv::Result Result; | 636 typedef cmds::GetRenderbufferParameteriv::Result Result; |
637 Result::Type result = 0; | 637 Result::Type result = 0; |
638 Cmds expected; | 638 Cmds expected; |
639 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 639 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
640 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset); | 640 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset); |
641 EXPECT_CALL(*command_buffer(), OnFlush()) | 641 EXPECT_CALL(*command_buffer(), OnFlush()) |
642 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 642 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
643 .RetiresOnSaturation(); | 643 .RetiresOnSaturation(); |
644 gl_->GetRenderbufferParameteriv(123, GL_RENDERBUFFER_RED_SIZE, &result); | 644 gl_->GetRenderbufferParameteriv(123, GL_RENDERBUFFER_RED_SIZE, &result); |
645 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 645 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
646 EXPECT_EQ(static_cast<Result::Type>(1), result); | 646 EXPECT_EQ(static_cast<Result::Type>(1), result); |
647 } | 647 } |
648 | 648 |
649 TEST_F(GLES2ImplementationTest, GetShaderiv) { | 649 TEST_F(GLES2ImplementationTest, GetShaderiv) { |
650 struct Cmds { | 650 struct Cmds { |
651 GetShaderiv cmd; | 651 cmds::GetShaderiv cmd; |
652 }; | 652 }; |
653 typedef GetShaderiv::Result Result; | 653 typedef cmds::GetShaderiv::Result Result; |
654 Result::Type result = 0; | 654 Result::Type result = 0; |
655 Cmds expected; | 655 Cmds expected; |
656 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 656 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
657 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset); | 657 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset); |
658 EXPECT_CALL(*command_buffer(), OnFlush()) | 658 EXPECT_CALL(*command_buffer(), OnFlush()) |
659 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 659 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
660 .RetiresOnSaturation(); | 660 .RetiresOnSaturation(); |
661 gl_->GetShaderiv(123, GL_SHADER_TYPE, &result); | 661 gl_->GetShaderiv(123, GL_SHADER_TYPE, &result); |
662 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 662 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
663 EXPECT_EQ(static_cast<Result::Type>(1), result); | 663 EXPECT_EQ(static_cast<Result::Type>(1), result); |
664 } | 664 } |
665 // TODO: Implement unit test for GetShaderInfoLog | 665 // TODO: Implement unit test for GetShaderInfoLog |
666 // TODO: Implement unit test for GetShaderPrecisionFormat | 666 // TODO: Implement unit test for GetShaderPrecisionFormat |
667 | 667 |
668 TEST_F(GLES2ImplementationTest, GetTexParameterfv) { | 668 TEST_F(GLES2ImplementationTest, GetTexParameterfv) { |
669 struct Cmds { | 669 struct Cmds { |
670 GetTexParameterfv cmd; | 670 cmds::GetTexParameterfv cmd; |
671 }; | 671 }; |
672 typedef GetTexParameterfv::Result Result; | 672 typedef cmds::GetTexParameterfv::Result Result; |
673 Result::Type result = 0; | 673 Result::Type result = 0; |
674 Cmds expected; | 674 Cmds expected; |
675 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 675 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
676 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); | 676 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); |
677 EXPECT_CALL(*command_buffer(), OnFlush()) | 677 EXPECT_CALL(*command_buffer(), OnFlush()) |
678 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 678 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
679 .RetiresOnSaturation(); | 679 .RetiresOnSaturation(); |
680 gl_->GetTexParameterfv(123, GL_TEXTURE_MAG_FILTER, &result); | 680 gl_->GetTexParameterfv(123, GL_TEXTURE_MAG_FILTER, &result); |
681 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 681 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
682 EXPECT_EQ(static_cast<Result::Type>(1), result); | 682 EXPECT_EQ(static_cast<Result::Type>(1), result); |
683 } | 683 } |
684 | 684 |
685 TEST_F(GLES2ImplementationTest, GetTexParameteriv) { | 685 TEST_F(GLES2ImplementationTest, GetTexParameteriv) { |
686 struct Cmds { | 686 struct Cmds { |
687 GetTexParameteriv cmd; | 687 cmds::GetTexParameteriv cmd; |
688 }; | 688 }; |
689 typedef GetTexParameteriv::Result Result; | 689 typedef cmds::GetTexParameteriv::Result Result; |
690 Result::Type result = 0; | 690 Result::Type result = 0; |
691 Cmds expected; | 691 Cmds expected; |
692 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 692 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
693 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); | 693 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); |
694 EXPECT_CALL(*command_buffer(), OnFlush()) | 694 EXPECT_CALL(*command_buffer(), OnFlush()) |
695 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 695 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
696 .RetiresOnSaturation(); | 696 .RetiresOnSaturation(); |
697 gl_->GetTexParameteriv(123, GL_TEXTURE_MAG_FILTER, &result); | 697 gl_->GetTexParameteriv(123, GL_TEXTURE_MAG_FILTER, &result); |
698 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 698 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
699 EXPECT_EQ(static_cast<Result::Type>(1), result); | 699 EXPECT_EQ(static_cast<Result::Type>(1), result); |
700 } | 700 } |
701 // TODO: Implement unit test for GetUniformfv | 701 // TODO: Implement unit test for GetUniformfv |
702 // TODO: Implement unit test for GetUniformiv | 702 // TODO: Implement unit test for GetUniformiv |
703 // TODO: Implement unit test for GetUniformLocation | 703 // TODO: Implement unit test for GetUniformLocation |
704 | 704 |
705 TEST_F(GLES2ImplementationTest, GetVertexAttribfv) { | 705 TEST_F(GLES2ImplementationTest, GetVertexAttribfv) { |
706 struct Cmds { | 706 struct Cmds { |
707 GetVertexAttribfv cmd; | 707 cmds::GetVertexAttribfv cmd; |
708 }; | 708 }; |
709 typedef GetVertexAttribfv::Result Result; | 709 typedef cmds::GetVertexAttribfv::Result Result; |
710 Result::Type result = 0; | 710 Result::Type result = 0; |
711 Cmds expected; | 711 Cmds expected; |
712 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 712 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
713 expected.cmd.Init( | 713 expected.cmd.Init( |
714 123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, result1.offset); | 714 123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, result1.offset); |
715 EXPECT_CALL(*command_buffer(), OnFlush()) | 715 EXPECT_CALL(*command_buffer(), OnFlush()) |
716 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 716 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
717 .RetiresOnSaturation(); | 717 .RetiresOnSaturation(); |
718 gl_->GetVertexAttribfv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result); | 718 gl_->GetVertexAttribfv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result); |
719 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 719 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
720 EXPECT_EQ(static_cast<Result::Type>(1), result); | 720 EXPECT_EQ(static_cast<Result::Type>(1), result); |
721 } | 721 } |
722 | 722 |
723 TEST_F(GLES2ImplementationTest, GetVertexAttribiv) { | 723 TEST_F(GLES2ImplementationTest, GetVertexAttribiv) { |
724 struct Cmds { | 724 struct Cmds { |
725 GetVertexAttribiv cmd; | 725 cmds::GetVertexAttribiv cmd; |
726 }; | 726 }; |
727 typedef GetVertexAttribiv::Result Result; | 727 typedef cmds::GetVertexAttribiv::Result Result; |
728 Result::Type result = 0; | 728 Result::Type result = 0; |
729 Cmds expected; | 729 Cmds expected; |
730 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 730 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
731 expected.cmd.Init( | 731 expected.cmd.Init( |
732 123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, result1.offset); | 732 123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, result1.offset); |
733 EXPECT_CALL(*command_buffer(), OnFlush()) | 733 EXPECT_CALL(*command_buffer(), OnFlush()) |
734 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 734 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
735 .RetiresOnSaturation(); | 735 .RetiresOnSaturation(); |
736 gl_->GetVertexAttribiv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result); | 736 gl_->GetVertexAttribiv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result); |
737 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 737 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
738 EXPECT_EQ(static_cast<Result::Type>(1), result); | 738 EXPECT_EQ(static_cast<Result::Type>(1), result); |
739 } | 739 } |
740 | 740 |
741 TEST_F(GLES2ImplementationTest, Hint) { | 741 TEST_F(GLES2ImplementationTest, Hint) { |
742 struct Cmds { | 742 struct Cmds { |
743 Hint cmd; | 743 cmds::Hint cmd; |
744 }; | 744 }; |
745 Cmds expected; | 745 Cmds expected; |
746 expected.cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST); | 746 expected.cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST); |
747 | 747 |
748 gl_->Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST); | 748 gl_->Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST); |
749 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 749 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
750 } | 750 } |
751 | 751 |
752 TEST_F(GLES2ImplementationTest, IsBuffer) { | 752 TEST_F(GLES2ImplementationTest, IsBuffer) { |
753 struct Cmds { | 753 struct Cmds { |
754 IsBuffer cmd; | 754 cmds::IsBuffer cmd; |
755 }; | 755 }; |
756 | 756 |
757 typedef IsBuffer::Result Result; | 757 typedef cmds::IsBuffer::Result Result; |
758 Cmds expected; | 758 Cmds expected; |
759 ExpectedMemoryInfo result1 = | 759 ExpectedMemoryInfo result1 = |
760 GetExpectedResultMemory(sizeof(IsBuffer::Result)); | 760 GetExpectedResultMemory(sizeof(cmds::IsBuffer::Result)); |
761 expected.cmd.Init(1, result1.id, result1.offset); | 761 expected.cmd.Init(1, result1.id, result1.offset); |
762 | 762 |
763 EXPECT_CALL(*command_buffer(), OnFlush()) | 763 EXPECT_CALL(*command_buffer(), OnFlush()) |
764 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 764 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
765 .RetiresOnSaturation(); | 765 .RetiresOnSaturation(); |
766 | 766 |
767 GLboolean result = gl_->IsBuffer(1); | 767 GLboolean result = gl_->IsBuffer(1); |
768 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 768 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
769 EXPECT_TRUE(result); | 769 EXPECT_TRUE(result); |
770 } | 770 } |
771 | 771 |
772 TEST_F(GLES2ImplementationTest, IsEnabled) { | 772 TEST_F(GLES2ImplementationTest, IsEnabled) { |
773 struct Cmds { | 773 struct Cmds { |
774 IsEnabled cmd; | 774 cmds::IsEnabled cmd; |
775 }; | 775 }; |
776 | 776 |
777 typedef IsEnabled::Result Result; | 777 typedef cmds::IsEnabled::Result Result; |
778 Cmds expected; | 778 Cmds expected; |
779 ExpectedMemoryInfo result1 = | 779 ExpectedMemoryInfo result1 = |
780 GetExpectedResultMemory(sizeof(IsEnabled::Result)); | 780 GetExpectedResultMemory(sizeof(cmds::IsEnabled::Result)); |
781 expected.cmd.Init(1, result1.id, result1.offset); | 781 expected.cmd.Init(1, result1.id, result1.offset); |
782 | 782 |
783 EXPECT_CALL(*command_buffer(), OnFlush()) | 783 EXPECT_CALL(*command_buffer(), OnFlush()) |
784 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 784 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
785 .RetiresOnSaturation(); | 785 .RetiresOnSaturation(); |
786 | 786 |
787 GLboolean result = gl_->IsEnabled(1); | 787 GLboolean result = gl_->IsEnabled(1); |
788 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 788 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
789 EXPECT_TRUE(result); | 789 EXPECT_TRUE(result); |
790 } | 790 } |
791 | 791 |
792 TEST_F(GLES2ImplementationTest, IsFramebuffer) { | 792 TEST_F(GLES2ImplementationTest, IsFramebuffer) { |
793 struct Cmds { | 793 struct Cmds { |
794 IsFramebuffer cmd; | 794 cmds::IsFramebuffer cmd; |
795 }; | 795 }; |
796 | 796 |
797 typedef IsFramebuffer::Result Result; | 797 typedef cmds::IsFramebuffer::Result Result; |
798 Cmds expected; | 798 Cmds expected; |
799 ExpectedMemoryInfo result1 = | 799 ExpectedMemoryInfo result1 = |
800 GetExpectedResultMemory(sizeof(IsFramebuffer::Result)); | 800 GetExpectedResultMemory(sizeof(cmds::IsFramebuffer::Result)); |
801 expected.cmd.Init(1, result1.id, result1.offset); | 801 expected.cmd.Init(1, result1.id, result1.offset); |
802 | 802 |
803 EXPECT_CALL(*command_buffer(), OnFlush()) | 803 EXPECT_CALL(*command_buffer(), OnFlush()) |
804 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 804 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
805 .RetiresOnSaturation(); | 805 .RetiresOnSaturation(); |
806 | 806 |
807 GLboolean result = gl_->IsFramebuffer(1); | 807 GLboolean result = gl_->IsFramebuffer(1); |
808 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 808 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
809 EXPECT_TRUE(result); | 809 EXPECT_TRUE(result); |
810 } | 810 } |
811 | 811 |
812 TEST_F(GLES2ImplementationTest, IsProgram) { | 812 TEST_F(GLES2ImplementationTest, IsProgram) { |
813 struct Cmds { | 813 struct Cmds { |
814 IsProgram cmd; | 814 cmds::IsProgram cmd; |
815 }; | 815 }; |
816 | 816 |
817 typedef IsProgram::Result Result; | 817 typedef cmds::IsProgram::Result Result; |
818 Cmds expected; | 818 Cmds expected; |
819 ExpectedMemoryInfo result1 = | 819 ExpectedMemoryInfo result1 = |
820 GetExpectedResultMemory(sizeof(IsProgram::Result)); | 820 GetExpectedResultMemory(sizeof(cmds::IsProgram::Result)); |
821 expected.cmd.Init(1, result1.id, result1.offset); | 821 expected.cmd.Init(1, result1.id, result1.offset); |
822 | 822 |
823 EXPECT_CALL(*command_buffer(), OnFlush()) | 823 EXPECT_CALL(*command_buffer(), OnFlush()) |
824 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 824 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
825 .RetiresOnSaturation(); | 825 .RetiresOnSaturation(); |
826 | 826 |
827 GLboolean result = gl_->IsProgram(1); | 827 GLboolean result = gl_->IsProgram(1); |
828 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 828 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
829 EXPECT_TRUE(result); | 829 EXPECT_TRUE(result); |
830 } | 830 } |
831 | 831 |
832 TEST_F(GLES2ImplementationTest, IsRenderbuffer) { | 832 TEST_F(GLES2ImplementationTest, IsRenderbuffer) { |
833 struct Cmds { | 833 struct Cmds { |
834 IsRenderbuffer cmd; | 834 cmds::IsRenderbuffer cmd; |
835 }; | 835 }; |
836 | 836 |
837 typedef IsRenderbuffer::Result Result; | 837 typedef cmds::IsRenderbuffer::Result Result; |
838 Cmds expected; | 838 Cmds expected; |
839 ExpectedMemoryInfo result1 = | 839 ExpectedMemoryInfo result1 = |
840 GetExpectedResultMemory(sizeof(IsRenderbuffer::Result)); | 840 GetExpectedResultMemory(sizeof(cmds::IsRenderbuffer::Result)); |
841 expected.cmd.Init(1, result1.id, result1.offset); | 841 expected.cmd.Init(1, result1.id, result1.offset); |
842 | 842 |
843 EXPECT_CALL(*command_buffer(), OnFlush()) | 843 EXPECT_CALL(*command_buffer(), OnFlush()) |
844 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 844 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
845 .RetiresOnSaturation(); | 845 .RetiresOnSaturation(); |
846 | 846 |
847 GLboolean result = gl_->IsRenderbuffer(1); | 847 GLboolean result = gl_->IsRenderbuffer(1); |
848 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 848 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
849 EXPECT_TRUE(result); | 849 EXPECT_TRUE(result); |
850 } | 850 } |
851 | 851 |
852 TEST_F(GLES2ImplementationTest, IsShader) { | 852 TEST_F(GLES2ImplementationTest, IsShader) { |
853 struct Cmds { | 853 struct Cmds { |
854 IsShader cmd; | 854 cmds::IsShader cmd; |
855 }; | 855 }; |
856 | 856 |
857 typedef IsShader::Result Result; | 857 typedef cmds::IsShader::Result Result; |
858 Cmds expected; | 858 Cmds expected; |
859 ExpectedMemoryInfo result1 = | 859 ExpectedMemoryInfo result1 = |
860 GetExpectedResultMemory(sizeof(IsShader::Result)); | 860 GetExpectedResultMemory(sizeof(cmds::IsShader::Result)); |
861 expected.cmd.Init(1, result1.id, result1.offset); | 861 expected.cmd.Init(1, result1.id, result1.offset); |
862 | 862 |
863 EXPECT_CALL(*command_buffer(), OnFlush()) | 863 EXPECT_CALL(*command_buffer(), OnFlush()) |
864 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 864 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
865 .RetiresOnSaturation(); | 865 .RetiresOnSaturation(); |
866 | 866 |
867 GLboolean result = gl_->IsShader(1); | 867 GLboolean result = gl_->IsShader(1); |
868 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 868 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
869 EXPECT_TRUE(result); | 869 EXPECT_TRUE(result); |
870 } | 870 } |
871 | 871 |
872 TEST_F(GLES2ImplementationTest, IsTexture) { | 872 TEST_F(GLES2ImplementationTest, IsTexture) { |
873 struct Cmds { | 873 struct Cmds { |
874 IsTexture cmd; | 874 cmds::IsTexture cmd; |
875 }; | 875 }; |
876 | 876 |
877 typedef IsTexture::Result Result; | 877 typedef cmds::IsTexture::Result Result; |
878 Cmds expected; | 878 Cmds expected; |
879 ExpectedMemoryInfo result1 = | 879 ExpectedMemoryInfo result1 = |
880 GetExpectedResultMemory(sizeof(IsTexture::Result)); | 880 GetExpectedResultMemory(sizeof(cmds::IsTexture::Result)); |
881 expected.cmd.Init(1, result1.id, result1.offset); | 881 expected.cmd.Init(1, result1.id, result1.offset); |
882 | 882 |
883 EXPECT_CALL(*command_buffer(), OnFlush()) | 883 EXPECT_CALL(*command_buffer(), OnFlush()) |
884 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 884 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
885 .RetiresOnSaturation(); | 885 .RetiresOnSaturation(); |
886 | 886 |
887 GLboolean result = gl_->IsTexture(1); | 887 GLboolean result = gl_->IsTexture(1); |
888 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 888 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
889 EXPECT_TRUE(result); | 889 EXPECT_TRUE(result); |
890 } | 890 } |
891 | 891 |
892 TEST_F(GLES2ImplementationTest, LineWidth) { | 892 TEST_F(GLES2ImplementationTest, LineWidth) { |
893 struct Cmds { | 893 struct Cmds { |
894 LineWidth cmd; | 894 cmds::LineWidth cmd; |
895 }; | 895 }; |
896 Cmds expected; | 896 Cmds expected; |
897 expected.cmd.Init(1); | 897 expected.cmd.Init(1); |
898 | 898 |
899 gl_->LineWidth(1); | 899 gl_->LineWidth(1); |
900 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 900 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
901 } | 901 } |
902 | 902 |
903 TEST_F(GLES2ImplementationTest, LinkProgram) { | 903 TEST_F(GLES2ImplementationTest, LinkProgram) { |
904 struct Cmds { | 904 struct Cmds { |
905 LinkProgram cmd; | 905 cmds::LinkProgram cmd; |
906 }; | 906 }; |
907 Cmds expected; | 907 Cmds expected; |
908 expected.cmd.Init(1); | 908 expected.cmd.Init(1); |
909 | 909 |
910 gl_->LinkProgram(1); | 910 gl_->LinkProgram(1); |
911 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 911 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
912 } | 912 } |
913 | 913 |
914 TEST_F(GLES2ImplementationTest, PixelStorei) { | 914 TEST_F(GLES2ImplementationTest, PixelStorei) { |
915 struct Cmds { | 915 struct Cmds { |
916 PixelStorei cmd; | 916 cmds::PixelStorei cmd; |
917 }; | 917 }; |
918 Cmds expected; | 918 Cmds expected; |
919 expected.cmd.Init(GL_PACK_ALIGNMENT, 1); | 919 expected.cmd.Init(GL_PACK_ALIGNMENT, 1); |
920 | 920 |
921 gl_->PixelStorei(GL_PACK_ALIGNMENT, 1); | 921 gl_->PixelStorei(GL_PACK_ALIGNMENT, 1); |
922 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 922 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
923 } | 923 } |
924 | 924 |
925 TEST_F(GLES2ImplementationTest, PolygonOffset) { | 925 TEST_F(GLES2ImplementationTest, PolygonOffset) { |
926 struct Cmds { | 926 struct Cmds { |
927 PolygonOffset cmd; | 927 cmds::PolygonOffset cmd; |
928 }; | 928 }; |
929 Cmds expected; | 929 Cmds expected; |
930 expected.cmd.Init(1, 2); | 930 expected.cmd.Init(1, 2); |
931 | 931 |
932 gl_->PolygonOffset(1, 2); | 932 gl_->PolygonOffset(1, 2); |
933 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 933 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
934 } | 934 } |
935 | 935 |
936 TEST_F(GLES2ImplementationTest, ReleaseShaderCompiler) { | 936 TEST_F(GLES2ImplementationTest, ReleaseShaderCompiler) { |
937 struct Cmds { | 937 struct Cmds { |
938 ReleaseShaderCompiler cmd; | 938 cmds::ReleaseShaderCompiler cmd; |
939 }; | 939 }; |
940 Cmds expected; | 940 Cmds expected; |
941 expected.cmd.Init(); | 941 expected.cmd.Init(); |
942 | 942 |
943 gl_->ReleaseShaderCompiler(); | 943 gl_->ReleaseShaderCompiler(); |
944 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 944 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
945 } | 945 } |
946 | 946 |
947 TEST_F(GLES2ImplementationTest, RenderbufferStorage) { | 947 TEST_F(GLES2ImplementationTest, RenderbufferStorage) { |
948 struct Cmds { | 948 struct Cmds { |
949 RenderbufferStorage cmd; | 949 cmds::RenderbufferStorage cmd; |
950 }; | 950 }; |
951 Cmds expected; | 951 Cmds expected; |
952 expected.cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4); | 952 expected.cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4); |
953 | 953 |
954 gl_->RenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 3, 4); | 954 gl_->RenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 3, 4); |
955 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 955 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
956 } | 956 } |
957 | 957 |
958 TEST_F(GLES2ImplementationTest, SampleCoverage) { | 958 TEST_F(GLES2ImplementationTest, SampleCoverage) { |
959 struct Cmds { | 959 struct Cmds { |
960 SampleCoverage cmd; | 960 cmds::SampleCoverage cmd; |
961 }; | 961 }; |
962 Cmds expected; | 962 Cmds expected; |
963 expected.cmd.Init(1, true); | 963 expected.cmd.Init(1, true); |
964 | 964 |
965 gl_->SampleCoverage(1, true); | 965 gl_->SampleCoverage(1, true); |
966 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 966 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
967 } | 967 } |
968 | 968 |
969 TEST_F(GLES2ImplementationTest, Scissor) { | 969 TEST_F(GLES2ImplementationTest, Scissor) { |
970 struct Cmds { | 970 struct Cmds { |
971 Scissor cmd; | 971 cmds::Scissor cmd; |
972 }; | 972 }; |
973 Cmds expected; | 973 Cmds expected; |
974 expected.cmd.Init(1, 2, 3, 4); | 974 expected.cmd.Init(1, 2, 3, 4); |
975 | 975 |
976 gl_->Scissor(1, 2, 3, 4); | 976 gl_->Scissor(1, 2, 3, 4); |
977 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 977 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
978 } | 978 } |
979 | 979 |
980 TEST_F(GLES2ImplementationTest, StencilFunc) { | 980 TEST_F(GLES2ImplementationTest, StencilFunc) { |
981 struct Cmds { | 981 struct Cmds { |
982 StencilFunc cmd; | 982 cmds::StencilFunc cmd; |
983 }; | 983 }; |
984 Cmds expected; | 984 Cmds expected; |
985 expected.cmd.Init(GL_NEVER, 2, 3); | 985 expected.cmd.Init(GL_NEVER, 2, 3); |
986 | 986 |
987 gl_->StencilFunc(GL_NEVER, 2, 3); | 987 gl_->StencilFunc(GL_NEVER, 2, 3); |
988 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 988 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
989 } | 989 } |
990 | 990 |
991 TEST_F(GLES2ImplementationTest, StencilFuncSeparate) { | 991 TEST_F(GLES2ImplementationTest, StencilFuncSeparate) { |
992 struct Cmds { | 992 struct Cmds { |
993 StencilFuncSeparate cmd; | 993 cmds::StencilFuncSeparate cmd; |
994 }; | 994 }; |
995 Cmds expected; | 995 Cmds expected; |
996 expected.cmd.Init(GL_FRONT, GL_NEVER, 3, 4); | 996 expected.cmd.Init(GL_FRONT, GL_NEVER, 3, 4); |
997 | 997 |
998 gl_->StencilFuncSeparate(GL_FRONT, GL_NEVER, 3, 4); | 998 gl_->StencilFuncSeparate(GL_FRONT, GL_NEVER, 3, 4); |
999 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 999 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1000 } | 1000 } |
1001 | 1001 |
1002 TEST_F(GLES2ImplementationTest, StencilMask) { | 1002 TEST_F(GLES2ImplementationTest, StencilMask) { |
1003 struct Cmds { | 1003 struct Cmds { |
1004 StencilMask cmd; | 1004 cmds::StencilMask cmd; |
1005 }; | 1005 }; |
1006 Cmds expected; | 1006 Cmds expected; |
1007 expected.cmd.Init(1); | 1007 expected.cmd.Init(1); |
1008 | 1008 |
1009 gl_->StencilMask(1); | 1009 gl_->StencilMask(1); |
1010 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1010 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1011 } | 1011 } |
1012 | 1012 |
1013 TEST_F(GLES2ImplementationTest, StencilMaskSeparate) { | 1013 TEST_F(GLES2ImplementationTest, StencilMaskSeparate) { |
1014 struct Cmds { | 1014 struct Cmds { |
1015 StencilMaskSeparate cmd; | 1015 cmds::StencilMaskSeparate cmd; |
1016 }; | 1016 }; |
1017 Cmds expected; | 1017 Cmds expected; |
1018 expected.cmd.Init(GL_FRONT, 2); | 1018 expected.cmd.Init(GL_FRONT, 2); |
1019 | 1019 |
1020 gl_->StencilMaskSeparate(GL_FRONT, 2); | 1020 gl_->StencilMaskSeparate(GL_FRONT, 2); |
1021 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1021 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1022 } | 1022 } |
1023 | 1023 |
1024 TEST_F(GLES2ImplementationTest, StencilOp) { | 1024 TEST_F(GLES2ImplementationTest, StencilOp) { |
1025 struct Cmds { | 1025 struct Cmds { |
1026 StencilOp cmd; | 1026 cmds::StencilOp cmd; |
1027 }; | 1027 }; |
1028 Cmds expected; | 1028 Cmds expected; |
1029 expected.cmd.Init(GL_KEEP, GL_INCR, GL_KEEP); | 1029 expected.cmd.Init(GL_KEEP, GL_INCR, GL_KEEP); |
1030 | 1030 |
1031 gl_->StencilOp(GL_KEEP, GL_INCR, GL_KEEP); | 1031 gl_->StencilOp(GL_KEEP, GL_INCR, GL_KEEP); |
1032 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1032 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1033 } | 1033 } |
1034 | 1034 |
1035 TEST_F(GLES2ImplementationTest, StencilOpSeparate) { | 1035 TEST_F(GLES2ImplementationTest, StencilOpSeparate) { |
1036 struct Cmds { | 1036 struct Cmds { |
1037 StencilOpSeparate cmd; | 1037 cmds::StencilOpSeparate cmd; |
1038 }; | 1038 }; |
1039 Cmds expected; | 1039 Cmds expected; |
1040 expected.cmd.Init(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP); | 1040 expected.cmd.Init(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP); |
1041 | 1041 |
1042 gl_->StencilOpSeparate(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP); | 1042 gl_->StencilOpSeparate(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP); |
1043 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1043 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1044 } | 1044 } |
1045 | 1045 |
1046 TEST_F(GLES2ImplementationTest, TexParameterf) { | 1046 TEST_F(GLES2ImplementationTest, TexParameterf) { |
1047 struct Cmds { | 1047 struct Cmds { |
1048 TexParameterf cmd; | 1048 cmds::TexParameterf cmd; |
1049 }; | 1049 }; |
1050 Cmds expected; | 1050 Cmds expected; |
1051 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); | 1051 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); |
1052 | 1052 |
1053 gl_->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); | 1053 gl_->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); |
1054 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1054 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1055 } | 1055 } |
1056 | 1056 |
1057 TEST_F(GLES2ImplementationTest, TexParameterfv) { | 1057 TEST_F(GLES2ImplementationTest, TexParameterfv) { |
1058 struct Cmds { | 1058 struct Cmds { |
1059 TexParameterfvImmediate cmd; | 1059 cmds::TexParameterfvImmediate cmd; |
1060 GLfloat data[1]; | 1060 GLfloat data[1]; |
1061 }; | 1061 }; |
1062 | 1062 |
1063 Cmds expected; | 1063 Cmds expected; |
1064 for (int jj = 0; jj < 1; ++jj) { | 1064 for (int jj = 0; jj < 1; ++jj) { |
1065 expected.data[jj] = static_cast<GLfloat>(jj); | 1065 expected.data[jj] = static_cast<GLfloat>(jj); |
1066 } | 1066 } |
1067 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &expected.data[0]); | 1067 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &expected.data[0]); |
1068 gl_->TexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &expected.data[0]); | 1068 gl_->TexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &expected.data[0]); |
1069 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1069 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1070 } | 1070 } |
1071 | 1071 |
1072 TEST_F(GLES2ImplementationTest, TexParameteri) { | 1072 TEST_F(GLES2ImplementationTest, TexParameteri) { |
1073 struct Cmds { | 1073 struct Cmds { |
1074 TexParameteri cmd; | 1074 cmds::TexParameteri cmd; |
1075 }; | 1075 }; |
1076 Cmds expected; | 1076 Cmds expected; |
1077 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); | 1077 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); |
1078 | 1078 |
1079 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); | 1079 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); |
1080 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1080 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1081 } | 1081 } |
1082 | 1082 |
1083 TEST_F(GLES2ImplementationTest, TexParameteriv) { | 1083 TEST_F(GLES2ImplementationTest, TexParameteriv) { |
1084 struct Cmds { | 1084 struct Cmds { |
1085 TexParameterivImmediate cmd; | 1085 cmds::TexParameterivImmediate cmd; |
1086 GLint data[1]; | 1086 GLint data[1]; |
1087 }; | 1087 }; |
1088 | 1088 |
1089 Cmds expected; | 1089 Cmds expected; |
1090 for (int jj = 0; jj < 1; ++jj) { | 1090 for (int jj = 0; jj < 1; ++jj) { |
1091 expected.data[jj] = static_cast<GLint>(jj); | 1091 expected.data[jj] = static_cast<GLint>(jj); |
1092 } | 1092 } |
1093 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &expected.data[0]); | 1093 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &expected.data[0]); |
1094 gl_->TexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &expected.data[0]); | 1094 gl_->TexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &expected.data[0]); |
1095 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1095 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1096 } | 1096 } |
1097 | 1097 |
1098 TEST_F(GLES2ImplementationTest, Uniform1f) { | 1098 TEST_F(GLES2ImplementationTest, Uniform1f) { |
1099 struct Cmds { | 1099 struct Cmds { |
1100 Uniform1f cmd; | 1100 cmds::Uniform1f cmd; |
1101 }; | 1101 }; |
1102 Cmds expected; | 1102 Cmds expected; |
1103 expected.cmd.Init(1, 2); | 1103 expected.cmd.Init(1, 2); |
1104 | 1104 |
1105 gl_->Uniform1f(1, 2); | 1105 gl_->Uniform1f(1, 2); |
1106 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1106 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1107 } | 1107 } |
1108 | 1108 |
1109 TEST_F(GLES2ImplementationTest, Uniform1fv) { | 1109 TEST_F(GLES2ImplementationTest, Uniform1fv) { |
1110 struct Cmds { | 1110 struct Cmds { |
1111 Uniform1fvImmediate cmd; | 1111 cmds::Uniform1fvImmediate cmd; |
1112 GLfloat data[2][1]; | 1112 GLfloat data[2][1]; |
1113 }; | 1113 }; |
1114 | 1114 |
1115 Cmds expected; | 1115 Cmds expected; |
1116 for (int ii = 0; ii < 2; ++ii) { | 1116 for (int ii = 0; ii < 2; ++ii) { |
1117 for (int jj = 0; jj < 1; ++jj) { | 1117 for (int jj = 0; jj < 1; ++jj) { |
1118 expected.data[ii][jj] = static_cast<GLfloat>(ii * 1 + jj); | 1118 expected.data[ii][jj] = static_cast<GLfloat>(ii * 1 + jj); |
1119 } | 1119 } |
1120 } | 1120 } |
1121 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1121 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1122 gl_->Uniform1fv(1, 2, &expected.data[0][0]); | 1122 gl_->Uniform1fv(1, 2, &expected.data[0][0]); |
1123 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1123 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1124 } | 1124 } |
1125 | 1125 |
1126 TEST_F(GLES2ImplementationTest, Uniform1i) { | 1126 TEST_F(GLES2ImplementationTest, Uniform1i) { |
1127 struct Cmds { | 1127 struct Cmds { |
1128 Uniform1i cmd; | 1128 cmds::Uniform1i cmd; |
1129 }; | 1129 }; |
1130 Cmds expected; | 1130 Cmds expected; |
1131 expected.cmd.Init(1, 2); | 1131 expected.cmd.Init(1, 2); |
1132 | 1132 |
1133 gl_->Uniform1i(1, 2); | 1133 gl_->Uniform1i(1, 2); |
1134 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1134 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1135 } | 1135 } |
1136 | 1136 |
1137 TEST_F(GLES2ImplementationTest, Uniform1iv) { | 1137 TEST_F(GLES2ImplementationTest, Uniform1iv) { |
1138 struct Cmds { | 1138 struct Cmds { |
1139 Uniform1ivImmediate cmd; | 1139 cmds::Uniform1ivImmediate cmd; |
1140 GLint data[2][1]; | 1140 GLint data[2][1]; |
1141 }; | 1141 }; |
1142 | 1142 |
1143 Cmds expected; | 1143 Cmds expected; |
1144 for (int ii = 0; ii < 2; ++ii) { | 1144 for (int ii = 0; ii < 2; ++ii) { |
1145 for (int jj = 0; jj < 1; ++jj) { | 1145 for (int jj = 0; jj < 1; ++jj) { |
1146 expected.data[ii][jj] = static_cast<GLint>(ii * 1 + jj); | 1146 expected.data[ii][jj] = static_cast<GLint>(ii * 1 + jj); |
1147 } | 1147 } |
1148 } | 1148 } |
1149 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1149 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1150 gl_->Uniform1iv(1, 2, &expected.data[0][0]); | 1150 gl_->Uniform1iv(1, 2, &expected.data[0][0]); |
1151 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1151 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1152 } | 1152 } |
1153 | 1153 |
1154 TEST_F(GLES2ImplementationTest, Uniform2f) { | 1154 TEST_F(GLES2ImplementationTest, Uniform2f) { |
1155 struct Cmds { | 1155 struct Cmds { |
1156 Uniform2f cmd; | 1156 cmds::Uniform2f cmd; |
1157 }; | 1157 }; |
1158 Cmds expected; | 1158 Cmds expected; |
1159 expected.cmd.Init(1, 2, 3); | 1159 expected.cmd.Init(1, 2, 3); |
1160 | 1160 |
1161 gl_->Uniform2f(1, 2, 3); | 1161 gl_->Uniform2f(1, 2, 3); |
1162 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1162 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1163 } | 1163 } |
1164 | 1164 |
1165 TEST_F(GLES2ImplementationTest, Uniform2fv) { | 1165 TEST_F(GLES2ImplementationTest, Uniform2fv) { |
1166 struct Cmds { | 1166 struct Cmds { |
1167 Uniform2fvImmediate cmd; | 1167 cmds::Uniform2fvImmediate cmd; |
1168 GLfloat data[2][2]; | 1168 GLfloat data[2][2]; |
1169 }; | 1169 }; |
1170 | 1170 |
1171 Cmds expected; | 1171 Cmds expected; |
1172 for (int ii = 0; ii < 2; ++ii) { | 1172 for (int ii = 0; ii < 2; ++ii) { |
1173 for (int jj = 0; jj < 2; ++jj) { | 1173 for (int jj = 0; jj < 2; ++jj) { |
1174 expected.data[ii][jj] = static_cast<GLfloat>(ii * 2 + jj); | 1174 expected.data[ii][jj] = static_cast<GLfloat>(ii * 2 + jj); |
1175 } | 1175 } |
1176 } | 1176 } |
1177 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1177 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1178 gl_->Uniform2fv(1, 2, &expected.data[0][0]); | 1178 gl_->Uniform2fv(1, 2, &expected.data[0][0]); |
1179 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1179 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1180 } | 1180 } |
1181 | 1181 |
1182 TEST_F(GLES2ImplementationTest, Uniform2i) { | 1182 TEST_F(GLES2ImplementationTest, Uniform2i) { |
1183 struct Cmds { | 1183 struct Cmds { |
1184 Uniform2i cmd; | 1184 cmds::Uniform2i cmd; |
1185 }; | 1185 }; |
1186 Cmds expected; | 1186 Cmds expected; |
1187 expected.cmd.Init(1, 2, 3); | 1187 expected.cmd.Init(1, 2, 3); |
1188 | 1188 |
1189 gl_->Uniform2i(1, 2, 3); | 1189 gl_->Uniform2i(1, 2, 3); |
1190 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1190 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1191 } | 1191 } |
1192 | 1192 |
1193 TEST_F(GLES2ImplementationTest, Uniform2iv) { | 1193 TEST_F(GLES2ImplementationTest, Uniform2iv) { |
1194 struct Cmds { | 1194 struct Cmds { |
1195 Uniform2ivImmediate cmd; | 1195 cmds::Uniform2ivImmediate cmd; |
1196 GLint data[2][2]; | 1196 GLint data[2][2]; |
1197 }; | 1197 }; |
1198 | 1198 |
1199 Cmds expected; | 1199 Cmds expected; |
1200 for (int ii = 0; ii < 2; ++ii) { | 1200 for (int ii = 0; ii < 2; ++ii) { |
1201 for (int jj = 0; jj < 2; ++jj) { | 1201 for (int jj = 0; jj < 2; ++jj) { |
1202 expected.data[ii][jj] = static_cast<GLint>(ii * 2 + jj); | 1202 expected.data[ii][jj] = static_cast<GLint>(ii * 2 + jj); |
1203 } | 1203 } |
1204 } | 1204 } |
1205 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1205 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1206 gl_->Uniform2iv(1, 2, &expected.data[0][0]); | 1206 gl_->Uniform2iv(1, 2, &expected.data[0][0]); |
1207 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1207 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1208 } | 1208 } |
1209 | 1209 |
1210 TEST_F(GLES2ImplementationTest, Uniform3f) { | 1210 TEST_F(GLES2ImplementationTest, Uniform3f) { |
1211 struct Cmds { | 1211 struct Cmds { |
1212 Uniform3f cmd; | 1212 cmds::Uniform3f cmd; |
1213 }; | 1213 }; |
1214 Cmds expected; | 1214 Cmds expected; |
1215 expected.cmd.Init(1, 2, 3, 4); | 1215 expected.cmd.Init(1, 2, 3, 4); |
1216 | 1216 |
1217 gl_->Uniform3f(1, 2, 3, 4); | 1217 gl_->Uniform3f(1, 2, 3, 4); |
1218 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1218 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1219 } | 1219 } |
1220 | 1220 |
1221 TEST_F(GLES2ImplementationTest, Uniform3fv) { | 1221 TEST_F(GLES2ImplementationTest, Uniform3fv) { |
1222 struct Cmds { | 1222 struct Cmds { |
1223 Uniform3fvImmediate cmd; | 1223 cmds::Uniform3fvImmediate cmd; |
1224 GLfloat data[2][3]; | 1224 GLfloat data[2][3]; |
1225 }; | 1225 }; |
1226 | 1226 |
1227 Cmds expected; | 1227 Cmds expected; |
1228 for (int ii = 0; ii < 2; ++ii) { | 1228 for (int ii = 0; ii < 2; ++ii) { |
1229 for (int jj = 0; jj < 3; ++jj) { | 1229 for (int jj = 0; jj < 3; ++jj) { |
1230 expected.data[ii][jj] = static_cast<GLfloat>(ii * 3 + jj); | 1230 expected.data[ii][jj] = static_cast<GLfloat>(ii * 3 + jj); |
1231 } | 1231 } |
1232 } | 1232 } |
1233 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1233 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1234 gl_->Uniform3fv(1, 2, &expected.data[0][0]); | 1234 gl_->Uniform3fv(1, 2, &expected.data[0][0]); |
1235 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1235 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1236 } | 1236 } |
1237 | 1237 |
1238 TEST_F(GLES2ImplementationTest, Uniform3i) { | 1238 TEST_F(GLES2ImplementationTest, Uniform3i) { |
1239 struct Cmds { | 1239 struct Cmds { |
1240 Uniform3i cmd; | 1240 cmds::Uniform3i cmd; |
1241 }; | 1241 }; |
1242 Cmds expected; | 1242 Cmds expected; |
1243 expected.cmd.Init(1, 2, 3, 4); | 1243 expected.cmd.Init(1, 2, 3, 4); |
1244 | 1244 |
1245 gl_->Uniform3i(1, 2, 3, 4); | 1245 gl_->Uniform3i(1, 2, 3, 4); |
1246 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1246 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1247 } | 1247 } |
1248 | 1248 |
1249 TEST_F(GLES2ImplementationTest, Uniform3iv) { | 1249 TEST_F(GLES2ImplementationTest, Uniform3iv) { |
1250 struct Cmds { | 1250 struct Cmds { |
1251 Uniform3ivImmediate cmd; | 1251 cmds::Uniform3ivImmediate cmd; |
1252 GLint data[2][3]; | 1252 GLint data[2][3]; |
1253 }; | 1253 }; |
1254 | 1254 |
1255 Cmds expected; | 1255 Cmds expected; |
1256 for (int ii = 0; ii < 2; ++ii) { | 1256 for (int ii = 0; ii < 2; ++ii) { |
1257 for (int jj = 0; jj < 3; ++jj) { | 1257 for (int jj = 0; jj < 3; ++jj) { |
1258 expected.data[ii][jj] = static_cast<GLint>(ii * 3 + jj); | 1258 expected.data[ii][jj] = static_cast<GLint>(ii * 3 + jj); |
1259 } | 1259 } |
1260 } | 1260 } |
1261 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1261 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1262 gl_->Uniform3iv(1, 2, &expected.data[0][0]); | 1262 gl_->Uniform3iv(1, 2, &expected.data[0][0]); |
1263 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1263 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1264 } | 1264 } |
1265 | 1265 |
1266 TEST_F(GLES2ImplementationTest, Uniform4f) { | 1266 TEST_F(GLES2ImplementationTest, Uniform4f) { |
1267 struct Cmds { | 1267 struct Cmds { |
1268 Uniform4f cmd; | 1268 cmds::Uniform4f cmd; |
1269 }; | 1269 }; |
1270 Cmds expected; | 1270 Cmds expected; |
1271 expected.cmd.Init(1, 2, 3, 4, 5); | 1271 expected.cmd.Init(1, 2, 3, 4, 5); |
1272 | 1272 |
1273 gl_->Uniform4f(1, 2, 3, 4, 5); | 1273 gl_->Uniform4f(1, 2, 3, 4, 5); |
1274 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1274 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1275 } | 1275 } |
1276 | 1276 |
1277 TEST_F(GLES2ImplementationTest, Uniform4fv) { | 1277 TEST_F(GLES2ImplementationTest, Uniform4fv) { |
1278 struct Cmds { | 1278 struct Cmds { |
1279 Uniform4fvImmediate cmd; | 1279 cmds::Uniform4fvImmediate cmd; |
1280 GLfloat data[2][4]; | 1280 GLfloat data[2][4]; |
1281 }; | 1281 }; |
1282 | 1282 |
1283 Cmds expected; | 1283 Cmds expected; |
1284 for (int ii = 0; ii < 2; ++ii) { | 1284 for (int ii = 0; ii < 2; ++ii) { |
1285 for (int jj = 0; jj < 4; ++jj) { | 1285 for (int jj = 0; jj < 4; ++jj) { |
1286 expected.data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj); | 1286 expected.data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj); |
1287 } | 1287 } |
1288 } | 1288 } |
1289 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1289 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1290 gl_->Uniform4fv(1, 2, &expected.data[0][0]); | 1290 gl_->Uniform4fv(1, 2, &expected.data[0][0]); |
1291 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1291 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1292 } | 1292 } |
1293 | 1293 |
1294 TEST_F(GLES2ImplementationTest, Uniform4i) { | 1294 TEST_F(GLES2ImplementationTest, Uniform4i) { |
1295 struct Cmds { | 1295 struct Cmds { |
1296 Uniform4i cmd; | 1296 cmds::Uniform4i cmd; |
1297 }; | 1297 }; |
1298 Cmds expected; | 1298 Cmds expected; |
1299 expected.cmd.Init(1, 2, 3, 4, 5); | 1299 expected.cmd.Init(1, 2, 3, 4, 5); |
1300 | 1300 |
1301 gl_->Uniform4i(1, 2, 3, 4, 5); | 1301 gl_->Uniform4i(1, 2, 3, 4, 5); |
1302 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1302 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1303 } | 1303 } |
1304 | 1304 |
1305 TEST_F(GLES2ImplementationTest, Uniform4iv) { | 1305 TEST_F(GLES2ImplementationTest, Uniform4iv) { |
1306 struct Cmds { | 1306 struct Cmds { |
1307 Uniform4ivImmediate cmd; | 1307 cmds::Uniform4ivImmediate cmd; |
1308 GLint data[2][4]; | 1308 GLint data[2][4]; |
1309 }; | 1309 }; |
1310 | 1310 |
1311 Cmds expected; | 1311 Cmds expected; |
1312 for (int ii = 0; ii < 2; ++ii) { | 1312 for (int ii = 0; ii < 2; ++ii) { |
1313 for (int jj = 0; jj < 4; ++jj) { | 1313 for (int jj = 0; jj < 4; ++jj) { |
1314 expected.data[ii][jj] = static_cast<GLint>(ii * 4 + jj); | 1314 expected.data[ii][jj] = static_cast<GLint>(ii * 4 + jj); |
1315 } | 1315 } |
1316 } | 1316 } |
1317 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1317 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1318 gl_->Uniform4iv(1, 2, &expected.data[0][0]); | 1318 gl_->Uniform4iv(1, 2, &expected.data[0][0]); |
1319 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1319 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1320 } | 1320 } |
1321 | 1321 |
1322 TEST_F(GLES2ImplementationTest, UniformMatrix2fv) { | 1322 TEST_F(GLES2ImplementationTest, UniformMatrix2fv) { |
1323 struct Cmds { | 1323 struct Cmds { |
1324 UniformMatrix2fvImmediate cmd; | 1324 cmds::UniformMatrix2fvImmediate cmd; |
1325 GLfloat data[2][4]; | 1325 GLfloat data[2][4]; |
1326 }; | 1326 }; |
1327 | 1327 |
1328 Cmds expected; | 1328 Cmds expected; |
1329 for (int ii = 0; ii < 2; ++ii) { | 1329 for (int ii = 0; ii < 2; ++ii) { |
1330 for (int jj = 0; jj < 4; ++jj) { | 1330 for (int jj = 0; jj < 4; ++jj) { |
1331 expected.data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj); | 1331 expected.data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj); |
1332 } | 1332 } |
1333 } | 1333 } |
1334 expected.cmd.Init(1, 2, false, &expected.data[0][0]); | 1334 expected.cmd.Init(1, 2, false, &expected.data[0][0]); |
1335 gl_->UniformMatrix2fv(1, 2, false, &expected.data[0][0]); | 1335 gl_->UniformMatrix2fv(1, 2, false, &expected.data[0][0]); |
1336 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1336 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1337 } | 1337 } |
1338 | 1338 |
1339 TEST_F(GLES2ImplementationTest, UniformMatrix3fv) { | 1339 TEST_F(GLES2ImplementationTest, UniformMatrix3fv) { |
1340 struct Cmds { | 1340 struct Cmds { |
1341 UniformMatrix3fvImmediate cmd; | 1341 cmds::UniformMatrix3fvImmediate cmd; |
1342 GLfloat data[2][9]; | 1342 GLfloat data[2][9]; |
1343 }; | 1343 }; |
1344 | 1344 |
1345 Cmds expected; | 1345 Cmds expected; |
1346 for (int ii = 0; ii < 2; ++ii) { | 1346 for (int ii = 0; ii < 2; ++ii) { |
1347 for (int jj = 0; jj < 9; ++jj) { | 1347 for (int jj = 0; jj < 9; ++jj) { |
1348 expected.data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj); | 1348 expected.data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj); |
1349 } | 1349 } |
1350 } | 1350 } |
1351 expected.cmd.Init(1, 2, false, &expected.data[0][0]); | 1351 expected.cmd.Init(1, 2, false, &expected.data[0][0]); |
1352 gl_->UniformMatrix3fv(1, 2, false, &expected.data[0][0]); | 1352 gl_->UniformMatrix3fv(1, 2, false, &expected.data[0][0]); |
1353 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1353 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1354 } | 1354 } |
1355 | 1355 |
1356 TEST_F(GLES2ImplementationTest, UniformMatrix4fv) { | 1356 TEST_F(GLES2ImplementationTest, UniformMatrix4fv) { |
1357 struct Cmds { | 1357 struct Cmds { |
1358 UniformMatrix4fvImmediate cmd; | 1358 cmds::UniformMatrix4fvImmediate cmd; |
1359 GLfloat data[2][16]; | 1359 GLfloat data[2][16]; |
1360 }; | 1360 }; |
1361 | 1361 |
1362 Cmds expected; | 1362 Cmds expected; |
1363 for (int ii = 0; ii < 2; ++ii) { | 1363 for (int ii = 0; ii < 2; ++ii) { |
1364 for (int jj = 0; jj < 16; ++jj) { | 1364 for (int jj = 0; jj < 16; ++jj) { |
1365 expected.data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj); | 1365 expected.data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj); |
1366 } | 1366 } |
1367 } | 1367 } |
1368 expected.cmd.Init(1, 2, false, &expected.data[0][0]); | 1368 expected.cmd.Init(1, 2, false, &expected.data[0][0]); |
1369 gl_->UniformMatrix4fv(1, 2, false, &expected.data[0][0]); | 1369 gl_->UniformMatrix4fv(1, 2, false, &expected.data[0][0]); |
1370 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1370 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1371 } | 1371 } |
1372 | 1372 |
1373 TEST_F(GLES2ImplementationTest, UseProgram) { | 1373 TEST_F(GLES2ImplementationTest, UseProgram) { |
1374 struct Cmds { | 1374 struct Cmds { |
1375 UseProgram cmd; | 1375 cmds::UseProgram cmd; |
1376 }; | 1376 }; |
1377 Cmds expected; | 1377 Cmds expected; |
1378 expected.cmd.Init(1); | 1378 expected.cmd.Init(1); |
1379 | 1379 |
1380 gl_->UseProgram(1); | 1380 gl_->UseProgram(1); |
1381 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1381 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1382 } | 1382 } |
1383 | 1383 |
1384 TEST_F(GLES2ImplementationTest, ValidateProgram) { | 1384 TEST_F(GLES2ImplementationTest, ValidateProgram) { |
1385 struct Cmds { | 1385 struct Cmds { |
1386 ValidateProgram cmd; | 1386 cmds::ValidateProgram cmd; |
1387 }; | 1387 }; |
1388 Cmds expected; | 1388 Cmds expected; |
1389 expected.cmd.Init(1); | 1389 expected.cmd.Init(1); |
1390 | 1390 |
1391 gl_->ValidateProgram(1); | 1391 gl_->ValidateProgram(1); |
1392 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1392 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1393 } | 1393 } |
1394 | 1394 |
1395 TEST_F(GLES2ImplementationTest, VertexAttrib1f) { | 1395 TEST_F(GLES2ImplementationTest, VertexAttrib1f) { |
1396 struct Cmds { | 1396 struct Cmds { |
1397 VertexAttrib1f cmd; | 1397 cmds::VertexAttrib1f cmd; |
1398 }; | 1398 }; |
1399 Cmds expected; | 1399 Cmds expected; |
1400 expected.cmd.Init(1, 2); | 1400 expected.cmd.Init(1, 2); |
1401 | 1401 |
1402 gl_->VertexAttrib1f(1, 2); | 1402 gl_->VertexAttrib1f(1, 2); |
1403 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1403 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1404 } | 1404 } |
1405 | 1405 |
1406 TEST_F(GLES2ImplementationTest, VertexAttrib1fv) { | 1406 TEST_F(GLES2ImplementationTest, VertexAttrib1fv) { |
1407 struct Cmds { | 1407 struct Cmds { |
1408 VertexAttrib1fvImmediate cmd; | 1408 cmds::VertexAttrib1fvImmediate cmd; |
1409 GLfloat data[1]; | 1409 GLfloat data[1]; |
1410 }; | 1410 }; |
1411 | 1411 |
1412 Cmds expected; | 1412 Cmds expected; |
1413 for (int jj = 0; jj < 1; ++jj) { | 1413 for (int jj = 0; jj < 1; ++jj) { |
1414 expected.data[jj] = static_cast<GLfloat>(jj); | 1414 expected.data[jj] = static_cast<GLfloat>(jj); |
1415 } | 1415 } |
1416 expected.cmd.Init(1, &expected.data[0]); | 1416 expected.cmd.Init(1, &expected.data[0]); |
1417 gl_->VertexAttrib1fv(1, &expected.data[0]); | 1417 gl_->VertexAttrib1fv(1, &expected.data[0]); |
1418 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1418 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1419 } | 1419 } |
1420 | 1420 |
1421 TEST_F(GLES2ImplementationTest, VertexAttrib2f) { | 1421 TEST_F(GLES2ImplementationTest, VertexAttrib2f) { |
1422 struct Cmds { | 1422 struct Cmds { |
1423 VertexAttrib2f cmd; | 1423 cmds::VertexAttrib2f cmd; |
1424 }; | 1424 }; |
1425 Cmds expected; | 1425 Cmds expected; |
1426 expected.cmd.Init(1, 2, 3); | 1426 expected.cmd.Init(1, 2, 3); |
1427 | 1427 |
1428 gl_->VertexAttrib2f(1, 2, 3); | 1428 gl_->VertexAttrib2f(1, 2, 3); |
1429 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1429 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1430 } | 1430 } |
1431 | 1431 |
1432 TEST_F(GLES2ImplementationTest, VertexAttrib2fv) { | 1432 TEST_F(GLES2ImplementationTest, VertexAttrib2fv) { |
1433 struct Cmds { | 1433 struct Cmds { |
1434 VertexAttrib2fvImmediate cmd; | 1434 cmds::VertexAttrib2fvImmediate cmd; |
1435 GLfloat data[2]; | 1435 GLfloat data[2]; |
1436 }; | 1436 }; |
1437 | 1437 |
1438 Cmds expected; | 1438 Cmds expected; |
1439 for (int jj = 0; jj < 2; ++jj) { | 1439 for (int jj = 0; jj < 2; ++jj) { |
1440 expected.data[jj] = static_cast<GLfloat>(jj); | 1440 expected.data[jj] = static_cast<GLfloat>(jj); |
1441 } | 1441 } |
1442 expected.cmd.Init(1, &expected.data[0]); | 1442 expected.cmd.Init(1, &expected.data[0]); |
1443 gl_->VertexAttrib2fv(1, &expected.data[0]); | 1443 gl_->VertexAttrib2fv(1, &expected.data[0]); |
1444 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1444 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1445 } | 1445 } |
1446 | 1446 |
1447 TEST_F(GLES2ImplementationTest, VertexAttrib3f) { | 1447 TEST_F(GLES2ImplementationTest, VertexAttrib3f) { |
1448 struct Cmds { | 1448 struct Cmds { |
1449 VertexAttrib3f cmd; | 1449 cmds::VertexAttrib3f cmd; |
1450 }; | 1450 }; |
1451 Cmds expected; | 1451 Cmds expected; |
1452 expected.cmd.Init(1, 2, 3, 4); | 1452 expected.cmd.Init(1, 2, 3, 4); |
1453 | 1453 |
1454 gl_->VertexAttrib3f(1, 2, 3, 4); | 1454 gl_->VertexAttrib3f(1, 2, 3, 4); |
1455 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1455 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1456 } | 1456 } |
1457 | 1457 |
1458 TEST_F(GLES2ImplementationTest, VertexAttrib3fv) { | 1458 TEST_F(GLES2ImplementationTest, VertexAttrib3fv) { |
1459 struct Cmds { | 1459 struct Cmds { |
1460 VertexAttrib3fvImmediate cmd; | 1460 cmds::VertexAttrib3fvImmediate cmd; |
1461 GLfloat data[3]; | 1461 GLfloat data[3]; |
1462 }; | 1462 }; |
1463 | 1463 |
1464 Cmds expected; | 1464 Cmds expected; |
1465 for (int jj = 0; jj < 3; ++jj) { | 1465 for (int jj = 0; jj < 3; ++jj) { |
1466 expected.data[jj] = static_cast<GLfloat>(jj); | 1466 expected.data[jj] = static_cast<GLfloat>(jj); |
1467 } | 1467 } |
1468 expected.cmd.Init(1, &expected.data[0]); | 1468 expected.cmd.Init(1, &expected.data[0]); |
1469 gl_->VertexAttrib3fv(1, &expected.data[0]); | 1469 gl_->VertexAttrib3fv(1, &expected.data[0]); |
1470 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1470 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1471 } | 1471 } |
1472 | 1472 |
1473 TEST_F(GLES2ImplementationTest, VertexAttrib4f) { | 1473 TEST_F(GLES2ImplementationTest, VertexAttrib4f) { |
1474 struct Cmds { | 1474 struct Cmds { |
1475 VertexAttrib4f cmd; | 1475 cmds::VertexAttrib4f cmd; |
1476 }; | 1476 }; |
1477 Cmds expected; | 1477 Cmds expected; |
1478 expected.cmd.Init(1, 2, 3, 4, 5); | 1478 expected.cmd.Init(1, 2, 3, 4, 5); |
1479 | 1479 |
1480 gl_->VertexAttrib4f(1, 2, 3, 4, 5); | 1480 gl_->VertexAttrib4f(1, 2, 3, 4, 5); |
1481 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1481 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1482 } | 1482 } |
1483 | 1483 |
1484 TEST_F(GLES2ImplementationTest, VertexAttrib4fv) { | 1484 TEST_F(GLES2ImplementationTest, VertexAttrib4fv) { |
1485 struct Cmds { | 1485 struct Cmds { |
1486 VertexAttrib4fvImmediate cmd; | 1486 cmds::VertexAttrib4fvImmediate cmd; |
1487 GLfloat data[4]; | 1487 GLfloat data[4]; |
1488 }; | 1488 }; |
1489 | 1489 |
1490 Cmds expected; | 1490 Cmds expected; |
1491 for (int jj = 0; jj < 4; ++jj) { | 1491 for (int jj = 0; jj < 4; ++jj) { |
1492 expected.data[jj] = static_cast<GLfloat>(jj); | 1492 expected.data[jj] = static_cast<GLfloat>(jj); |
1493 } | 1493 } |
1494 expected.cmd.Init(1, &expected.data[0]); | 1494 expected.cmd.Init(1, &expected.data[0]); |
1495 gl_->VertexAttrib4fv(1, &expected.data[0]); | 1495 gl_->VertexAttrib4fv(1, &expected.data[0]); |
1496 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1496 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1497 } | 1497 } |
1498 | 1498 |
1499 TEST_F(GLES2ImplementationTest, Viewport) { | 1499 TEST_F(GLES2ImplementationTest, Viewport) { |
1500 struct Cmds { | 1500 struct Cmds { |
1501 Viewport cmd; | 1501 cmds::Viewport cmd; |
1502 }; | 1502 }; |
1503 Cmds expected; | 1503 Cmds expected; |
1504 expected.cmd.Init(1, 2, 3, 4); | 1504 expected.cmd.Init(1, 2, 3, 4); |
1505 | 1505 |
1506 gl_->Viewport(1, 2, 3, 4); | 1506 gl_->Viewport(1, 2, 3, 4); |
1507 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1507 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1508 } | 1508 } |
1509 | 1509 |
1510 TEST_F(GLES2ImplementationTest, BlitFramebufferEXT) { | 1510 TEST_F(GLES2ImplementationTest, BlitFramebufferEXT) { |
1511 struct Cmds { | 1511 struct Cmds { |
1512 BlitFramebufferEXT cmd; | 1512 cmds::BlitFramebufferEXT cmd; |
1513 }; | 1513 }; |
1514 Cmds expected; | 1514 Cmds expected; |
1515 expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST); | 1515 expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST); |
1516 | 1516 |
1517 gl_->BlitFramebufferEXT(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST); | 1517 gl_->BlitFramebufferEXT(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST); |
1518 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1518 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1519 } | 1519 } |
1520 | 1520 |
1521 TEST_F(GLES2ImplementationTest, RenderbufferStorageMultisampleEXT) { | 1521 TEST_F(GLES2ImplementationTest, RenderbufferStorageMultisampleEXT) { |
1522 struct Cmds { | 1522 struct Cmds { |
1523 RenderbufferStorageMultisampleEXT cmd; | 1523 cmds::RenderbufferStorageMultisampleEXT cmd; |
1524 }; | 1524 }; |
1525 Cmds expected; | 1525 Cmds expected; |
1526 expected.cmd.Init(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5); | 1526 expected.cmd.Init(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5); |
1527 | 1527 |
1528 gl_->RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5); | 1528 gl_->RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5); |
1529 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1529 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1530 } | 1530 } |
1531 | 1531 |
1532 TEST_F(GLES2ImplementationTest, TexStorage2DEXT) { | 1532 TEST_F(GLES2ImplementationTest, TexStorage2DEXT) { |
1533 struct Cmds { | 1533 struct Cmds { |
1534 TexStorage2DEXT cmd; | 1534 cmds::TexStorage2DEXT cmd; |
1535 }; | 1535 }; |
1536 Cmds expected; | 1536 Cmds expected; |
1537 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5); | 1537 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5); |
1538 | 1538 |
1539 gl_->TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5); | 1539 gl_->TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5); |
1540 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1540 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1541 } | 1541 } |
1542 | 1542 |
1543 TEST_F(GLES2ImplementationTest, GenQueriesEXT) { | 1543 TEST_F(GLES2ImplementationTest, GenQueriesEXT) { |
1544 GLuint ids[2] = { 0, }; | 1544 GLuint ids[2] = { 0, }; |
1545 struct Cmds { | 1545 struct Cmds { |
1546 GenQueriesEXTImmediate gen; | 1546 cmds::GenQueriesEXTImmediate gen; |
1547 GLuint data[2]; | 1547 GLuint data[2]; |
1548 }; | 1548 }; |
1549 Cmds expected; | 1549 Cmds expected; |
1550 expected.gen.Init(arraysize(ids), &ids[0]); | 1550 expected.gen.Init(arraysize(ids), &ids[0]); |
1551 expected.data[0] = kQueriesStartId; | 1551 expected.data[0] = kQueriesStartId; |
1552 expected.data[1] = kQueriesStartId + 1; | 1552 expected.data[1] = kQueriesStartId + 1; |
1553 gl_->GenQueriesEXT(arraysize(ids), &ids[0]); | 1553 gl_->GenQueriesEXT(arraysize(ids), &ids[0]); |
1554 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1554 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1555 EXPECT_EQ(kQueriesStartId, ids[0]); | 1555 EXPECT_EQ(kQueriesStartId, ids[0]); |
1556 EXPECT_EQ(kQueriesStartId + 1, ids[1]); | 1556 EXPECT_EQ(kQueriesStartId + 1, ids[1]); |
1557 } | 1557 } |
1558 | 1558 |
1559 TEST_F(GLES2ImplementationTest, DeleteQueriesEXT) { | 1559 TEST_F(GLES2ImplementationTest, DeleteQueriesEXT) { |
1560 GLuint ids[2] = { kQueriesStartId, kQueriesStartId + 1 }; | 1560 GLuint ids[2] = { kQueriesStartId, kQueriesStartId + 1 }; |
1561 struct Cmds { | 1561 struct Cmds { |
1562 DeleteQueriesEXTImmediate del; | 1562 cmds::DeleteQueriesEXTImmediate del; |
1563 GLuint data[2]; | 1563 GLuint data[2]; |
1564 }; | 1564 }; |
1565 Cmds expected; | 1565 Cmds expected; |
1566 expected.del.Init(arraysize(ids), &ids[0]); | 1566 expected.del.Init(arraysize(ids), &ids[0]); |
1567 expected.data[0] = kQueriesStartId; | 1567 expected.data[0] = kQueriesStartId; |
1568 expected.data[1] = kQueriesStartId + 1; | 1568 expected.data[1] = kQueriesStartId + 1; |
1569 gl_->DeleteQueriesEXT(arraysize(ids), &ids[0]); | 1569 gl_->DeleteQueriesEXT(arraysize(ids), &ids[0]); |
1570 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1570 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1571 } | 1571 } |
1572 // TODO: Implement unit test for BeginQueryEXT | 1572 // TODO: Implement unit test for BeginQueryEXT |
1573 // TODO: Implement unit test for InsertEventMarkerEXT | 1573 // TODO: Implement unit test for InsertEventMarkerEXT |
1574 // TODO: Implement unit test for PushGroupMarkerEXT | 1574 // TODO: Implement unit test for PushGroupMarkerEXT |
1575 | 1575 |
1576 TEST_F(GLES2ImplementationTest, PopGroupMarkerEXT) { | 1576 TEST_F(GLES2ImplementationTest, PopGroupMarkerEXT) { |
1577 struct Cmds { | 1577 struct Cmds { |
1578 PopGroupMarkerEXT cmd; | 1578 cmds::PopGroupMarkerEXT cmd; |
1579 }; | 1579 }; |
1580 Cmds expected; | 1580 Cmds expected; |
1581 expected.cmd.Init(); | 1581 expected.cmd.Init(); |
1582 | 1582 |
1583 gl_->PopGroupMarkerEXT(); | 1583 gl_->PopGroupMarkerEXT(); |
1584 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1584 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1585 } | 1585 } |
1586 | 1586 |
1587 TEST_F(GLES2ImplementationTest, GenVertexArraysOES) { | 1587 TEST_F(GLES2ImplementationTest, GenVertexArraysOES) { |
1588 GLuint ids[2] = { 0, }; | 1588 GLuint ids[2] = { 0, }; |
1589 struct Cmds { | 1589 struct Cmds { |
1590 GenVertexArraysOESImmediate gen; | 1590 cmds::GenVertexArraysOESImmediate gen; |
1591 GLuint data[2]; | 1591 GLuint data[2]; |
1592 }; | 1592 }; |
1593 Cmds expected; | 1593 Cmds expected; |
1594 expected.gen.Init(arraysize(ids), &ids[0]); | 1594 expected.gen.Init(arraysize(ids), &ids[0]); |
1595 expected.data[0] = kVertexArraysStartId; | 1595 expected.data[0] = kVertexArraysStartId; |
1596 expected.data[1] = kVertexArraysStartId + 1; | 1596 expected.data[1] = kVertexArraysStartId + 1; |
1597 gl_->GenVertexArraysOES(arraysize(ids), &ids[0]); | 1597 gl_->GenVertexArraysOES(arraysize(ids), &ids[0]); |
1598 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1598 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1599 EXPECT_EQ(kVertexArraysStartId, ids[0]); | 1599 EXPECT_EQ(kVertexArraysStartId, ids[0]); |
1600 EXPECT_EQ(kVertexArraysStartId + 1, ids[1]); | 1600 EXPECT_EQ(kVertexArraysStartId + 1, ids[1]); |
1601 } | 1601 } |
1602 | 1602 |
1603 TEST_F(GLES2ImplementationTest, DeleteVertexArraysOES) { | 1603 TEST_F(GLES2ImplementationTest, DeleteVertexArraysOES) { |
1604 GLuint ids[2] = { kVertexArraysStartId, kVertexArraysStartId + 1 }; | 1604 GLuint ids[2] = { kVertexArraysStartId, kVertexArraysStartId + 1 }; |
1605 struct Cmds { | 1605 struct Cmds { |
1606 DeleteVertexArraysOESImmediate del; | 1606 cmds::DeleteVertexArraysOESImmediate del; |
1607 GLuint data[2]; | 1607 GLuint data[2]; |
1608 }; | 1608 }; |
1609 Cmds expected; | 1609 Cmds expected; |
1610 expected.del.Init(arraysize(ids), &ids[0]); | 1610 expected.del.Init(arraysize(ids), &ids[0]); |
1611 expected.data[0] = kVertexArraysStartId; | 1611 expected.data[0] = kVertexArraysStartId; |
1612 expected.data[1] = kVertexArraysStartId + 1; | 1612 expected.data[1] = kVertexArraysStartId + 1; |
1613 gl_->DeleteVertexArraysOES(arraysize(ids), &ids[0]); | 1613 gl_->DeleteVertexArraysOES(arraysize(ids), &ids[0]); |
1614 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1614 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1615 } | 1615 } |
1616 | 1616 |
1617 TEST_F(GLES2ImplementationTest, IsVertexArrayOES) { | 1617 TEST_F(GLES2ImplementationTest, IsVertexArrayOES) { |
1618 struct Cmds { | 1618 struct Cmds { |
1619 IsVertexArrayOES cmd; | 1619 cmds::IsVertexArrayOES cmd; |
1620 }; | 1620 }; |
1621 | 1621 |
1622 typedef IsVertexArrayOES::Result Result; | 1622 typedef cmds::IsVertexArrayOES::Result Result; |
1623 Cmds expected; | 1623 Cmds expected; |
1624 ExpectedMemoryInfo result1 = | 1624 ExpectedMemoryInfo result1 = |
1625 GetExpectedResultMemory(sizeof(IsVertexArrayOES::Result)); | 1625 GetExpectedResultMemory(sizeof(cmds::IsVertexArrayOES::Result)); |
1626 expected.cmd.Init(1, result1.id, result1.offset); | 1626 expected.cmd.Init(1, result1.id, result1.offset); |
1627 | 1627 |
1628 EXPECT_CALL(*command_buffer(), OnFlush()) | 1628 EXPECT_CALL(*command_buffer(), OnFlush()) |
1629 .WillOnce(SetMemory(result1.ptr, uint32(1))) | 1629 .WillOnce(SetMemory(result1.ptr, uint32(1))) |
1630 .RetiresOnSaturation(); | 1630 .RetiresOnSaturation(); |
1631 | 1631 |
1632 GLboolean result = gl_->IsVertexArrayOES(1); | 1632 GLboolean result = gl_->IsVertexArrayOES(1); |
1633 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1633 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1634 EXPECT_TRUE(result); | 1634 EXPECT_TRUE(result); |
1635 } | 1635 } |
1636 // TODO: Implement unit test for GenSharedIdsCHROMIUM | 1636 // TODO: Implement unit test for GenSharedIdsCHROMIUM |
1637 // TODO: Implement unit test for DeleteSharedIdsCHROMIUM | 1637 // TODO: Implement unit test for DeleteSharedIdsCHROMIUM |
1638 // TODO: Implement unit test for RegisterSharedIdsCHROMIUM | 1638 // TODO: Implement unit test for RegisterSharedIdsCHROMIUM |
1639 // TODO: Implement unit test for EnableFeatureCHROMIUM | 1639 // TODO: Implement unit test for EnableFeatureCHROMIUM |
1640 | 1640 |
1641 TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) { | 1641 TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) { |
1642 struct Cmds { | 1642 struct Cmds { |
1643 ResizeCHROMIUM cmd; | 1643 cmds::ResizeCHROMIUM cmd; |
1644 }; | 1644 }; |
1645 Cmds expected; | 1645 Cmds expected; |
1646 expected.cmd.Init(1, 2); | 1646 expected.cmd.Init(1, 2); |
1647 | 1647 |
1648 gl_->ResizeCHROMIUM(1, 2); | 1648 gl_->ResizeCHROMIUM(1, 2); |
1649 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1649 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1650 } | 1650 } |
1651 // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM | 1651 // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM |
1652 | 1652 |
1653 TEST_F(GLES2ImplementationTest, DestroyStreamTextureCHROMIUM) { | 1653 TEST_F(GLES2ImplementationTest, DestroyStreamTextureCHROMIUM) { |
1654 struct Cmds { | 1654 struct Cmds { |
1655 DestroyStreamTextureCHROMIUM cmd; | 1655 cmds::DestroyStreamTextureCHROMIUM cmd; |
1656 }; | 1656 }; |
1657 Cmds expected; | 1657 Cmds expected; |
1658 expected.cmd.Init(1); | 1658 expected.cmd.Init(1); |
1659 | 1659 |
1660 gl_->DestroyStreamTextureCHROMIUM(1); | 1660 gl_->DestroyStreamTextureCHROMIUM(1); |
1661 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1661 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1662 } | 1662 } |
1663 // TODO: Implement unit test for GetTranslatedShaderSourceANGLE | 1663 // TODO: Implement unit test for GetTranslatedShaderSourceANGLE |
1664 | 1664 |
1665 TEST_F(GLES2ImplementationTest, TexImageIOSurface2DCHROMIUM) { | 1665 TEST_F(GLES2ImplementationTest, TexImageIOSurface2DCHROMIUM) { |
1666 struct Cmds { | 1666 struct Cmds { |
1667 TexImageIOSurface2DCHROMIUM cmd; | 1667 cmds::TexImageIOSurface2DCHROMIUM cmd; |
1668 }; | 1668 }; |
1669 Cmds expected; | 1669 Cmds expected; |
1670 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5); | 1670 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5); |
1671 | 1671 |
1672 gl_->TexImageIOSurface2DCHROMIUM(GL_TEXTURE_2D, 2, 3, 4, 5); | 1672 gl_->TexImageIOSurface2DCHROMIUM(GL_TEXTURE_2D, 2, 3, 4, 5); |
1673 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1673 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1674 } | 1674 } |
1675 | 1675 |
1676 TEST_F(GLES2ImplementationTest, CopyTextureCHROMIUM) { | 1676 TEST_F(GLES2ImplementationTest, CopyTextureCHROMIUM) { |
1677 struct Cmds { | 1677 struct Cmds { |
1678 CopyTextureCHROMIUM cmd; | 1678 cmds::CopyTextureCHROMIUM cmd; |
1679 }; | 1679 }; |
1680 Cmds expected; | 1680 Cmds expected; |
1681 expected.cmd.Init(1, 2, 3, 4, GL_ALPHA); | 1681 expected.cmd.Init(1, 2, 3, 4, GL_ALPHA); |
1682 | 1682 |
1683 gl_->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA); | 1683 gl_->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA); |
1684 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1684 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1685 } | 1685 } |
1686 | 1686 |
1687 TEST_F(GLES2ImplementationTest, DrawArraysInstancedANGLE) { | 1687 TEST_F(GLES2ImplementationTest, DrawArraysInstancedANGLE) { |
1688 struct Cmds { | 1688 struct Cmds { |
1689 DrawArraysInstancedANGLE cmd; | 1689 cmds::DrawArraysInstancedANGLE cmd; |
1690 }; | 1690 }; |
1691 Cmds expected; | 1691 Cmds expected; |
1692 expected.cmd.Init(GL_POINTS, 2, 3, 4); | 1692 expected.cmd.Init(GL_POINTS, 2, 3, 4); |
1693 | 1693 |
1694 gl_->DrawArraysInstancedANGLE(GL_POINTS, 2, 3, 4); | 1694 gl_->DrawArraysInstancedANGLE(GL_POINTS, 2, 3, 4); |
1695 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1695 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1696 } | 1696 } |
1697 | 1697 |
1698 TEST_F(GLES2ImplementationTest, VertexAttribDivisorANGLE) { | 1698 TEST_F(GLES2ImplementationTest, VertexAttribDivisorANGLE) { |
1699 struct Cmds { | 1699 struct Cmds { |
1700 VertexAttribDivisorANGLE cmd; | 1700 cmds::VertexAttribDivisorANGLE cmd; |
1701 }; | 1701 }; |
1702 Cmds expected; | 1702 Cmds expected; |
1703 expected.cmd.Init(1, 2); | 1703 expected.cmd.Init(1, 2); |
1704 | 1704 |
1705 gl_->VertexAttribDivisorANGLE(1, 2); | 1705 gl_->VertexAttribDivisorANGLE(1, 2); |
1706 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1706 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1707 } | 1707 } |
1708 | 1708 |
1709 TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) { | 1709 TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) { |
1710 struct Cmds { | 1710 struct Cmds { |
1711 ProduceTextureCHROMIUMImmediate cmd; | 1711 cmds::ProduceTextureCHROMIUMImmediate cmd; |
1712 GLbyte data[64]; | 1712 GLbyte data[64]; |
1713 }; | 1713 }; |
1714 | 1714 |
1715 Cmds expected; | 1715 Cmds expected; |
1716 for (int jj = 0; jj < 64; ++jj) { | 1716 for (int jj = 0; jj < 64; ++jj) { |
1717 expected.data[jj] = static_cast<GLbyte>(jj); | 1717 expected.data[jj] = static_cast<GLbyte>(jj); |
1718 } | 1718 } |
1719 expected.cmd.Init(GL_TEXTURE_2D, &expected.data[0]); | 1719 expected.cmd.Init(GL_TEXTURE_2D, &expected.data[0]); |
1720 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, &expected.data[0]); | 1720 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, &expected.data[0]); |
1721 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1721 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1722 } | 1722 } |
1723 | 1723 |
1724 TEST_F(GLES2ImplementationTest, ConsumeTextureCHROMIUM) { | 1724 TEST_F(GLES2ImplementationTest, ConsumeTextureCHROMIUM) { |
1725 struct Cmds { | 1725 struct Cmds { |
1726 ConsumeTextureCHROMIUMImmediate cmd; | 1726 cmds::ConsumeTextureCHROMIUMImmediate cmd; |
1727 GLbyte data[64]; | 1727 GLbyte data[64]; |
1728 }; | 1728 }; |
1729 | 1729 |
1730 Cmds expected; | 1730 Cmds expected; |
1731 for (int jj = 0; jj < 64; ++jj) { | 1731 for (int jj = 0; jj < 64; ++jj) { |
1732 expected.data[jj] = static_cast<GLbyte>(jj); | 1732 expected.data[jj] = static_cast<GLbyte>(jj); |
1733 } | 1733 } |
1734 expected.cmd.Init(GL_TEXTURE_2D, &expected.data[0]); | 1734 expected.cmd.Init(GL_TEXTURE_2D, &expected.data[0]); |
1735 gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, &expected.data[0]); | 1735 gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, &expected.data[0]); |
1736 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1736 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1737 } | 1737 } |
1738 // TODO: Implement unit test for BindUniformLocationCHROMIUM | 1738 // TODO: Implement unit test for BindUniformLocationCHROMIUM |
1739 | 1739 |
1740 TEST_F(GLES2ImplementationTest, BindTexImage2DCHROMIUM) { | 1740 TEST_F(GLES2ImplementationTest, BindTexImage2DCHROMIUM) { |
1741 struct Cmds { | 1741 struct Cmds { |
1742 BindTexImage2DCHROMIUM cmd; | 1742 cmds::BindTexImage2DCHROMIUM cmd; |
1743 }; | 1743 }; |
1744 Cmds expected; | 1744 Cmds expected; |
1745 expected.cmd.Init(GL_TEXTURE_2D, 2); | 1745 expected.cmd.Init(GL_TEXTURE_2D, 2); |
1746 | 1746 |
1747 gl_->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, 2); | 1747 gl_->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, 2); |
1748 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1748 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1749 } | 1749 } |
1750 | 1750 |
1751 TEST_F(GLES2ImplementationTest, ReleaseTexImage2DCHROMIUM) { | 1751 TEST_F(GLES2ImplementationTest, ReleaseTexImage2DCHROMIUM) { |
1752 struct Cmds { | 1752 struct Cmds { |
1753 ReleaseTexImage2DCHROMIUM cmd; | 1753 cmds::ReleaseTexImage2DCHROMIUM cmd; |
1754 }; | 1754 }; |
1755 Cmds expected; | 1755 Cmds expected; |
1756 expected.cmd.Init(GL_TEXTURE_2D, 2); | 1756 expected.cmd.Init(GL_TEXTURE_2D, 2); |
1757 | 1757 |
1758 gl_->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, 2); | 1758 gl_->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, 2); |
1759 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1759 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1760 } | 1760 } |
1761 | 1761 |
1762 TEST_F(GLES2ImplementationTest, DiscardFramebufferEXT) { | 1762 TEST_F(GLES2ImplementationTest, DiscardFramebufferEXT) { |
1763 struct Cmds { | 1763 struct Cmds { |
1764 DiscardFramebufferEXTImmediate cmd; | 1764 cmds::DiscardFramebufferEXTImmediate cmd; |
1765 GLenum data[2][1]; | 1765 GLenum data[2][1]; |
1766 }; | 1766 }; |
1767 | 1767 |
1768 Cmds expected; | 1768 Cmds expected; |
1769 for (int ii = 0; ii < 2; ++ii) { | 1769 for (int ii = 0; ii < 2; ++ii) { |
1770 for (int jj = 0; jj < 1; ++jj) { | 1770 for (int jj = 0; jj < 1; ++jj) { |
1771 expected.data[ii][jj] = static_cast<GLenum>(ii * 1 + jj); | 1771 expected.data[ii][jj] = static_cast<GLenum>(ii * 1 + jj); |
1772 } | 1772 } |
1773 } | 1773 } |
1774 expected.cmd.Init(1, 2, &expected.data[0][0]); | 1774 expected.cmd.Init(1, 2, &expected.data[0][0]); |
1775 gl_->DiscardFramebufferEXT(1, 2, &expected.data[0][0]); | 1775 gl_->DiscardFramebufferEXT(1, 2, &expected.data[0][0]); |
1776 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1776 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1777 } | 1777 } |
1778 | 1778 |
1779 TEST_F(GLES2ImplementationTest, LoseContextCHROMIUM) { | 1779 TEST_F(GLES2ImplementationTest, LoseContextCHROMIUM) { |
1780 struct Cmds { | 1780 struct Cmds { |
1781 LoseContextCHROMIUM cmd; | 1781 cmds::LoseContextCHROMIUM cmd; |
1782 }; | 1782 }; |
1783 Cmds expected; | 1783 Cmds expected; |
1784 expected.cmd.Init(1, 2); | 1784 expected.cmd.Init(1, 2); |
1785 | 1785 |
1786 gl_->LoseContextCHROMIUM(1, 2); | 1786 gl_->LoseContextCHROMIUM(1, 2); |
1787 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1787 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1788 } | 1788 } |
1789 | 1789 |
1790 TEST_F(GLES2ImplementationTest, WaitSyncPointCHROMIUM) { | 1790 TEST_F(GLES2ImplementationTest, WaitSyncPointCHROMIUM) { |
1791 struct Cmds { | 1791 struct Cmds { |
1792 WaitSyncPointCHROMIUM cmd; | 1792 cmds::WaitSyncPointCHROMIUM cmd; |
1793 }; | 1793 }; |
1794 Cmds expected; | 1794 Cmds expected; |
1795 expected.cmd.Init(1); | 1795 expected.cmd.Init(1); |
1796 | 1796 |
1797 gl_->WaitSyncPointCHROMIUM(1); | 1797 gl_->WaitSyncPointCHROMIUM(1); |
1798 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1798 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1799 } | 1799 } |
1800 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ | 1800 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ |
1801 | 1801 |
OLD | NEW |