Fix crash on app list start page keyboard navigation with <4 apps.
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_unittest_autogen.h
blob8149a968d647993f1f6298eb0d9c96cd6e3ad861
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
9 // DO NOT EDIT!
11 // This file is included by gles2_implementation.h to declare the
12 // GL api functions.
13 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_
14 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_
16 TEST_F(GLES2ImplementationTest, AttachShader) {
17 struct Cmds {
18 cmds::AttachShader cmd;
20 Cmds expected;
21 expected.cmd.Init(1, 2);
23 gl_->AttachShader(1, 2);
24 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
26 // TODO(zmo): Implement unit test for BindAttribLocation
28 TEST_F(GLES2ImplementationTest, BindBuffer) {
29 struct Cmds {
30 cmds::BindBuffer cmd;
32 Cmds expected;
33 expected.cmd.Init(GL_ARRAY_BUFFER, 2);
35 gl_->BindBuffer(GL_ARRAY_BUFFER, 2);
36 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
37 ClearCommands();
38 gl_->BindBuffer(GL_ARRAY_BUFFER, 2);
39 EXPECT_TRUE(NoCommandsWritten());
42 TEST_F(GLES2ImplementationTest, BindBufferBase) {
43 struct Cmds {
44 cmds::BindBufferBase cmd;
46 Cmds expected;
47 expected.cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, 3);
49 gl_->BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, 3);
50 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
53 TEST_F(GLES2ImplementationTest, BindBufferRange) {
54 struct Cmds {
55 cmds::BindBufferRange cmd;
57 Cmds expected;
58 expected.cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, 3, 4, 4);
60 gl_->BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 2, 3, 4, 4);
61 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
64 TEST_F(GLES2ImplementationTest, BindFramebuffer) {
65 struct Cmds {
66 cmds::BindFramebuffer cmd;
68 Cmds expected;
69 expected.cmd.Init(GL_FRAMEBUFFER, 2);
71 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2);
72 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
73 ClearCommands();
74 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2);
75 EXPECT_TRUE(NoCommandsWritten());
78 TEST_F(GLES2ImplementationTest, BindRenderbuffer) {
79 struct Cmds {
80 cmds::BindRenderbuffer cmd;
82 Cmds expected;
83 expected.cmd.Init(GL_RENDERBUFFER, 2);
85 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2);
86 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
87 ClearCommands();
88 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2);
89 EXPECT_TRUE(NoCommandsWritten());
92 TEST_F(GLES2ImplementationTest, BindSampler) {
93 struct Cmds {
94 cmds::BindSampler cmd;
96 Cmds expected;
97 expected.cmd.Init(1, 2);
99 gl_->BindSampler(1, 2);
100 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
103 TEST_F(GLES2ImplementationTest, BindTransformFeedback) {
104 struct Cmds {
105 cmds::BindTransformFeedback cmd;
107 Cmds expected;
108 expected.cmd.Init(GL_TRANSFORM_FEEDBACK, 2);
110 gl_->BindTransformFeedback(GL_TRANSFORM_FEEDBACK, 2);
111 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
114 TEST_F(GLES2ImplementationTest, BlendColor) {
115 struct Cmds {
116 cmds::BlendColor cmd;
118 Cmds expected;
119 expected.cmd.Init(1, 2, 3, 4);
121 gl_->BlendColor(1, 2, 3, 4);
122 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
125 TEST_F(GLES2ImplementationTest, BlendEquation) {
126 struct Cmds {
127 cmds::BlendEquation cmd;
129 Cmds expected;
130 expected.cmd.Init(GL_FUNC_SUBTRACT);
132 gl_->BlendEquation(GL_FUNC_SUBTRACT);
133 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
136 TEST_F(GLES2ImplementationTest, BlendEquationSeparate) {
137 struct Cmds {
138 cmds::BlendEquationSeparate cmd;
140 Cmds expected;
141 expected.cmd.Init(GL_FUNC_SUBTRACT, GL_FUNC_ADD);
143 gl_->BlendEquationSeparate(GL_FUNC_SUBTRACT, GL_FUNC_ADD);
144 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
147 TEST_F(GLES2ImplementationTest, BlendFunc) {
148 struct Cmds {
149 cmds::BlendFunc cmd;
151 Cmds expected;
152 expected.cmd.Init(GL_ZERO, GL_ZERO);
154 gl_->BlendFunc(GL_ZERO, GL_ZERO);
155 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
158 TEST_F(GLES2ImplementationTest, BlendFuncSeparate) {
159 struct Cmds {
160 cmds::BlendFuncSeparate cmd;
162 Cmds expected;
163 expected.cmd.Init(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO);
165 gl_->BlendFuncSeparate(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO);
166 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
169 TEST_F(GLES2ImplementationTest, CheckFramebufferStatus) {
170 struct Cmds {
171 cmds::CheckFramebufferStatus cmd;
174 Cmds expected;
175 ExpectedMemoryInfo result1 =
176 GetExpectedResultMemory(sizeof(cmds::CheckFramebufferStatus::Result));
177 expected.cmd.Init(GL_FRAMEBUFFER, result1.id, result1.offset);
179 EXPECT_CALL(*command_buffer(), OnFlush())
180 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
181 .RetiresOnSaturation();
183 GLboolean result = gl_->CheckFramebufferStatus(GL_FRAMEBUFFER);
184 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
185 EXPECT_TRUE(result);
188 TEST_F(GLES2ImplementationTest, Clear) {
189 struct Cmds {
190 cmds::Clear cmd;
192 Cmds expected;
193 expected.cmd.Init(1);
195 gl_->Clear(1);
196 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
199 TEST_F(GLES2ImplementationTest, ClearBufferfi) {
200 struct Cmds {
201 cmds::ClearBufferfi cmd;
203 Cmds expected;
204 expected.cmd.Init(GL_COLOR, 2, 3, 4);
206 gl_->ClearBufferfi(GL_COLOR, 2, 3, 4);
207 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
210 TEST_F(GLES2ImplementationTest, ClearBufferfv) {
211 GLfloat data[4] = {0};
212 struct Cmds {
213 cmds::ClearBufferfvImmediate cmd;
214 GLfloat data[4];
217 for (int jj = 0; jj < 4; ++jj) {
218 data[jj] = static_cast<GLfloat>(jj);
220 Cmds expected;
221 expected.cmd.Init(GL_COLOR, 2, &data[0]);
222 gl_->ClearBufferfv(GL_COLOR, 2, &data[0]);
223 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
226 TEST_F(GLES2ImplementationTest, ClearBufferiv) {
227 GLint data[4] = {0};
228 struct Cmds {
229 cmds::ClearBufferivImmediate cmd;
230 GLint data[4];
233 for (int jj = 0; jj < 4; ++jj) {
234 data[jj] = static_cast<GLint>(jj);
236 Cmds expected;
237 expected.cmd.Init(GL_COLOR, 2, &data[0]);
238 gl_->ClearBufferiv(GL_COLOR, 2, &data[0]);
239 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
242 TEST_F(GLES2ImplementationTest, ClearBufferuiv) {
243 GLuint data[4] = {0};
244 struct Cmds {
245 cmds::ClearBufferuivImmediate cmd;
246 GLuint data[4];
249 for (int jj = 0; jj < 4; ++jj) {
250 data[jj] = static_cast<GLuint>(jj);
252 Cmds expected;
253 expected.cmd.Init(GL_COLOR, 2, &data[0]);
254 gl_->ClearBufferuiv(GL_COLOR, 2, &data[0]);
255 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
258 TEST_F(GLES2ImplementationTest, ClearColor) {
259 struct Cmds {
260 cmds::ClearColor cmd;
262 Cmds expected;
263 expected.cmd.Init(1, 2, 3, 4);
265 gl_->ClearColor(1, 2, 3, 4);
266 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
269 TEST_F(GLES2ImplementationTest, ClearDepthf) {
270 struct Cmds {
271 cmds::ClearDepthf cmd;
273 Cmds expected;
274 expected.cmd.Init(0.5f);
276 gl_->ClearDepthf(0.5f);
277 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
280 TEST_F(GLES2ImplementationTest, ClearStencil) {
281 struct Cmds {
282 cmds::ClearStencil cmd;
284 Cmds expected;
285 expected.cmd.Init(1);
287 gl_->ClearStencil(1);
288 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
290 // TODO(zmo): Implement unit test for ClientWaitSync
292 TEST_F(GLES2ImplementationTest, ColorMask) {
293 struct Cmds {
294 cmds::ColorMask cmd;
296 Cmds expected;
297 expected.cmd.Init(true, true, true, true);
299 gl_->ColorMask(true, true, true, true);
300 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
303 TEST_F(GLES2ImplementationTest, CompileShader) {
304 struct Cmds {
305 cmds::CompileShader cmd;
307 Cmds expected;
308 expected.cmd.Init(1);
310 gl_->CompileShader(1);
311 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
313 // TODO(zmo): Implement unit test for CompressedTexImage2D
314 // TODO(zmo): Implement unit test for CompressedTexSubImage2D
316 TEST_F(GLES2ImplementationTest, CopyBufferSubData) {
317 struct Cmds {
318 cmds::CopyBufferSubData cmd;
320 Cmds expected;
321 expected.cmd.Init(GL_ARRAY_BUFFER, GL_ARRAY_BUFFER, 3, 4, 5);
323 gl_->CopyBufferSubData(GL_ARRAY_BUFFER, GL_ARRAY_BUFFER, 3, 4, 5);
324 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
327 TEST_F(GLES2ImplementationTest, CopyTexImage2D) {
328 struct Cmds {
329 cmds::CopyTexImage2D cmd;
331 Cmds expected;
332 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7);
334 gl_->CopyTexImage2D(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 0);
335 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
338 TEST_F(GLES2ImplementationTest, CopyTexImage2DInvalidConstantArg7) {
339 gl_->CopyTexImage2D(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 1);
340 EXPECT_TRUE(NoCommandsWritten());
341 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
344 TEST_F(GLES2ImplementationTest, CopyTexSubImage2D) {
345 struct Cmds {
346 cmds::CopyTexSubImage2D cmd;
348 Cmds expected;
349 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8);
351 gl_->CopyTexSubImage2D(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8);
352 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
355 TEST_F(GLES2ImplementationTest, CopyTexSubImage3D) {
356 struct Cmds {
357 cmds::CopyTexSubImage3D cmd;
359 Cmds expected;
360 expected.cmd.Init(GL_TEXTURE_3D, 2, 3, 4, 5, 6, 7, 8, 9);
362 gl_->CopyTexSubImage3D(GL_TEXTURE_3D, 2, 3, 4, 5, 6, 7, 8, 9);
363 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
366 TEST_F(GLES2ImplementationTest, CullFace) {
367 struct Cmds {
368 cmds::CullFace cmd;
370 Cmds expected;
371 expected.cmd.Init(GL_FRONT);
373 gl_->CullFace(GL_FRONT);
374 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
377 TEST_F(GLES2ImplementationTest, DeleteBuffers) {
378 GLuint ids[2] = {kBuffersStartId, kBuffersStartId + 1};
379 struct Cmds {
380 cmds::DeleteBuffersImmediate del;
381 GLuint data[2];
383 Cmds expected;
384 expected.del.Init(arraysize(ids), &ids[0]);
385 expected.data[0] = kBuffersStartId;
386 expected.data[1] = kBuffersStartId + 1;
387 gl_->DeleteBuffers(arraysize(ids), &ids[0]);
388 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
391 TEST_F(GLES2ImplementationTest, DeleteFramebuffers) {
392 GLuint ids[2] = {kFramebuffersStartId, kFramebuffersStartId + 1};
393 struct Cmds {
394 cmds::DeleteFramebuffersImmediate del;
395 GLuint data[2];
397 Cmds expected;
398 expected.del.Init(arraysize(ids), &ids[0]);
399 expected.data[0] = kFramebuffersStartId;
400 expected.data[1] = kFramebuffersStartId + 1;
401 gl_->DeleteFramebuffers(arraysize(ids), &ids[0]);
402 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
405 TEST_F(GLES2ImplementationTest, DeleteProgram) {
406 struct Cmds {
407 cmds::DeleteProgram cmd;
409 Cmds expected;
410 expected.cmd.Init(1);
412 gl_->DeleteProgram(1);
413 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
416 TEST_F(GLES2ImplementationTest, DeleteRenderbuffers) {
417 GLuint ids[2] = {kRenderbuffersStartId, kRenderbuffersStartId + 1};
418 struct Cmds {
419 cmds::DeleteRenderbuffersImmediate del;
420 GLuint data[2];
422 Cmds expected;
423 expected.del.Init(arraysize(ids), &ids[0]);
424 expected.data[0] = kRenderbuffersStartId;
425 expected.data[1] = kRenderbuffersStartId + 1;
426 gl_->DeleteRenderbuffers(arraysize(ids), &ids[0]);
427 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
430 TEST_F(GLES2ImplementationTest, DeleteSamplers) {
431 GLuint ids[2] = {kSamplersStartId, kSamplersStartId + 1};
432 struct Cmds {
433 cmds::DeleteSamplersImmediate del;
434 GLuint data[2];
436 Cmds expected;
437 expected.del.Init(arraysize(ids), &ids[0]);
438 expected.data[0] = kSamplersStartId;
439 expected.data[1] = kSamplersStartId + 1;
440 gl_->DeleteSamplers(arraysize(ids), &ids[0]);
441 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
444 TEST_F(GLES2ImplementationTest, DeleteSync) {
445 struct Cmds {
446 cmds::DeleteSync cmd;
448 Cmds expected;
449 expected.cmd.Init(1);
451 gl_->DeleteSync(reinterpret_cast<GLsync>(1));
452 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
455 TEST_F(GLES2ImplementationTest, DeleteShader) {
456 struct Cmds {
457 cmds::DeleteShader cmd;
459 Cmds expected;
460 expected.cmd.Init(1);
462 gl_->DeleteShader(1);
463 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
466 TEST_F(GLES2ImplementationTest, DeleteTextures) {
467 GLuint ids[2] = {kTexturesStartId, kTexturesStartId + 1};
468 struct Cmds {
469 cmds::DeleteTexturesImmediate del;
470 GLuint data[2];
472 Cmds expected;
473 expected.del.Init(arraysize(ids), &ids[0]);
474 expected.data[0] = kTexturesStartId;
475 expected.data[1] = kTexturesStartId + 1;
476 gl_->DeleteTextures(arraysize(ids), &ids[0]);
477 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
480 TEST_F(GLES2ImplementationTest, DeleteTransformFeedbacks) {
481 GLuint ids[2] = {kTransformFeedbacksStartId, kTransformFeedbacksStartId + 1};
482 struct Cmds {
483 cmds::DeleteTransformFeedbacksImmediate del;
484 GLuint data[2];
486 Cmds expected;
487 expected.del.Init(arraysize(ids), &ids[0]);
488 expected.data[0] = kTransformFeedbacksStartId;
489 expected.data[1] = kTransformFeedbacksStartId + 1;
490 gl_->DeleteTransformFeedbacks(arraysize(ids), &ids[0]);
491 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
494 TEST_F(GLES2ImplementationTest, DepthFunc) {
495 struct Cmds {
496 cmds::DepthFunc cmd;
498 Cmds expected;
499 expected.cmd.Init(GL_NEVER);
501 gl_->DepthFunc(GL_NEVER);
502 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
505 TEST_F(GLES2ImplementationTest, DepthMask) {
506 struct Cmds {
507 cmds::DepthMask cmd;
509 Cmds expected;
510 expected.cmd.Init(true);
512 gl_->DepthMask(true);
513 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
516 TEST_F(GLES2ImplementationTest, DepthRangef) {
517 struct Cmds {
518 cmds::DepthRangef cmd;
520 Cmds expected;
521 expected.cmd.Init(1, 2);
523 gl_->DepthRangef(1, 2);
524 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
527 TEST_F(GLES2ImplementationTest, DetachShader) {
528 struct Cmds {
529 cmds::DetachShader cmd;
531 Cmds expected;
532 expected.cmd.Init(1, 2);
534 gl_->DetachShader(1, 2);
535 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
538 TEST_F(GLES2ImplementationTest, DisableVertexAttribArray) {
539 struct Cmds {
540 cmds::DisableVertexAttribArray cmd;
542 Cmds expected;
543 expected.cmd.Init(1);
545 gl_->DisableVertexAttribArray(1);
546 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
549 TEST_F(GLES2ImplementationTest, DrawArrays) {
550 struct Cmds {
551 cmds::DrawArrays cmd;
553 Cmds expected;
554 expected.cmd.Init(GL_POINTS, 2, 3);
556 gl_->DrawArrays(GL_POINTS, 2, 3);
557 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
560 TEST_F(GLES2ImplementationTest, EnableVertexAttribArray) {
561 struct Cmds {
562 cmds::EnableVertexAttribArray cmd;
564 Cmds expected;
565 expected.cmd.Init(1);
567 gl_->EnableVertexAttribArray(1);
568 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
571 TEST_F(GLES2ImplementationTest, Flush) {
572 struct Cmds {
573 cmds::Flush cmd;
575 Cmds expected;
576 expected.cmd.Init();
578 gl_->Flush();
579 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
582 TEST_F(GLES2ImplementationTest, FramebufferRenderbuffer) {
583 struct Cmds {
584 cmds::FramebufferRenderbuffer cmd;
586 Cmds expected;
587 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4);
589 gl_->FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
590 GL_RENDERBUFFER, 4);
591 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
594 TEST_F(GLES2ImplementationTest, FramebufferTexture2D) {
595 struct Cmds {
596 cmds::FramebufferTexture2D cmd;
598 Cmds expected;
599 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4);
601 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
602 4, 0);
603 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
606 TEST_F(GLES2ImplementationTest, FramebufferTexture2DInvalidConstantArg4) {
607 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
608 4, 1);
609 EXPECT_TRUE(NoCommandsWritten());
610 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
613 TEST_F(GLES2ImplementationTest, FramebufferTextureLayer) {
614 struct Cmds {
615 cmds::FramebufferTextureLayer cmd;
617 Cmds expected;
618 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 3, 4, 5);
620 gl_->FramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 3, 4, 5);
621 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
624 TEST_F(GLES2ImplementationTest, FrontFace) {
625 struct Cmds {
626 cmds::FrontFace cmd;
628 Cmds expected;
629 expected.cmd.Init(GL_CW);
631 gl_->FrontFace(GL_CW);
632 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
635 TEST_F(GLES2ImplementationTest, GenBuffers) {
636 GLuint ids[2] = {
639 struct Cmds {
640 cmds::GenBuffersImmediate gen;
641 GLuint data[2];
643 Cmds expected;
644 expected.gen.Init(arraysize(ids), &ids[0]);
645 expected.data[0] = kBuffersStartId;
646 expected.data[1] = kBuffersStartId + 1;
647 gl_->GenBuffers(arraysize(ids), &ids[0]);
648 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
649 EXPECT_EQ(kBuffersStartId, ids[0]);
650 EXPECT_EQ(kBuffersStartId + 1, ids[1]);
653 TEST_F(GLES2ImplementationTest, GenerateMipmap) {
654 struct Cmds {
655 cmds::GenerateMipmap cmd;
657 Cmds expected;
658 expected.cmd.Init(GL_TEXTURE_2D);
660 gl_->GenerateMipmap(GL_TEXTURE_2D);
661 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
664 TEST_F(GLES2ImplementationTest, GenFramebuffers) {
665 GLuint ids[2] = {
668 struct Cmds {
669 cmds::GenFramebuffersImmediate gen;
670 GLuint data[2];
672 Cmds expected;
673 expected.gen.Init(arraysize(ids), &ids[0]);
674 expected.data[0] = kFramebuffersStartId;
675 expected.data[1] = kFramebuffersStartId + 1;
676 gl_->GenFramebuffers(arraysize(ids), &ids[0]);
677 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
678 EXPECT_EQ(kFramebuffersStartId, ids[0]);
679 EXPECT_EQ(kFramebuffersStartId + 1, ids[1]);
682 TEST_F(GLES2ImplementationTest, GenRenderbuffers) {
683 GLuint ids[2] = {
686 struct Cmds {
687 cmds::GenRenderbuffersImmediate gen;
688 GLuint data[2];
690 Cmds expected;
691 expected.gen.Init(arraysize(ids), &ids[0]);
692 expected.data[0] = kRenderbuffersStartId;
693 expected.data[1] = kRenderbuffersStartId + 1;
694 gl_->GenRenderbuffers(arraysize(ids), &ids[0]);
695 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
696 EXPECT_EQ(kRenderbuffersStartId, ids[0]);
697 EXPECT_EQ(kRenderbuffersStartId + 1, ids[1]);
700 TEST_F(GLES2ImplementationTest, GenSamplers) {
701 GLuint ids[2] = {
704 struct Cmds {
705 cmds::GenSamplersImmediate gen;
706 GLuint data[2];
708 Cmds expected;
709 expected.gen.Init(arraysize(ids), &ids[0]);
710 expected.data[0] = kSamplersStartId;
711 expected.data[1] = kSamplersStartId + 1;
712 gl_->GenSamplers(arraysize(ids), &ids[0]);
713 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
714 EXPECT_EQ(kSamplersStartId, ids[0]);
715 EXPECT_EQ(kSamplersStartId + 1, ids[1]);
718 TEST_F(GLES2ImplementationTest, GenTextures) {
719 GLuint ids[2] = {
722 struct Cmds {
723 cmds::GenTexturesImmediate gen;
724 GLuint data[2];
726 Cmds expected;
727 expected.gen.Init(arraysize(ids), &ids[0]);
728 expected.data[0] = kTexturesStartId;
729 expected.data[1] = kTexturesStartId + 1;
730 gl_->GenTextures(arraysize(ids), &ids[0]);
731 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
732 EXPECT_EQ(kTexturesStartId, ids[0]);
733 EXPECT_EQ(kTexturesStartId + 1, ids[1]);
736 TEST_F(GLES2ImplementationTest, GenTransformFeedbacks) {
737 GLuint ids[2] = {
740 struct Cmds {
741 cmds::GenTransformFeedbacksImmediate gen;
742 GLuint data[2];
744 Cmds expected;
745 expected.gen.Init(arraysize(ids), &ids[0]);
746 expected.data[0] = kTransformFeedbacksStartId;
747 expected.data[1] = kTransformFeedbacksStartId + 1;
748 gl_->GenTransformFeedbacks(arraysize(ids), &ids[0]);
749 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
750 EXPECT_EQ(kTransformFeedbacksStartId, ids[0]);
751 EXPECT_EQ(kTransformFeedbacksStartId + 1, ids[1]);
753 // TODO(zmo): Implement unit test for GetActiveAttrib
754 // TODO(zmo): Implement unit test for GetActiveUniform
755 // TODO(zmo): Implement unit test for GetActiveUniformBlockiv
756 // TODO(zmo): Implement unit test for GetActiveUniformBlockName
757 // TODO(zmo): Implement unit test for GetActiveUniformsiv
758 // TODO(zmo): Implement unit test for GetAttachedShaders
759 // TODO(zmo): Implement unit test for GetAttribLocation
761 TEST_F(GLES2ImplementationTest, GetBooleanv) {
762 struct Cmds {
763 cmds::GetBooleanv cmd;
765 typedef cmds::GetBooleanv::Result Result;
766 Result::Type result = 0;
767 Cmds expected;
768 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
769 expected.cmd.Init(123, result1.id, result1.offset);
770 EXPECT_CALL(*command_buffer(), OnFlush())
771 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
772 .RetiresOnSaturation();
773 gl_->GetBooleanv(123, &result);
774 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
775 EXPECT_EQ(static_cast<Result::Type>(1), result);
778 TEST_F(GLES2ImplementationTest, GetBufferParameteriv) {
779 struct Cmds {
780 cmds::GetBufferParameteriv cmd;
782 typedef cmds::GetBufferParameteriv::Result Result;
783 Result::Type result = 0;
784 Cmds expected;
785 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
786 expected.cmd.Init(123, GL_BUFFER_SIZE, result1.id, result1.offset);
787 EXPECT_CALL(*command_buffer(), OnFlush())
788 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
789 .RetiresOnSaturation();
790 gl_->GetBufferParameteriv(123, GL_BUFFER_SIZE, &result);
791 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
792 EXPECT_EQ(static_cast<Result::Type>(1), result);
795 TEST_F(GLES2ImplementationTest, GetFloatv) {
796 struct Cmds {
797 cmds::GetFloatv cmd;
799 typedef cmds::GetFloatv::Result Result;
800 Result::Type result = 0;
801 Cmds expected;
802 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
803 expected.cmd.Init(123, result1.id, result1.offset);
804 EXPECT_CALL(*command_buffer(), OnFlush())
805 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
806 .RetiresOnSaturation();
807 gl_->GetFloatv(123, &result);
808 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
809 EXPECT_EQ(static_cast<Result::Type>(1), result);
811 // TODO(zmo): Implement unit test for GetFragDataLocation
813 TEST_F(GLES2ImplementationTest, GetFramebufferAttachmentParameteriv) {
814 struct Cmds {
815 cmds::GetFramebufferAttachmentParameteriv cmd;
817 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
818 Result::Type result = 0;
819 Cmds expected;
820 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
821 expected.cmd.Init(123, GL_COLOR_ATTACHMENT0,
822 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, result1.id,
823 result1.offset);
824 EXPECT_CALL(*command_buffer(), OnFlush())
825 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
826 .RetiresOnSaturation();
827 gl_->GetFramebufferAttachmentParameteriv(
828 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
829 &result);
830 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
831 EXPECT_EQ(static_cast<Result::Type>(1), result);
834 TEST_F(GLES2ImplementationTest, GetIntegerv) {
835 struct Cmds {
836 cmds::GetIntegerv cmd;
838 typedef cmds::GetIntegerv::Result Result;
839 Result::Type result = 0;
840 Cmds expected;
841 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
842 expected.cmd.Init(123, result1.id, result1.offset);
843 EXPECT_CALL(*command_buffer(), OnFlush())
844 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
845 .RetiresOnSaturation();
846 gl_->GetIntegerv(123, &result);
847 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
848 EXPECT_EQ(static_cast<Result::Type>(1), result);
851 TEST_F(GLES2ImplementationTest, GetInternalformativ) {
852 struct Cmds {
853 cmds::GetInternalformativ cmd;
855 typedef cmds::GetInternalformativ::Result Result;
856 Result::Type result = 0;
857 Cmds expected;
858 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
859 expected.cmd.Init(123, GL_RGBA4, GL_RENDERBUFFER_RED_SIZE, 4, result1.id,
860 result1.offset);
861 EXPECT_CALL(*command_buffer(), OnFlush())
862 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
863 .RetiresOnSaturation();
864 gl_->GetInternalformativ(123, GL_RGBA4, GL_RENDERBUFFER_RED_SIZE, 4, &result);
865 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
866 EXPECT_EQ(static_cast<Result::Type>(1), result);
869 TEST_F(GLES2ImplementationTest, GetProgramiv) {
870 struct Cmds {
871 cmds::GetProgramiv cmd;
873 typedef cmds::GetProgramiv::Result Result;
874 Result::Type result = 0;
875 Cmds expected;
876 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
877 expected.cmd.Init(123, GL_DELETE_STATUS, result1.id, result1.offset);
878 EXPECT_CALL(*command_buffer(), OnFlush())
879 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
880 .RetiresOnSaturation();
881 gl_->GetProgramiv(123, GL_DELETE_STATUS, &result);
882 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
883 EXPECT_EQ(static_cast<Result::Type>(1), result);
885 // TODO(zmo): Implement unit test for GetProgramInfoLog
887 TEST_F(GLES2ImplementationTest, GetRenderbufferParameteriv) {
888 struct Cmds {
889 cmds::GetRenderbufferParameteriv cmd;
891 typedef cmds::GetRenderbufferParameteriv::Result Result;
892 Result::Type result = 0;
893 Cmds expected;
894 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
895 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset);
896 EXPECT_CALL(*command_buffer(), OnFlush())
897 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
898 .RetiresOnSaturation();
899 gl_->GetRenderbufferParameteriv(123, GL_RENDERBUFFER_RED_SIZE, &result);
900 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
901 EXPECT_EQ(static_cast<Result::Type>(1), result);
904 TEST_F(GLES2ImplementationTest, GetSamplerParameterfv) {
905 struct Cmds {
906 cmds::GetSamplerParameterfv cmd;
908 typedef cmds::GetSamplerParameterfv::Result Result;
909 Result::Type result = 0;
910 Cmds expected;
911 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
912 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset);
913 EXPECT_CALL(*command_buffer(), OnFlush())
914 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
915 .RetiresOnSaturation();
916 gl_->GetSamplerParameterfv(123, GL_TEXTURE_MAG_FILTER, &result);
917 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
918 EXPECT_EQ(static_cast<Result::Type>(1), result);
921 TEST_F(GLES2ImplementationTest, GetSamplerParameteriv) {
922 struct Cmds {
923 cmds::GetSamplerParameteriv cmd;
925 typedef cmds::GetSamplerParameteriv::Result Result;
926 Result::Type result = 0;
927 Cmds expected;
928 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
929 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset);
930 EXPECT_CALL(*command_buffer(), OnFlush())
931 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
932 .RetiresOnSaturation();
933 gl_->GetSamplerParameteriv(123, GL_TEXTURE_MAG_FILTER, &result);
934 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
935 EXPECT_EQ(static_cast<Result::Type>(1), result);
938 TEST_F(GLES2ImplementationTest, GetShaderiv) {
939 struct Cmds {
940 cmds::GetShaderiv cmd;
942 typedef cmds::GetShaderiv::Result Result;
943 Result::Type result = 0;
944 Cmds expected;
945 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
946 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset);
947 EXPECT_CALL(*command_buffer(), OnFlush())
948 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
949 .RetiresOnSaturation();
950 gl_->GetShaderiv(123, GL_SHADER_TYPE, &result);
951 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
952 EXPECT_EQ(static_cast<Result::Type>(1), result);
954 // TODO(zmo): Implement unit test for GetShaderInfoLog
955 // TODO(zmo): Implement unit test for GetShaderPrecisionFormat
957 TEST_F(GLES2ImplementationTest, GetTexParameterfv) {
958 struct Cmds {
959 cmds::GetTexParameterfv cmd;
961 typedef cmds::GetTexParameterfv::Result Result;
962 Result::Type result = 0;
963 Cmds expected;
964 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
965 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset);
966 EXPECT_CALL(*command_buffer(), OnFlush())
967 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
968 .RetiresOnSaturation();
969 gl_->GetTexParameterfv(123, GL_TEXTURE_MAG_FILTER, &result);
970 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
971 EXPECT_EQ(static_cast<Result::Type>(1), result);
974 TEST_F(GLES2ImplementationTest, GetTexParameteriv) {
975 struct Cmds {
976 cmds::GetTexParameteriv cmd;
978 typedef cmds::GetTexParameteriv::Result Result;
979 Result::Type result = 0;
980 Cmds expected;
981 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
982 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset);
983 EXPECT_CALL(*command_buffer(), OnFlush())
984 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
985 .RetiresOnSaturation();
986 gl_->GetTexParameteriv(123, GL_TEXTURE_MAG_FILTER, &result);
987 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
988 EXPECT_EQ(static_cast<Result::Type>(1), result);
990 // TODO(zmo): Implement unit test for GetTransformFeedbackVarying
991 // TODO(zmo): Implement unit test for GetUniformBlockIndex
992 // TODO(zmo): Implement unit test for GetUniformfv
993 // TODO(zmo): Implement unit test for GetUniformiv
994 // TODO(zmo): Implement unit test for GetUniformIndices
995 // TODO(zmo): Implement unit test for GetUniformLocation
997 TEST_F(GLES2ImplementationTest, GetVertexAttribfv) {
998 struct Cmds {
999 cmds::GetVertexAttribfv cmd;
1001 typedef cmds::GetVertexAttribfv::Result Result;
1002 Result::Type result = 0;
1003 Cmds expected;
1004 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
1005 expected.cmd.Init(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id,
1006 result1.offset);
1007 EXPECT_CALL(*command_buffer(), OnFlush())
1008 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
1009 .RetiresOnSaturation();
1010 gl_->GetVertexAttribfv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result);
1011 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1012 EXPECT_EQ(static_cast<Result::Type>(1), result);
1015 TEST_F(GLES2ImplementationTest, GetVertexAttribiv) {
1016 struct Cmds {
1017 cmds::GetVertexAttribiv cmd;
1019 typedef cmds::GetVertexAttribiv::Result Result;
1020 Result::Type result = 0;
1021 Cmds expected;
1022 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
1023 expected.cmd.Init(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id,
1024 result1.offset);
1025 EXPECT_CALL(*command_buffer(), OnFlush())
1026 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
1027 .RetiresOnSaturation();
1028 gl_->GetVertexAttribiv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result);
1029 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1030 EXPECT_EQ(static_cast<Result::Type>(1), result);
1033 TEST_F(GLES2ImplementationTest, Hint) {
1034 struct Cmds {
1035 cmds::Hint cmd;
1037 Cmds expected;
1038 expected.cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
1040 gl_->Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
1041 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1044 TEST_F(GLES2ImplementationTest, InvalidateFramebuffer) {
1045 GLenum data[2][1] = {{0}};
1046 struct Cmds {
1047 cmds::InvalidateFramebufferImmediate cmd;
1048 GLenum data[2][1];
1051 Cmds expected;
1052 for (int ii = 0; ii < 2; ++ii) {
1053 for (int jj = 0; jj < 1; ++jj) {
1054 data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
1057 expected.cmd.Init(GL_FRAMEBUFFER, 2, &data[0][0]);
1058 gl_->InvalidateFramebuffer(GL_FRAMEBUFFER, 2, &data[0][0]);
1059 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1062 TEST_F(GLES2ImplementationTest, InvalidateSubFramebuffer) {
1063 GLenum data[2][1] = {{0}};
1064 struct Cmds {
1065 cmds::InvalidateSubFramebufferImmediate cmd;
1066 GLenum data[2][1];
1069 Cmds expected;
1070 for (int ii = 0; ii < 2; ++ii) {
1071 for (int jj = 0; jj < 1; ++jj) {
1072 data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
1075 expected.cmd.Init(GL_FRAMEBUFFER, 2, &data[0][0], 4, 5, 6, 7);
1076 gl_->InvalidateSubFramebuffer(GL_FRAMEBUFFER, 2, &data[0][0], 4, 5, 6, 7);
1077 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1080 TEST_F(GLES2ImplementationTest, IsBuffer) {
1081 struct Cmds {
1082 cmds::IsBuffer cmd;
1085 Cmds expected;
1086 ExpectedMemoryInfo result1 =
1087 GetExpectedResultMemory(sizeof(cmds::IsBuffer::Result));
1088 expected.cmd.Init(1, result1.id, result1.offset);
1090 EXPECT_CALL(*command_buffer(), OnFlush())
1091 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1092 .RetiresOnSaturation();
1094 GLboolean result = gl_->IsBuffer(1);
1095 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1096 EXPECT_TRUE(result);
1099 TEST_F(GLES2ImplementationTest, IsFramebuffer) {
1100 struct Cmds {
1101 cmds::IsFramebuffer cmd;
1104 Cmds expected;
1105 ExpectedMemoryInfo result1 =
1106 GetExpectedResultMemory(sizeof(cmds::IsFramebuffer::Result));
1107 expected.cmd.Init(1, result1.id, result1.offset);
1109 EXPECT_CALL(*command_buffer(), OnFlush())
1110 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1111 .RetiresOnSaturation();
1113 GLboolean result = gl_->IsFramebuffer(1);
1114 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1115 EXPECT_TRUE(result);
1118 TEST_F(GLES2ImplementationTest, IsProgram) {
1119 struct Cmds {
1120 cmds::IsProgram cmd;
1123 Cmds expected;
1124 ExpectedMemoryInfo result1 =
1125 GetExpectedResultMemory(sizeof(cmds::IsProgram::Result));
1126 expected.cmd.Init(1, result1.id, result1.offset);
1128 EXPECT_CALL(*command_buffer(), OnFlush())
1129 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1130 .RetiresOnSaturation();
1132 GLboolean result = gl_->IsProgram(1);
1133 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1134 EXPECT_TRUE(result);
1137 TEST_F(GLES2ImplementationTest, IsRenderbuffer) {
1138 struct Cmds {
1139 cmds::IsRenderbuffer cmd;
1142 Cmds expected;
1143 ExpectedMemoryInfo result1 =
1144 GetExpectedResultMemory(sizeof(cmds::IsRenderbuffer::Result));
1145 expected.cmd.Init(1, result1.id, result1.offset);
1147 EXPECT_CALL(*command_buffer(), OnFlush())
1148 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1149 .RetiresOnSaturation();
1151 GLboolean result = gl_->IsRenderbuffer(1);
1152 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1153 EXPECT_TRUE(result);
1156 TEST_F(GLES2ImplementationTest, IsSampler) {
1157 struct Cmds {
1158 cmds::IsSampler cmd;
1161 Cmds expected;
1162 ExpectedMemoryInfo result1 =
1163 GetExpectedResultMemory(sizeof(cmds::IsSampler::Result));
1164 expected.cmd.Init(1, result1.id, result1.offset);
1166 EXPECT_CALL(*command_buffer(), OnFlush())
1167 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1168 .RetiresOnSaturation();
1170 GLboolean result = gl_->IsSampler(1);
1171 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1172 EXPECT_TRUE(result);
1175 TEST_F(GLES2ImplementationTest, IsShader) {
1176 struct Cmds {
1177 cmds::IsShader cmd;
1180 Cmds expected;
1181 ExpectedMemoryInfo result1 =
1182 GetExpectedResultMemory(sizeof(cmds::IsShader::Result));
1183 expected.cmd.Init(1, result1.id, result1.offset);
1185 EXPECT_CALL(*command_buffer(), OnFlush())
1186 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1187 .RetiresOnSaturation();
1189 GLboolean result = gl_->IsShader(1);
1190 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1191 EXPECT_TRUE(result);
1194 TEST_F(GLES2ImplementationTest, IsSync) {
1195 struct Cmds {
1196 cmds::IsSync cmd;
1199 Cmds expected;
1200 ExpectedMemoryInfo result1 =
1201 GetExpectedResultMemory(sizeof(cmds::IsSync::Result));
1202 expected.cmd.Init(1, result1.id, result1.offset);
1204 EXPECT_CALL(*command_buffer(), OnFlush())
1205 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1206 .RetiresOnSaturation();
1208 GLboolean result = gl_->IsSync(reinterpret_cast<GLsync>(1));
1209 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1210 EXPECT_TRUE(result);
1213 TEST_F(GLES2ImplementationTest, IsTexture) {
1214 struct Cmds {
1215 cmds::IsTexture cmd;
1218 Cmds expected;
1219 ExpectedMemoryInfo result1 =
1220 GetExpectedResultMemory(sizeof(cmds::IsTexture::Result));
1221 expected.cmd.Init(1, result1.id, result1.offset);
1223 EXPECT_CALL(*command_buffer(), OnFlush())
1224 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1225 .RetiresOnSaturation();
1227 GLboolean result = gl_->IsTexture(1);
1228 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1229 EXPECT_TRUE(result);
1232 TEST_F(GLES2ImplementationTest, IsTransformFeedback) {
1233 struct Cmds {
1234 cmds::IsTransformFeedback cmd;
1237 Cmds expected;
1238 ExpectedMemoryInfo result1 =
1239 GetExpectedResultMemory(sizeof(cmds::IsTransformFeedback::Result));
1240 expected.cmd.Init(1, result1.id, result1.offset);
1242 EXPECT_CALL(*command_buffer(), OnFlush())
1243 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
1244 .RetiresOnSaturation();
1246 GLboolean result = gl_->IsTransformFeedback(1);
1247 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1248 EXPECT_TRUE(result);
1251 TEST_F(GLES2ImplementationTest, LineWidth) {
1252 struct Cmds {
1253 cmds::LineWidth cmd;
1255 Cmds expected;
1256 expected.cmd.Init(0.5f);
1258 gl_->LineWidth(0.5f);
1259 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1262 TEST_F(GLES2ImplementationTest, LinkProgram) {
1263 struct Cmds {
1264 cmds::LinkProgram cmd;
1266 Cmds expected;
1267 expected.cmd.Init(1);
1269 gl_->LinkProgram(1);
1270 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1273 TEST_F(GLES2ImplementationTest, PauseTransformFeedback) {
1274 struct Cmds {
1275 cmds::PauseTransformFeedback cmd;
1277 Cmds expected;
1278 expected.cmd.Init();
1280 gl_->PauseTransformFeedback();
1281 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1284 TEST_F(GLES2ImplementationTest, PixelStorei) {
1285 struct Cmds {
1286 cmds::PixelStorei cmd;
1288 Cmds expected;
1289 expected.cmd.Init(GL_PACK_ALIGNMENT, 1);
1291 gl_->PixelStorei(GL_PACK_ALIGNMENT, 1);
1292 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1295 TEST_F(GLES2ImplementationTest, PolygonOffset) {
1296 struct Cmds {
1297 cmds::PolygonOffset cmd;
1299 Cmds expected;
1300 expected.cmd.Init(1, 2);
1302 gl_->PolygonOffset(1, 2);
1303 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1306 TEST_F(GLES2ImplementationTest, ReadBuffer) {
1307 struct Cmds {
1308 cmds::ReadBuffer cmd;
1310 Cmds expected;
1311 expected.cmd.Init(1);
1313 gl_->ReadBuffer(1);
1314 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1317 TEST_F(GLES2ImplementationTest, ReleaseShaderCompiler) {
1318 struct Cmds {
1319 cmds::ReleaseShaderCompiler cmd;
1321 Cmds expected;
1322 expected.cmd.Init();
1324 gl_->ReleaseShaderCompiler();
1325 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1328 TEST_F(GLES2ImplementationTest, RenderbufferStorage) {
1329 struct Cmds {
1330 cmds::RenderbufferStorage cmd;
1332 Cmds expected;
1333 expected.cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
1335 gl_->RenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
1336 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1339 TEST_F(GLES2ImplementationTest, ResumeTransformFeedback) {
1340 struct Cmds {
1341 cmds::ResumeTransformFeedback cmd;
1343 Cmds expected;
1344 expected.cmd.Init();
1346 gl_->ResumeTransformFeedback();
1347 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1350 TEST_F(GLES2ImplementationTest, SampleCoverage) {
1351 struct Cmds {
1352 cmds::SampleCoverage cmd;
1354 Cmds expected;
1355 expected.cmd.Init(1, true);
1357 gl_->SampleCoverage(1, true);
1358 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1361 TEST_F(GLES2ImplementationTest, SamplerParameterf) {
1362 struct Cmds {
1363 cmds::SamplerParameterf cmd;
1365 Cmds expected;
1366 expected.cmd.Init(1, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1368 gl_->SamplerParameterf(1, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1369 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1372 TEST_F(GLES2ImplementationTest, SamplerParameterfv) {
1373 GLfloat data[1] = {0};
1374 struct Cmds {
1375 cmds::SamplerParameterfvImmediate cmd;
1376 GLfloat data[1];
1379 for (int jj = 0; jj < 1; ++jj) {
1380 data[jj] = static_cast<GLfloat>(jj);
1382 Cmds expected;
1383 expected.cmd.Init(1, GL_TEXTURE_MAG_FILTER, &data[0]);
1384 gl_->SamplerParameterfv(1, GL_TEXTURE_MAG_FILTER, &data[0]);
1385 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1388 TEST_F(GLES2ImplementationTest, SamplerParameteri) {
1389 struct Cmds {
1390 cmds::SamplerParameteri cmd;
1392 Cmds expected;
1393 expected.cmd.Init(1, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1395 gl_->SamplerParameteri(1, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1396 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1399 TEST_F(GLES2ImplementationTest, SamplerParameteriv) {
1400 GLint data[1] = {0};
1401 struct Cmds {
1402 cmds::SamplerParameterivImmediate cmd;
1403 GLint data[1];
1406 for (int jj = 0; jj < 1; ++jj) {
1407 data[jj] = static_cast<GLint>(jj);
1409 Cmds expected;
1410 expected.cmd.Init(1, GL_TEXTURE_MAG_FILTER, &data[0]);
1411 gl_->SamplerParameteriv(1, GL_TEXTURE_MAG_FILTER, &data[0]);
1412 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1415 TEST_F(GLES2ImplementationTest, Scissor) {
1416 struct Cmds {
1417 cmds::Scissor cmd;
1419 Cmds expected;
1420 expected.cmd.Init(1, 2, 3, 4);
1422 gl_->Scissor(1, 2, 3, 4);
1423 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1426 TEST_F(GLES2ImplementationTest, ShaderSource) {
1427 const uint32 kBucketId = GLES2Implementation::kResultBucketId;
1428 const char* kString1 = "happy";
1429 const char* kString2 = "ending";
1430 const size_t kString1Size = ::strlen(kString1) + 1;
1431 const size_t kString2Size = ::strlen(kString2) + 1;
1432 const size_t kHeaderSize = sizeof(GLint) * 3;
1433 const size_t kSourceSize = kHeaderSize + kString1Size + kString2Size;
1434 const size_t kPaddedHeaderSize =
1435 transfer_buffer_->RoundToAlignment(kHeaderSize);
1436 const size_t kPaddedString1Size =
1437 transfer_buffer_->RoundToAlignment(kString1Size);
1438 const size_t kPaddedString2Size =
1439 transfer_buffer_->RoundToAlignment(kString2Size);
1440 struct Cmds {
1441 cmd::SetBucketSize set_bucket_size;
1442 cmd::SetBucketData set_bucket_header;
1443 cmd::SetToken set_token1;
1444 cmd::SetBucketData set_bucket_data1;
1445 cmd::SetToken set_token2;
1446 cmd::SetBucketData set_bucket_data2;
1447 cmd::SetToken set_token3;
1448 cmds::ShaderSourceBucket cmd_bucket;
1449 cmd::SetBucketSize clear_bucket_size;
1452 ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize);
1453 ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedString1Size);
1454 ExpectedMemoryInfo mem2 = GetExpectedMemory(kPaddedString2Size);
1456 Cmds expected;
1457 expected.set_bucket_size.Init(kBucketId, kSourceSize);
1458 expected.set_bucket_header.Init(kBucketId, 0, kHeaderSize, mem0.id,
1459 mem0.offset);
1460 expected.set_token1.Init(GetNextToken());
1461 expected.set_bucket_data1.Init(kBucketId, kHeaderSize, kString1Size, mem1.id,
1462 mem1.offset);
1463 expected.set_token2.Init(GetNextToken());
1464 expected.set_bucket_data2.Init(kBucketId, kHeaderSize + kString1Size,
1465 kString2Size, mem2.id, mem2.offset);
1466 expected.set_token3.Init(GetNextToken());
1467 expected.cmd_bucket.Init(1, kBucketId);
1468 expected.clear_bucket_size.Init(kBucketId, 0);
1469 const char* kStrings[] = {kString1, kString2};
1470 gl_->ShaderSource(1, 2, kStrings, NULL);
1471 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1474 TEST_F(GLES2ImplementationTest, ShaderSourceWithLength) {
1475 const uint32 kBucketId = GLES2Implementation::kResultBucketId;
1476 const char* kString = "foobar******";
1477 const size_t kStringSize = 6; // We only need "foobar".
1478 const size_t kHeaderSize = sizeof(GLint) * 2;
1479 const size_t kSourceSize = kHeaderSize + kStringSize + 1;
1480 const size_t kPaddedHeaderSize =
1481 transfer_buffer_->RoundToAlignment(kHeaderSize);
1482 const size_t kPaddedStringSize =
1483 transfer_buffer_->RoundToAlignment(kStringSize + 1);
1484 struct Cmds {
1485 cmd::SetBucketSize set_bucket_size;
1486 cmd::SetBucketData set_bucket_header;
1487 cmd::SetToken set_token1;
1488 cmd::SetBucketData set_bucket_data;
1489 cmd::SetToken set_token2;
1490 cmds::ShaderSourceBucket shader_source_bucket;
1491 cmd::SetBucketSize clear_bucket_size;
1494 ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize);
1495 ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedStringSize);
1497 Cmds expected;
1498 expected.set_bucket_size.Init(kBucketId, kSourceSize);
1499 expected.set_bucket_header.Init(kBucketId, 0, kHeaderSize, mem0.id,
1500 mem0.offset);
1501 expected.set_token1.Init(GetNextToken());
1502 expected.set_bucket_data.Init(kBucketId, kHeaderSize, kStringSize + 1,
1503 mem1.id, mem1.offset);
1504 expected.set_token2.Init(GetNextToken());
1505 expected.shader_source_bucket.Init(1, kBucketId);
1506 expected.clear_bucket_size.Init(kBucketId, 0);
1507 const char* kStrings[] = {kString};
1508 const GLint kLength[] = {kStringSize};
1509 gl_->ShaderSource(1, 1, kStrings, kLength);
1510 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1513 TEST_F(GLES2ImplementationTest, StencilFunc) {
1514 struct Cmds {
1515 cmds::StencilFunc cmd;
1517 Cmds expected;
1518 expected.cmd.Init(GL_NEVER, 2, 3);
1520 gl_->StencilFunc(GL_NEVER, 2, 3);
1521 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1524 TEST_F(GLES2ImplementationTest, StencilFuncSeparate) {
1525 struct Cmds {
1526 cmds::StencilFuncSeparate cmd;
1528 Cmds expected;
1529 expected.cmd.Init(GL_FRONT, GL_NEVER, 3, 4);
1531 gl_->StencilFuncSeparate(GL_FRONT, GL_NEVER, 3, 4);
1532 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1535 TEST_F(GLES2ImplementationTest, StencilMask) {
1536 struct Cmds {
1537 cmds::StencilMask cmd;
1539 Cmds expected;
1540 expected.cmd.Init(1);
1542 gl_->StencilMask(1);
1543 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1546 TEST_F(GLES2ImplementationTest, StencilMaskSeparate) {
1547 struct Cmds {
1548 cmds::StencilMaskSeparate cmd;
1550 Cmds expected;
1551 expected.cmd.Init(GL_FRONT, 2);
1553 gl_->StencilMaskSeparate(GL_FRONT, 2);
1554 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1557 TEST_F(GLES2ImplementationTest, StencilOp) {
1558 struct Cmds {
1559 cmds::StencilOp cmd;
1561 Cmds expected;
1562 expected.cmd.Init(GL_KEEP, GL_INCR, GL_KEEP);
1564 gl_->StencilOp(GL_KEEP, GL_INCR, GL_KEEP);
1565 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1568 TEST_F(GLES2ImplementationTest, StencilOpSeparate) {
1569 struct Cmds {
1570 cmds::StencilOpSeparate cmd;
1572 Cmds expected;
1573 expected.cmd.Init(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1575 gl_->StencilOpSeparate(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1576 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1579 TEST_F(GLES2ImplementationTest, TexParameterf) {
1580 struct Cmds {
1581 cmds::TexParameterf cmd;
1583 Cmds expected;
1584 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1586 gl_->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1587 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1590 TEST_F(GLES2ImplementationTest, TexParameterfv) {
1591 GLfloat data[1] = {0};
1592 struct Cmds {
1593 cmds::TexParameterfvImmediate cmd;
1594 GLfloat data[1];
1597 for (int jj = 0; jj < 1; ++jj) {
1598 data[jj] = static_cast<GLfloat>(jj);
1600 Cmds expected;
1601 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1602 gl_->TexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1603 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1606 TEST_F(GLES2ImplementationTest, TexParameteri) {
1607 struct Cmds {
1608 cmds::TexParameteri cmd;
1610 Cmds expected;
1611 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1613 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1614 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1617 TEST_F(GLES2ImplementationTest, TexParameteriv) {
1618 GLint data[1] = {0};
1619 struct Cmds {
1620 cmds::TexParameterivImmediate cmd;
1621 GLint data[1];
1624 for (int jj = 0; jj < 1; ++jj) {
1625 data[jj] = static_cast<GLint>(jj);
1627 Cmds expected;
1628 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1629 gl_->TexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1630 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1633 TEST_F(GLES2ImplementationTest, TexStorage3D) {
1634 struct Cmds {
1635 cmds::TexStorage3D cmd;
1637 Cmds expected;
1638 expected.cmd.Init(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6);
1640 gl_->TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6);
1641 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1644 TEST_F(GLES2ImplementationTest, TransformFeedbackVaryings) {
1645 const uint32 kBucketId = GLES2Implementation::kResultBucketId;
1646 const char* kString1 = "happy";
1647 const char* kString2 = "ending";
1648 const size_t kString1Size = ::strlen(kString1) + 1;
1649 const size_t kString2Size = ::strlen(kString2) + 1;
1650 const size_t kHeaderSize = sizeof(GLint) * 3;
1651 const size_t kSourceSize = kHeaderSize + kString1Size + kString2Size;
1652 const size_t kPaddedHeaderSize =
1653 transfer_buffer_->RoundToAlignment(kHeaderSize);
1654 const size_t kPaddedString1Size =
1655 transfer_buffer_->RoundToAlignment(kString1Size);
1656 const size_t kPaddedString2Size =
1657 transfer_buffer_->RoundToAlignment(kString2Size);
1658 struct Cmds {
1659 cmd::SetBucketSize set_bucket_size;
1660 cmd::SetBucketData set_bucket_header;
1661 cmd::SetToken set_token1;
1662 cmd::SetBucketData set_bucket_data1;
1663 cmd::SetToken set_token2;
1664 cmd::SetBucketData set_bucket_data2;
1665 cmd::SetToken set_token3;
1666 cmds::TransformFeedbackVaryingsBucket cmd_bucket;
1667 cmd::SetBucketSize clear_bucket_size;
1670 ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize);
1671 ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedString1Size);
1672 ExpectedMemoryInfo mem2 = GetExpectedMemory(kPaddedString2Size);
1674 Cmds expected;
1675 expected.set_bucket_size.Init(kBucketId, kSourceSize);
1676 expected.set_bucket_header.Init(kBucketId, 0, kHeaderSize, mem0.id,
1677 mem0.offset);
1678 expected.set_token1.Init(GetNextToken());
1679 expected.set_bucket_data1.Init(kBucketId, kHeaderSize, kString1Size, mem1.id,
1680 mem1.offset);
1681 expected.set_token2.Init(GetNextToken());
1682 expected.set_bucket_data2.Init(kBucketId, kHeaderSize + kString1Size,
1683 kString2Size, mem2.id, mem2.offset);
1684 expected.set_token3.Init(GetNextToken());
1685 expected.cmd_bucket.Init(1, kBucketId, GL_INTERLEAVED_ATTRIBS);
1686 expected.clear_bucket_size.Init(kBucketId, 0);
1687 const char* kStrings[] = {kString1, kString2};
1688 gl_->TransformFeedbackVaryings(1, 2, kStrings, GL_INTERLEAVED_ATTRIBS);
1689 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1692 TEST_F(GLES2ImplementationTest, Uniform1f) {
1693 struct Cmds {
1694 cmds::Uniform1f cmd;
1696 Cmds expected;
1697 expected.cmd.Init(1, 2);
1699 gl_->Uniform1f(1, 2);
1700 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1703 TEST_F(GLES2ImplementationTest, Uniform1fv) {
1704 GLfloat data[2][1] = {{0}};
1705 struct Cmds {
1706 cmds::Uniform1fvImmediate cmd;
1707 GLfloat data[2][1];
1710 Cmds expected;
1711 for (int ii = 0; ii < 2; ++ii) {
1712 for (int jj = 0; jj < 1; ++jj) {
1713 data[ii][jj] = static_cast<GLfloat>(ii * 1 + jj);
1716 expected.cmd.Init(1, 2, &data[0][0]);
1717 gl_->Uniform1fv(1, 2, &data[0][0]);
1718 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1721 TEST_F(GLES2ImplementationTest, Uniform1i) {
1722 struct Cmds {
1723 cmds::Uniform1i cmd;
1725 Cmds expected;
1726 expected.cmd.Init(1, 2);
1728 gl_->Uniform1i(1, 2);
1729 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1732 TEST_F(GLES2ImplementationTest, Uniform1iv) {
1733 GLint data[2][1] = {{0}};
1734 struct Cmds {
1735 cmds::Uniform1ivImmediate cmd;
1736 GLint data[2][1];
1739 Cmds expected;
1740 for (int ii = 0; ii < 2; ++ii) {
1741 for (int jj = 0; jj < 1; ++jj) {
1742 data[ii][jj] = static_cast<GLint>(ii * 1 + jj);
1745 expected.cmd.Init(1, 2, &data[0][0]);
1746 gl_->Uniform1iv(1, 2, &data[0][0]);
1747 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1750 TEST_F(GLES2ImplementationTest, Uniform1ui) {
1751 struct Cmds {
1752 cmds::Uniform1ui cmd;
1754 Cmds expected;
1755 expected.cmd.Init(1, 2);
1757 gl_->Uniform1ui(1, 2);
1758 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1761 TEST_F(GLES2ImplementationTest, Uniform1uiv) {
1762 GLuint data[2][1] = {{0}};
1763 struct Cmds {
1764 cmds::Uniform1uivImmediate cmd;
1765 GLuint data[2][1];
1768 Cmds expected;
1769 for (int ii = 0; ii < 2; ++ii) {
1770 for (int jj = 0; jj < 1; ++jj) {
1771 data[ii][jj] = static_cast<GLuint>(ii * 1 + jj);
1774 expected.cmd.Init(1, 2, &data[0][0]);
1775 gl_->Uniform1uiv(1, 2, &data[0][0]);
1776 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1779 TEST_F(GLES2ImplementationTest, Uniform2f) {
1780 struct Cmds {
1781 cmds::Uniform2f cmd;
1783 Cmds expected;
1784 expected.cmd.Init(1, 2, 3);
1786 gl_->Uniform2f(1, 2, 3);
1787 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1790 TEST_F(GLES2ImplementationTest, Uniform2fv) {
1791 GLfloat data[2][2] = {{0}};
1792 struct Cmds {
1793 cmds::Uniform2fvImmediate cmd;
1794 GLfloat data[2][2];
1797 Cmds expected;
1798 for (int ii = 0; ii < 2; ++ii) {
1799 for (int jj = 0; jj < 2; ++jj) {
1800 data[ii][jj] = static_cast<GLfloat>(ii * 2 + jj);
1803 expected.cmd.Init(1, 2, &data[0][0]);
1804 gl_->Uniform2fv(1, 2, &data[0][0]);
1805 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1808 TEST_F(GLES2ImplementationTest, Uniform2i) {
1809 struct Cmds {
1810 cmds::Uniform2i cmd;
1812 Cmds expected;
1813 expected.cmd.Init(1, 2, 3);
1815 gl_->Uniform2i(1, 2, 3);
1816 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1819 TEST_F(GLES2ImplementationTest, Uniform2iv) {
1820 GLint data[2][2] = {{0}};
1821 struct Cmds {
1822 cmds::Uniform2ivImmediate cmd;
1823 GLint data[2][2];
1826 Cmds expected;
1827 for (int ii = 0; ii < 2; ++ii) {
1828 for (int jj = 0; jj < 2; ++jj) {
1829 data[ii][jj] = static_cast<GLint>(ii * 2 + jj);
1832 expected.cmd.Init(1, 2, &data[0][0]);
1833 gl_->Uniform2iv(1, 2, &data[0][0]);
1834 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1837 TEST_F(GLES2ImplementationTest, Uniform2ui) {
1838 struct Cmds {
1839 cmds::Uniform2ui cmd;
1841 Cmds expected;
1842 expected.cmd.Init(1, 2, 3);
1844 gl_->Uniform2ui(1, 2, 3);
1845 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1848 TEST_F(GLES2ImplementationTest, Uniform2uiv) {
1849 GLuint data[2][2] = {{0}};
1850 struct Cmds {
1851 cmds::Uniform2uivImmediate cmd;
1852 GLuint data[2][2];
1855 Cmds expected;
1856 for (int ii = 0; ii < 2; ++ii) {
1857 for (int jj = 0; jj < 2; ++jj) {
1858 data[ii][jj] = static_cast<GLuint>(ii * 2 + jj);
1861 expected.cmd.Init(1, 2, &data[0][0]);
1862 gl_->Uniform2uiv(1, 2, &data[0][0]);
1863 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1866 TEST_F(GLES2ImplementationTest, Uniform3f) {
1867 struct Cmds {
1868 cmds::Uniform3f cmd;
1870 Cmds expected;
1871 expected.cmd.Init(1, 2, 3, 4);
1873 gl_->Uniform3f(1, 2, 3, 4);
1874 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1877 TEST_F(GLES2ImplementationTest, Uniform3fv) {
1878 GLfloat data[2][3] = {{0}};
1879 struct Cmds {
1880 cmds::Uniform3fvImmediate cmd;
1881 GLfloat data[2][3];
1884 Cmds expected;
1885 for (int ii = 0; ii < 2; ++ii) {
1886 for (int jj = 0; jj < 3; ++jj) {
1887 data[ii][jj] = static_cast<GLfloat>(ii * 3 + jj);
1890 expected.cmd.Init(1, 2, &data[0][0]);
1891 gl_->Uniform3fv(1, 2, &data[0][0]);
1892 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1895 TEST_F(GLES2ImplementationTest, Uniform3i) {
1896 struct Cmds {
1897 cmds::Uniform3i cmd;
1899 Cmds expected;
1900 expected.cmd.Init(1, 2, 3, 4);
1902 gl_->Uniform3i(1, 2, 3, 4);
1903 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1906 TEST_F(GLES2ImplementationTest, Uniform3iv) {
1907 GLint data[2][3] = {{0}};
1908 struct Cmds {
1909 cmds::Uniform3ivImmediate cmd;
1910 GLint data[2][3];
1913 Cmds expected;
1914 for (int ii = 0; ii < 2; ++ii) {
1915 for (int jj = 0; jj < 3; ++jj) {
1916 data[ii][jj] = static_cast<GLint>(ii * 3 + jj);
1919 expected.cmd.Init(1, 2, &data[0][0]);
1920 gl_->Uniform3iv(1, 2, &data[0][0]);
1921 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1924 TEST_F(GLES2ImplementationTest, Uniform3ui) {
1925 struct Cmds {
1926 cmds::Uniform3ui cmd;
1928 Cmds expected;
1929 expected.cmd.Init(1, 2, 3, 4);
1931 gl_->Uniform3ui(1, 2, 3, 4);
1932 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1935 TEST_F(GLES2ImplementationTest, Uniform3uiv) {
1936 GLuint data[2][3] = {{0}};
1937 struct Cmds {
1938 cmds::Uniform3uivImmediate cmd;
1939 GLuint data[2][3];
1942 Cmds expected;
1943 for (int ii = 0; ii < 2; ++ii) {
1944 for (int jj = 0; jj < 3; ++jj) {
1945 data[ii][jj] = static_cast<GLuint>(ii * 3 + jj);
1948 expected.cmd.Init(1, 2, &data[0][0]);
1949 gl_->Uniform3uiv(1, 2, &data[0][0]);
1950 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1953 TEST_F(GLES2ImplementationTest, Uniform4f) {
1954 struct Cmds {
1955 cmds::Uniform4f cmd;
1957 Cmds expected;
1958 expected.cmd.Init(1, 2, 3, 4, 5);
1960 gl_->Uniform4f(1, 2, 3, 4, 5);
1961 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1964 TEST_F(GLES2ImplementationTest, Uniform4fv) {
1965 GLfloat data[2][4] = {{0}};
1966 struct Cmds {
1967 cmds::Uniform4fvImmediate cmd;
1968 GLfloat data[2][4];
1971 Cmds expected;
1972 for (int ii = 0; ii < 2; ++ii) {
1973 for (int jj = 0; jj < 4; ++jj) {
1974 data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj);
1977 expected.cmd.Init(1, 2, &data[0][0]);
1978 gl_->Uniform4fv(1, 2, &data[0][0]);
1979 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1982 TEST_F(GLES2ImplementationTest, Uniform4i) {
1983 struct Cmds {
1984 cmds::Uniform4i cmd;
1986 Cmds expected;
1987 expected.cmd.Init(1, 2, 3, 4, 5);
1989 gl_->Uniform4i(1, 2, 3, 4, 5);
1990 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1993 TEST_F(GLES2ImplementationTest, Uniform4iv) {
1994 GLint data[2][4] = {{0}};
1995 struct Cmds {
1996 cmds::Uniform4ivImmediate cmd;
1997 GLint data[2][4];
2000 Cmds expected;
2001 for (int ii = 0; ii < 2; ++ii) {
2002 for (int jj = 0; jj < 4; ++jj) {
2003 data[ii][jj] = static_cast<GLint>(ii * 4 + jj);
2006 expected.cmd.Init(1, 2, &data[0][0]);
2007 gl_->Uniform4iv(1, 2, &data[0][0]);
2008 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2011 TEST_F(GLES2ImplementationTest, Uniform4ui) {
2012 struct Cmds {
2013 cmds::Uniform4ui cmd;
2015 Cmds expected;
2016 expected.cmd.Init(1, 2, 3, 4, 5);
2018 gl_->Uniform4ui(1, 2, 3, 4, 5);
2019 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2022 TEST_F(GLES2ImplementationTest, Uniform4uiv) {
2023 GLuint data[2][4] = {{0}};
2024 struct Cmds {
2025 cmds::Uniform4uivImmediate cmd;
2026 GLuint data[2][4];
2029 Cmds expected;
2030 for (int ii = 0; ii < 2; ++ii) {
2031 for (int jj = 0; jj < 4; ++jj) {
2032 data[ii][jj] = static_cast<GLuint>(ii * 4 + jj);
2035 expected.cmd.Init(1, 2, &data[0][0]);
2036 gl_->Uniform4uiv(1, 2, &data[0][0]);
2037 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2040 TEST_F(GLES2ImplementationTest, UniformBlockBinding) {
2041 struct Cmds {
2042 cmds::UniformBlockBinding cmd;
2044 Cmds expected;
2045 expected.cmd.Init(1, 2, 3);
2047 gl_->UniformBlockBinding(1, 2, 3);
2048 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2051 TEST_F(GLES2ImplementationTest, UniformMatrix2fv) {
2052 GLfloat data[2][4] = {{0}};
2053 struct Cmds {
2054 cmds::UniformMatrix2fvImmediate cmd;
2055 GLfloat data[2][4];
2058 Cmds expected;
2059 for (int ii = 0; ii < 2; ++ii) {
2060 for (int jj = 0; jj < 4; ++jj) {
2061 data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj);
2064 expected.cmd.Init(1, 2, &data[0][0]);
2065 gl_->UniformMatrix2fv(1, 2, false, &data[0][0]);
2066 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2069 TEST_F(GLES2ImplementationTest, UniformMatrix2fvInvalidConstantArg2) {
2070 GLfloat data[2][4] = {{0}};
2071 for (int ii = 0; ii < 2; ++ii) {
2072 for (int jj = 0; jj < 4; ++jj) {
2073 data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj);
2076 gl_->UniformMatrix2fv(1, 2, true, &data[0][0]);
2077 EXPECT_TRUE(NoCommandsWritten());
2078 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2081 TEST_F(GLES2ImplementationTest, UniformMatrix2x3fv) {
2082 GLfloat data[2][6] = {{0}};
2083 struct Cmds {
2084 cmds::UniformMatrix2x3fvImmediate cmd;
2085 GLfloat data[2][6];
2088 Cmds expected;
2089 for (int ii = 0; ii < 2; ++ii) {
2090 for (int jj = 0; jj < 6; ++jj) {
2091 data[ii][jj] = static_cast<GLfloat>(ii * 6 + jj);
2094 expected.cmd.Init(1, 2, &data[0][0]);
2095 gl_->UniformMatrix2x3fv(1, 2, false, &data[0][0]);
2096 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2099 TEST_F(GLES2ImplementationTest, UniformMatrix2x3fvInvalidConstantArg2) {
2100 GLfloat data[2][6] = {{0}};
2101 for (int ii = 0; ii < 2; ++ii) {
2102 for (int jj = 0; jj < 6; ++jj) {
2103 data[ii][jj] = static_cast<GLfloat>(ii * 6 + jj);
2106 gl_->UniformMatrix2x3fv(1, 2, true, &data[0][0]);
2107 EXPECT_TRUE(NoCommandsWritten());
2108 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2111 TEST_F(GLES2ImplementationTest, UniformMatrix2x4fv) {
2112 GLfloat data[2][8] = {{0}};
2113 struct Cmds {
2114 cmds::UniformMatrix2x4fvImmediate cmd;
2115 GLfloat data[2][8];
2118 Cmds expected;
2119 for (int ii = 0; ii < 2; ++ii) {
2120 for (int jj = 0; jj < 8; ++jj) {
2121 data[ii][jj] = static_cast<GLfloat>(ii * 8 + jj);
2124 expected.cmd.Init(1, 2, &data[0][0]);
2125 gl_->UniformMatrix2x4fv(1, 2, false, &data[0][0]);
2126 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2129 TEST_F(GLES2ImplementationTest, UniformMatrix2x4fvInvalidConstantArg2) {
2130 GLfloat data[2][8] = {{0}};
2131 for (int ii = 0; ii < 2; ++ii) {
2132 for (int jj = 0; jj < 8; ++jj) {
2133 data[ii][jj] = static_cast<GLfloat>(ii * 8 + jj);
2136 gl_->UniformMatrix2x4fv(1, 2, true, &data[0][0]);
2137 EXPECT_TRUE(NoCommandsWritten());
2138 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2141 TEST_F(GLES2ImplementationTest, UniformMatrix3fv) {
2142 GLfloat data[2][9] = {{0}};
2143 struct Cmds {
2144 cmds::UniformMatrix3fvImmediate cmd;
2145 GLfloat data[2][9];
2148 Cmds expected;
2149 for (int ii = 0; ii < 2; ++ii) {
2150 for (int jj = 0; jj < 9; ++jj) {
2151 data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj);
2154 expected.cmd.Init(1, 2, &data[0][0]);
2155 gl_->UniformMatrix3fv(1, 2, false, &data[0][0]);
2156 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2159 TEST_F(GLES2ImplementationTest, UniformMatrix3fvInvalidConstantArg2) {
2160 GLfloat data[2][9] = {{0}};
2161 for (int ii = 0; ii < 2; ++ii) {
2162 for (int jj = 0; jj < 9; ++jj) {
2163 data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj);
2166 gl_->UniformMatrix3fv(1, 2, true, &data[0][0]);
2167 EXPECT_TRUE(NoCommandsWritten());
2168 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2171 TEST_F(GLES2ImplementationTest, UniformMatrix3x2fv) {
2172 GLfloat data[2][6] = {{0}};
2173 struct Cmds {
2174 cmds::UniformMatrix3x2fvImmediate cmd;
2175 GLfloat data[2][6];
2178 Cmds expected;
2179 for (int ii = 0; ii < 2; ++ii) {
2180 for (int jj = 0; jj < 6; ++jj) {
2181 data[ii][jj] = static_cast<GLfloat>(ii * 6 + jj);
2184 expected.cmd.Init(1, 2, &data[0][0]);
2185 gl_->UniformMatrix3x2fv(1, 2, false, &data[0][0]);
2186 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2189 TEST_F(GLES2ImplementationTest, UniformMatrix3x2fvInvalidConstantArg2) {
2190 GLfloat data[2][6] = {{0}};
2191 for (int ii = 0; ii < 2; ++ii) {
2192 for (int jj = 0; jj < 6; ++jj) {
2193 data[ii][jj] = static_cast<GLfloat>(ii * 6 + jj);
2196 gl_->UniformMatrix3x2fv(1, 2, true, &data[0][0]);
2197 EXPECT_TRUE(NoCommandsWritten());
2198 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2201 TEST_F(GLES2ImplementationTest, UniformMatrix3x4fv) {
2202 GLfloat data[2][12] = {{0}};
2203 struct Cmds {
2204 cmds::UniformMatrix3x4fvImmediate cmd;
2205 GLfloat data[2][12];
2208 Cmds expected;
2209 for (int ii = 0; ii < 2; ++ii) {
2210 for (int jj = 0; jj < 12; ++jj) {
2211 data[ii][jj] = static_cast<GLfloat>(ii * 12 + jj);
2214 expected.cmd.Init(1, 2, &data[0][0]);
2215 gl_->UniformMatrix3x4fv(1, 2, false, &data[0][0]);
2216 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2219 TEST_F(GLES2ImplementationTest, UniformMatrix3x4fvInvalidConstantArg2) {
2220 GLfloat data[2][12] = {{0}};
2221 for (int ii = 0; ii < 2; ++ii) {
2222 for (int jj = 0; jj < 12; ++jj) {
2223 data[ii][jj] = static_cast<GLfloat>(ii * 12 + jj);
2226 gl_->UniformMatrix3x4fv(1, 2, true, &data[0][0]);
2227 EXPECT_TRUE(NoCommandsWritten());
2228 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2231 TEST_F(GLES2ImplementationTest, UniformMatrix4fv) {
2232 GLfloat data[2][16] = {{0}};
2233 struct Cmds {
2234 cmds::UniformMatrix4fvImmediate cmd;
2235 GLfloat data[2][16];
2238 Cmds expected;
2239 for (int ii = 0; ii < 2; ++ii) {
2240 for (int jj = 0; jj < 16; ++jj) {
2241 data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj);
2244 expected.cmd.Init(1, 2, &data[0][0]);
2245 gl_->UniformMatrix4fv(1, 2, false, &data[0][0]);
2246 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2249 TEST_F(GLES2ImplementationTest, UniformMatrix4fvInvalidConstantArg2) {
2250 GLfloat data[2][16] = {{0}};
2251 for (int ii = 0; ii < 2; ++ii) {
2252 for (int jj = 0; jj < 16; ++jj) {
2253 data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj);
2256 gl_->UniformMatrix4fv(1, 2, true, &data[0][0]);
2257 EXPECT_TRUE(NoCommandsWritten());
2258 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2261 TEST_F(GLES2ImplementationTest, UniformMatrix4x2fv) {
2262 GLfloat data[2][8] = {{0}};
2263 struct Cmds {
2264 cmds::UniformMatrix4x2fvImmediate cmd;
2265 GLfloat data[2][8];
2268 Cmds expected;
2269 for (int ii = 0; ii < 2; ++ii) {
2270 for (int jj = 0; jj < 8; ++jj) {
2271 data[ii][jj] = static_cast<GLfloat>(ii * 8 + jj);
2274 expected.cmd.Init(1, 2, &data[0][0]);
2275 gl_->UniformMatrix4x2fv(1, 2, false, &data[0][0]);
2276 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2279 TEST_F(GLES2ImplementationTest, UniformMatrix4x2fvInvalidConstantArg2) {
2280 GLfloat data[2][8] = {{0}};
2281 for (int ii = 0; ii < 2; ++ii) {
2282 for (int jj = 0; jj < 8; ++jj) {
2283 data[ii][jj] = static_cast<GLfloat>(ii * 8 + jj);
2286 gl_->UniformMatrix4x2fv(1, 2, true, &data[0][0]);
2287 EXPECT_TRUE(NoCommandsWritten());
2288 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2291 TEST_F(GLES2ImplementationTest, UniformMatrix4x3fv) {
2292 GLfloat data[2][12] = {{0}};
2293 struct Cmds {
2294 cmds::UniformMatrix4x3fvImmediate cmd;
2295 GLfloat data[2][12];
2298 Cmds expected;
2299 for (int ii = 0; ii < 2; ++ii) {
2300 for (int jj = 0; jj < 12; ++jj) {
2301 data[ii][jj] = static_cast<GLfloat>(ii * 12 + jj);
2304 expected.cmd.Init(1, 2, &data[0][0]);
2305 gl_->UniformMatrix4x3fv(1, 2, false, &data[0][0]);
2306 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2309 TEST_F(GLES2ImplementationTest, UniformMatrix4x3fvInvalidConstantArg2) {
2310 GLfloat data[2][12] = {{0}};
2311 for (int ii = 0; ii < 2; ++ii) {
2312 for (int jj = 0; jj < 12; ++jj) {
2313 data[ii][jj] = static_cast<GLfloat>(ii * 12 + jj);
2316 gl_->UniformMatrix4x3fv(1, 2, true, &data[0][0]);
2317 EXPECT_TRUE(NoCommandsWritten());
2318 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2321 TEST_F(GLES2ImplementationTest, UseProgram) {
2322 struct Cmds {
2323 cmds::UseProgram cmd;
2325 Cmds expected;
2326 expected.cmd.Init(1);
2328 gl_->UseProgram(1);
2329 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2330 ClearCommands();
2331 gl_->UseProgram(1);
2332 EXPECT_TRUE(NoCommandsWritten());
2335 TEST_F(GLES2ImplementationTest, ValidateProgram) {
2336 struct Cmds {
2337 cmds::ValidateProgram cmd;
2339 Cmds expected;
2340 expected.cmd.Init(1);
2342 gl_->ValidateProgram(1);
2343 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2346 TEST_F(GLES2ImplementationTest, VertexAttrib1f) {
2347 struct Cmds {
2348 cmds::VertexAttrib1f cmd;
2350 Cmds expected;
2351 expected.cmd.Init(1, 2);
2353 gl_->VertexAttrib1f(1, 2);
2354 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2357 TEST_F(GLES2ImplementationTest, VertexAttrib1fv) {
2358 GLfloat data[1] = {0};
2359 struct Cmds {
2360 cmds::VertexAttrib1fvImmediate cmd;
2361 GLfloat data[1];
2364 for (int jj = 0; jj < 1; ++jj) {
2365 data[jj] = static_cast<GLfloat>(jj);
2367 Cmds expected;
2368 expected.cmd.Init(1, &data[0]);
2369 gl_->VertexAttrib1fv(1, &data[0]);
2370 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2373 TEST_F(GLES2ImplementationTest, VertexAttrib2f) {
2374 struct Cmds {
2375 cmds::VertexAttrib2f cmd;
2377 Cmds expected;
2378 expected.cmd.Init(1, 2, 3);
2380 gl_->VertexAttrib2f(1, 2, 3);
2381 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2384 TEST_F(GLES2ImplementationTest, VertexAttrib2fv) {
2385 GLfloat data[2] = {0};
2386 struct Cmds {
2387 cmds::VertexAttrib2fvImmediate cmd;
2388 GLfloat data[2];
2391 for (int jj = 0; jj < 2; ++jj) {
2392 data[jj] = static_cast<GLfloat>(jj);
2394 Cmds expected;
2395 expected.cmd.Init(1, &data[0]);
2396 gl_->VertexAttrib2fv(1, &data[0]);
2397 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2400 TEST_F(GLES2ImplementationTest, VertexAttrib3f) {
2401 struct Cmds {
2402 cmds::VertexAttrib3f cmd;
2404 Cmds expected;
2405 expected.cmd.Init(1, 2, 3, 4);
2407 gl_->VertexAttrib3f(1, 2, 3, 4);
2408 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2411 TEST_F(GLES2ImplementationTest, VertexAttrib3fv) {
2412 GLfloat data[3] = {0};
2413 struct Cmds {
2414 cmds::VertexAttrib3fvImmediate cmd;
2415 GLfloat data[3];
2418 for (int jj = 0; jj < 3; ++jj) {
2419 data[jj] = static_cast<GLfloat>(jj);
2421 Cmds expected;
2422 expected.cmd.Init(1, &data[0]);
2423 gl_->VertexAttrib3fv(1, &data[0]);
2424 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2427 TEST_F(GLES2ImplementationTest, VertexAttrib4f) {
2428 struct Cmds {
2429 cmds::VertexAttrib4f cmd;
2431 Cmds expected;
2432 expected.cmd.Init(1, 2, 3, 4, 5);
2434 gl_->VertexAttrib4f(1, 2, 3, 4, 5);
2435 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2438 TEST_F(GLES2ImplementationTest, VertexAttrib4fv) {
2439 GLfloat data[4] = {0};
2440 struct Cmds {
2441 cmds::VertexAttrib4fvImmediate cmd;
2442 GLfloat data[4];
2445 for (int jj = 0; jj < 4; ++jj) {
2446 data[jj] = static_cast<GLfloat>(jj);
2448 Cmds expected;
2449 expected.cmd.Init(1, &data[0]);
2450 gl_->VertexAttrib4fv(1, &data[0]);
2451 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2454 TEST_F(GLES2ImplementationTest, VertexAttribI4i) {
2455 struct Cmds {
2456 cmds::VertexAttribI4i cmd;
2458 Cmds expected;
2459 expected.cmd.Init(1, 2, 3, 4, 5);
2461 gl_->VertexAttribI4i(1, 2, 3, 4, 5);
2462 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2465 TEST_F(GLES2ImplementationTest, VertexAttribI4iv) {
2466 GLint data[4] = {0};
2467 struct Cmds {
2468 cmds::VertexAttribI4ivImmediate cmd;
2469 GLint data[4];
2472 for (int jj = 0; jj < 4; ++jj) {
2473 data[jj] = static_cast<GLint>(jj);
2475 Cmds expected;
2476 expected.cmd.Init(1, &data[0]);
2477 gl_->VertexAttribI4iv(1, &data[0]);
2478 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2481 TEST_F(GLES2ImplementationTest, VertexAttribI4ui) {
2482 struct Cmds {
2483 cmds::VertexAttribI4ui cmd;
2485 Cmds expected;
2486 expected.cmd.Init(1, 2, 3, 4, 5);
2488 gl_->VertexAttribI4ui(1, 2, 3, 4, 5);
2489 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2492 TEST_F(GLES2ImplementationTest, VertexAttribI4uiv) {
2493 GLuint data[4] = {0};
2494 struct Cmds {
2495 cmds::VertexAttribI4uivImmediate cmd;
2496 GLuint data[4];
2499 for (int jj = 0; jj < 4; ++jj) {
2500 data[jj] = static_cast<GLuint>(jj);
2502 Cmds expected;
2503 expected.cmd.Init(1, &data[0]);
2504 gl_->VertexAttribI4uiv(1, &data[0]);
2505 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2508 TEST_F(GLES2ImplementationTest, Viewport) {
2509 struct Cmds {
2510 cmds::Viewport cmd;
2512 Cmds expected;
2513 expected.cmd.Init(1, 2, 3, 4);
2515 gl_->Viewport(1, 2, 3, 4);
2516 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2519 TEST_F(GLES2ImplementationTest, BlitFramebufferCHROMIUM) {
2520 struct Cmds {
2521 cmds::BlitFramebufferCHROMIUM cmd;
2523 Cmds expected;
2524 expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST);
2526 gl_->BlitFramebufferCHROMIUM(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST);
2527 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2530 TEST_F(GLES2ImplementationTest, RenderbufferStorageMultisampleCHROMIUM) {
2531 struct Cmds {
2532 cmds::RenderbufferStorageMultisampleCHROMIUM cmd;
2534 Cmds expected;
2535 expected.cmd.Init(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
2537 gl_->RenderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, 2, GL_RGBA4, 4,
2539 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2542 TEST_F(GLES2ImplementationTest, RenderbufferStorageMultisampleEXT) {
2543 struct Cmds {
2544 cmds::RenderbufferStorageMultisampleEXT cmd;
2546 Cmds expected;
2547 expected.cmd.Init(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
2549 gl_->RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
2550 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2553 TEST_F(GLES2ImplementationTest, FramebufferTexture2DMultisampleEXT) {
2554 struct Cmds {
2555 cmds::FramebufferTexture2DMultisampleEXT cmd;
2557 Cmds expected;
2558 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 6);
2560 gl_->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
2561 GL_TEXTURE_2D, 4, 0, 6);
2562 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2565 TEST_F(GLES2ImplementationTest,
2566 FramebufferTexture2DMultisampleEXTInvalidConstantArg4) {
2567 gl_->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
2568 GL_TEXTURE_2D, 4, 1, 6);
2569 EXPECT_TRUE(NoCommandsWritten());
2570 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
2573 TEST_F(GLES2ImplementationTest, TexStorage2DEXT) {
2574 struct Cmds {
2575 cmds::TexStorage2DEXT cmd;
2577 Cmds expected;
2578 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5);
2580 gl_->TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5);
2581 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2584 TEST_F(GLES2ImplementationTest, GenQueriesEXT) {
2585 GLuint ids[2] = {
2588 struct Cmds {
2589 cmds::GenQueriesEXTImmediate gen;
2590 GLuint data[2];
2592 Cmds expected;
2593 expected.gen.Init(arraysize(ids), &ids[0]);
2594 expected.data[0] = kQueriesStartId;
2595 expected.data[1] = kQueriesStartId + 1;
2596 gl_->GenQueriesEXT(arraysize(ids), &ids[0]);
2597 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2598 EXPECT_EQ(kQueriesStartId, ids[0]);
2599 EXPECT_EQ(kQueriesStartId + 1, ids[1]);
2602 TEST_F(GLES2ImplementationTest, DeleteQueriesEXT) {
2603 GLuint ids[2] = {kQueriesStartId, kQueriesStartId + 1};
2604 struct Cmds {
2605 cmds::DeleteQueriesEXTImmediate del;
2606 GLuint data[2];
2608 Cmds expected;
2609 expected.del.Init(arraysize(ids), &ids[0]);
2610 expected.data[0] = kQueriesStartId;
2611 expected.data[1] = kQueriesStartId + 1;
2612 gl_->DeleteQueriesEXT(arraysize(ids), &ids[0]);
2613 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2615 // TODO(zmo): Implement unit test for BeginQueryEXT
2617 TEST_F(GLES2ImplementationTest, BeginTransformFeedback) {
2618 struct Cmds {
2619 cmds::BeginTransformFeedback cmd;
2621 Cmds expected;
2622 expected.cmd.Init(GL_POINTS);
2624 gl_->BeginTransformFeedback(GL_POINTS);
2625 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2628 TEST_F(GLES2ImplementationTest, EndTransformFeedback) {
2629 struct Cmds {
2630 cmds::EndTransformFeedback cmd;
2632 Cmds expected;
2633 expected.cmd.Init();
2635 gl_->EndTransformFeedback();
2636 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2638 // TODO(zmo): Implement unit test for InsertEventMarkerEXT
2639 // TODO(zmo): Implement unit test for PushGroupMarkerEXT
2641 TEST_F(GLES2ImplementationTest, PopGroupMarkerEXT) {
2642 struct Cmds {
2643 cmds::PopGroupMarkerEXT cmd;
2645 Cmds expected;
2646 expected.cmd.Init();
2648 gl_->PopGroupMarkerEXT();
2649 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2652 TEST_F(GLES2ImplementationTest, GenVertexArraysOES) {
2653 GLuint ids[2] = {
2656 struct Cmds {
2657 cmds::GenVertexArraysOESImmediate gen;
2658 GLuint data[2];
2660 Cmds expected;
2661 expected.gen.Init(arraysize(ids), &ids[0]);
2662 expected.data[0] = kVertexArraysStartId;
2663 expected.data[1] = kVertexArraysStartId + 1;
2664 gl_->GenVertexArraysOES(arraysize(ids), &ids[0]);
2665 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2666 EXPECT_EQ(kVertexArraysStartId, ids[0]);
2667 EXPECT_EQ(kVertexArraysStartId + 1, ids[1]);
2670 TEST_F(GLES2ImplementationTest, DeleteVertexArraysOES) {
2671 GLuint ids[2] = {kVertexArraysStartId, kVertexArraysStartId + 1};
2672 struct Cmds {
2673 cmds::DeleteVertexArraysOESImmediate del;
2674 GLuint data[2];
2676 Cmds expected;
2677 expected.del.Init(arraysize(ids), &ids[0]);
2678 expected.data[0] = kVertexArraysStartId;
2679 expected.data[1] = kVertexArraysStartId + 1;
2680 gl_->DeleteVertexArraysOES(arraysize(ids), &ids[0]);
2681 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2684 TEST_F(GLES2ImplementationTest, IsVertexArrayOES) {
2685 struct Cmds {
2686 cmds::IsVertexArrayOES cmd;
2689 Cmds expected;
2690 ExpectedMemoryInfo result1 =
2691 GetExpectedResultMemory(sizeof(cmds::IsVertexArrayOES::Result));
2692 expected.cmd.Init(1, result1.id, result1.offset);
2694 EXPECT_CALL(*command_buffer(), OnFlush())
2695 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
2696 .RetiresOnSaturation();
2698 GLboolean result = gl_->IsVertexArrayOES(1);
2699 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2700 EXPECT_TRUE(result);
2702 // TODO(zmo): Implement unit test for EnableFeatureCHROMIUM
2704 TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) {
2705 struct Cmds {
2706 cmds::ResizeCHROMIUM cmd;
2708 Cmds expected;
2709 expected.cmd.Init(1, 2, 3);
2711 gl_->ResizeCHROMIUM(1, 2, 3);
2712 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2714 // TODO(zmo): Implement unit test for GetRequestableExtensionsCHROMIUM
2715 // TODO(zmo): Implement unit test for CreateStreamTextureCHROMIUM
2716 // TODO(zmo): Implement unit test for GetTranslatedShaderSourceANGLE
2718 TEST_F(GLES2ImplementationTest, TexImageIOSurface2DCHROMIUM) {
2719 struct Cmds {
2720 cmds::TexImageIOSurface2DCHROMIUM cmd;
2722 Cmds expected;
2723 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5);
2725 gl_->TexImageIOSurface2DCHROMIUM(GL_TEXTURE_2D, 2, 3, 4, 5);
2726 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2729 TEST_F(GLES2ImplementationTest, CopyTextureCHROMIUM) {
2730 struct Cmds {
2731 cmds::CopyTextureCHROMIUM cmd;
2733 Cmds expected;
2734 expected.cmd.Init(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE);
2736 gl_->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE);
2737 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2740 TEST_F(GLES2ImplementationTest, DrawArraysInstancedANGLE) {
2741 struct Cmds {
2742 cmds::DrawArraysInstancedANGLE cmd;
2744 Cmds expected;
2745 expected.cmd.Init(GL_POINTS, 2, 3, 4);
2747 gl_->DrawArraysInstancedANGLE(GL_POINTS, 2, 3, 4);
2748 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2751 TEST_F(GLES2ImplementationTest, VertexAttribDivisorANGLE) {
2752 struct Cmds {
2753 cmds::VertexAttribDivisorANGLE cmd;
2755 Cmds expected;
2756 expected.cmd.Init(1, 2);
2758 gl_->VertexAttribDivisorANGLE(1, 2);
2759 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2761 // TODO(zmo): Implement unit test for GenMailboxCHROMIUM
2762 // TODO(zmo): Implement unit test for BindUniformLocationCHROMIUM
2764 TEST_F(GLES2ImplementationTest, GenValuebuffersCHROMIUM) {
2765 GLuint ids[2] = {
2768 struct Cmds {
2769 cmds::GenValuebuffersCHROMIUMImmediate gen;
2770 GLuint data[2];
2772 Cmds expected;
2773 expected.gen.Init(arraysize(ids), &ids[0]);
2774 expected.data[0] = kValuebuffersStartId;
2775 expected.data[1] = kValuebuffersStartId + 1;
2776 gl_->GenValuebuffersCHROMIUM(arraysize(ids), &ids[0]);
2777 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2778 EXPECT_EQ(kValuebuffersStartId, ids[0]);
2779 EXPECT_EQ(kValuebuffersStartId + 1, ids[1]);
2782 TEST_F(GLES2ImplementationTest, DeleteValuebuffersCHROMIUM) {
2783 GLuint ids[2] = {kValuebuffersStartId, kValuebuffersStartId + 1};
2784 struct Cmds {
2785 cmds::DeleteValuebuffersCHROMIUMImmediate del;
2786 GLuint data[2];
2788 Cmds expected;
2789 expected.del.Init(arraysize(ids), &ids[0]);
2790 expected.data[0] = kValuebuffersStartId;
2791 expected.data[1] = kValuebuffersStartId + 1;
2792 gl_->DeleteValuebuffersCHROMIUM(arraysize(ids), &ids[0]);
2793 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2796 TEST_F(GLES2ImplementationTest, IsValuebufferCHROMIUM) {
2797 struct Cmds {
2798 cmds::IsValuebufferCHROMIUM cmd;
2801 Cmds expected;
2802 ExpectedMemoryInfo result1 =
2803 GetExpectedResultMemory(sizeof(cmds::IsValuebufferCHROMIUM::Result));
2804 expected.cmd.Init(1, result1.id, result1.offset);
2806 EXPECT_CALL(*command_buffer(), OnFlush())
2807 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE)))
2808 .RetiresOnSaturation();
2810 GLboolean result = gl_->IsValuebufferCHROMIUM(1);
2811 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2812 EXPECT_TRUE(result);
2815 TEST_F(GLES2ImplementationTest, BindValuebufferCHROMIUM) {
2816 struct Cmds {
2817 cmds::BindValuebufferCHROMIUM cmd;
2819 Cmds expected;
2820 expected.cmd.Init(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM, 2);
2822 gl_->BindValuebufferCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM, 2);
2823 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2824 ClearCommands();
2825 gl_->BindValuebufferCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM, 2);
2826 EXPECT_TRUE(NoCommandsWritten());
2829 TEST_F(GLES2ImplementationTest, SubscribeValueCHROMIUM) {
2830 struct Cmds {
2831 cmds::SubscribeValueCHROMIUM cmd;
2833 Cmds expected;
2834 expected.cmd.Init(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM,
2835 GL_MOUSE_POSITION_CHROMIUM);
2837 gl_->SubscribeValueCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM,
2838 GL_MOUSE_POSITION_CHROMIUM);
2839 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2842 TEST_F(GLES2ImplementationTest, PopulateSubscribedValuesCHROMIUM) {
2843 struct Cmds {
2844 cmds::PopulateSubscribedValuesCHROMIUM cmd;
2846 Cmds expected;
2847 expected.cmd.Init(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM);
2849 gl_->PopulateSubscribedValuesCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM);
2850 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2853 TEST_F(GLES2ImplementationTest, UniformValuebufferCHROMIUM) {
2854 struct Cmds {
2855 cmds::UniformValuebufferCHROMIUM cmd;
2857 Cmds expected;
2858 expected.cmd.Init(1, GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM,
2859 GL_MOUSE_POSITION_CHROMIUM);
2861 gl_->UniformValuebufferCHROMIUM(1, GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM,
2862 GL_MOUSE_POSITION_CHROMIUM);
2863 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2866 TEST_F(GLES2ImplementationTest, BindTexImage2DCHROMIUM) {
2867 struct Cmds {
2868 cmds::BindTexImage2DCHROMIUM cmd;
2870 Cmds expected;
2871 expected.cmd.Init(GL_TEXTURE_2D, 2);
2873 gl_->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, 2);
2874 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2877 TEST_F(GLES2ImplementationTest, ReleaseTexImage2DCHROMIUM) {
2878 struct Cmds {
2879 cmds::ReleaseTexImage2DCHROMIUM cmd;
2881 Cmds expected;
2882 expected.cmd.Init(GL_TEXTURE_2D, 2);
2884 gl_->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, 2);
2885 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2888 TEST_F(GLES2ImplementationTest, DiscardFramebufferEXT) {
2889 GLenum data[2][1] = {{0}};
2890 struct Cmds {
2891 cmds::DiscardFramebufferEXTImmediate cmd;
2892 GLenum data[2][1];
2895 Cmds expected;
2896 for (int ii = 0; ii < 2; ++ii) {
2897 for (int jj = 0; jj < 1; ++jj) {
2898 data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
2901 expected.cmd.Init(1, 2, &data[0][0]);
2902 gl_->DiscardFramebufferEXT(1, 2, &data[0][0]);
2903 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2906 TEST_F(GLES2ImplementationTest, LoseContextCHROMIUM) {
2907 struct Cmds {
2908 cmds::LoseContextCHROMIUM cmd;
2910 Cmds expected;
2911 expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_GUILTY_CONTEXT_RESET_ARB);
2913 gl_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
2914 GL_GUILTY_CONTEXT_RESET_ARB);
2915 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2917 // TODO(zmo): Implement unit test for InsertSyncPointCHROMIUM
2919 TEST_F(GLES2ImplementationTest, WaitSyncPointCHROMIUM) {
2920 struct Cmds {
2921 cmds::WaitSyncPointCHROMIUM cmd;
2923 Cmds expected;
2924 expected.cmd.Init(1);
2926 gl_->WaitSyncPointCHROMIUM(1);
2927 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2930 TEST_F(GLES2ImplementationTest, DrawBuffersEXT) {
2931 GLenum data[1][1] = {{0}};
2932 struct Cmds {
2933 cmds::DrawBuffersEXTImmediate cmd;
2934 GLenum data[1][1];
2937 Cmds expected;
2938 for (int ii = 0; ii < 1; ++ii) {
2939 for (int jj = 0; jj < 1; ++jj) {
2940 data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
2943 expected.cmd.Init(1, &data[0][0]);
2944 gl_->DrawBuffersEXT(1, &data[0][0]);
2945 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2948 TEST_F(GLES2ImplementationTest, DiscardBackbufferCHROMIUM) {
2949 struct Cmds {
2950 cmds::DiscardBackbufferCHROMIUM cmd;
2952 Cmds expected;
2953 expected.cmd.Init();
2955 gl_->DiscardBackbufferCHROMIUM();
2956 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2959 TEST_F(GLES2ImplementationTest, MatrixLoadfCHROMIUM) {
2960 GLfloat data[16] = {0};
2961 struct Cmds {
2962 cmds::MatrixLoadfCHROMIUMImmediate cmd;
2963 GLfloat data[16];
2966 for (int jj = 0; jj < 16; ++jj) {
2967 data[jj] = static_cast<GLfloat>(jj);
2969 Cmds expected;
2970 expected.cmd.Init(GL_PATH_PROJECTION_CHROMIUM, &data[0]);
2971 gl_->MatrixLoadfCHROMIUM(GL_PATH_PROJECTION_CHROMIUM, &data[0]);
2972 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2975 TEST_F(GLES2ImplementationTest, MatrixLoadIdentityCHROMIUM) {
2976 struct Cmds {
2977 cmds::MatrixLoadIdentityCHROMIUM cmd;
2979 Cmds expected;
2980 expected.cmd.Init(GL_PATH_PROJECTION_CHROMIUM);
2982 gl_->MatrixLoadIdentityCHROMIUM(GL_PATH_PROJECTION_CHROMIUM);
2983 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
2985 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_