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
11 // This file is included by gles2_implementation.h to declare the
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
) {
18 cmds::AttachShader cmd
;
21 expected
.cmd
.Init(1, 2);
23 gl_
->AttachShader(1, 2);
24 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
26 // TODO: Implement unit test for BindAttribLocation
28 TEST_F(GLES2ImplementationTest
, BindBuffer
) {
33 expected
.cmd
.Init(GL_ARRAY_BUFFER
, 2);
35 gl_
->BindBuffer(GL_ARRAY_BUFFER
, 2);
36 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
38 gl_
->BindBuffer(GL_ARRAY_BUFFER
, 2);
39 EXPECT_TRUE(NoCommandsWritten());
42 TEST_F(GLES2ImplementationTest
, BindFramebuffer
) {
44 cmds::BindFramebuffer cmd
;
47 expected
.cmd
.Init(GL_FRAMEBUFFER
, 2);
49 gl_
->BindFramebuffer(GL_FRAMEBUFFER
, 2);
50 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
52 gl_
->BindFramebuffer(GL_FRAMEBUFFER
, 2);
53 EXPECT_TRUE(NoCommandsWritten());
56 TEST_F(GLES2ImplementationTest
, BindRenderbuffer
) {
58 cmds::BindRenderbuffer cmd
;
61 expected
.cmd
.Init(GL_RENDERBUFFER
, 2);
63 gl_
->BindRenderbuffer(GL_RENDERBUFFER
, 2);
64 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
66 gl_
->BindRenderbuffer(GL_RENDERBUFFER
, 2);
67 EXPECT_TRUE(NoCommandsWritten());
70 TEST_F(GLES2ImplementationTest
, BlendColor
) {
75 expected
.cmd
.Init(1, 2, 3, 4);
77 gl_
->BlendColor(1, 2, 3, 4);
78 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
81 TEST_F(GLES2ImplementationTest
, BlendEquation
) {
83 cmds::BlendEquation cmd
;
86 expected
.cmd
.Init(GL_FUNC_SUBTRACT
);
88 gl_
->BlendEquation(GL_FUNC_SUBTRACT
);
89 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
92 TEST_F(GLES2ImplementationTest
, BlendEquationSeparate
) {
94 cmds::BlendEquationSeparate cmd
;
97 expected
.cmd
.Init(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
);
99 gl_
->BlendEquationSeparate(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
);
100 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
103 TEST_F(GLES2ImplementationTest
, BlendFunc
) {
108 expected
.cmd
.Init(GL_ZERO
, GL_ZERO
);
110 gl_
->BlendFunc(GL_ZERO
, GL_ZERO
);
111 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
114 TEST_F(GLES2ImplementationTest
, BlendFuncSeparate
) {
116 cmds::BlendFuncSeparate cmd
;
119 expected
.cmd
.Init(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
);
121 gl_
->BlendFuncSeparate(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
);
122 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
125 TEST_F(GLES2ImplementationTest
, CheckFramebufferStatus
) {
127 cmds::CheckFramebufferStatus cmd
;
131 ExpectedMemoryInfo result1
=
132 GetExpectedResultMemory(sizeof(cmds::CheckFramebufferStatus::Result
));
133 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
135 EXPECT_CALL(*command_buffer(), OnFlush())
136 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
137 .RetiresOnSaturation();
139 GLboolean result
= gl_
->CheckFramebufferStatus(1);
140 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
144 TEST_F(GLES2ImplementationTest
, Clear
) {
149 expected
.cmd
.Init(1);
152 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
155 TEST_F(GLES2ImplementationTest
, ClearColor
) {
157 cmds::ClearColor cmd
;
160 expected
.cmd
.Init(1, 2, 3, 4);
162 gl_
->ClearColor(1, 2, 3, 4);
163 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
166 TEST_F(GLES2ImplementationTest
, ClearDepthf
) {
168 cmds::ClearDepthf cmd
;
171 expected
.cmd
.Init(0.5f
);
173 gl_
->ClearDepthf(0.5f
);
174 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
177 TEST_F(GLES2ImplementationTest
, ClearStencil
) {
179 cmds::ClearStencil cmd
;
182 expected
.cmd
.Init(1);
184 gl_
->ClearStencil(1);
185 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
188 TEST_F(GLES2ImplementationTest
, ColorMask
) {
193 expected
.cmd
.Init(true, true, true, true);
195 gl_
->ColorMask(true, true, true, true);
196 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
199 TEST_F(GLES2ImplementationTest
, CompileShader
) {
201 cmds::CompileShader cmd
;
204 expected
.cmd
.Init(1);
206 gl_
->CompileShader(1);
207 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
209 // TODO: Implement unit test for CompressedTexImage2D
210 // TODO: Implement unit test for CompressedTexSubImage2D
212 TEST_F(GLES2ImplementationTest
, CopyTexImage2D
) {
214 cmds::CopyTexImage2D cmd
;
217 expected
.cmd
.Init(GL_TEXTURE_2D
, 2, GL_ALPHA
, 4, 5, 6, 7);
219 gl_
->CopyTexImage2D(GL_TEXTURE_2D
, 2, GL_ALPHA
, 4, 5, 6, 7, 0);
220 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
223 TEST_F(GLES2ImplementationTest
, CopyTexImage2DInvalidConstantArg7
) {
224 gl_
->CopyTexImage2D(GL_TEXTURE_2D
, 2, GL_ALPHA
, 4, 5, 6, 7, 1);
225 EXPECT_TRUE(NoCommandsWritten());
226 EXPECT_EQ(GL_INVALID_VALUE
, CheckError());
229 TEST_F(GLES2ImplementationTest
, CopyTexSubImage2D
) {
231 cmds::CopyTexSubImage2D cmd
;
234 expected
.cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8);
236 gl_
->CopyTexSubImage2D(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8);
237 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
240 TEST_F(GLES2ImplementationTest
, CullFace
) {
245 expected
.cmd
.Init(GL_FRONT
);
247 gl_
->CullFace(GL_FRONT
);
248 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
251 TEST_F(GLES2ImplementationTest
, DeleteBuffers
) {
252 GLuint ids
[2] = {kBuffersStartId
, kBuffersStartId
+ 1};
254 cmds::DeleteBuffersImmediate del
;
258 expected
.del
.Init(arraysize(ids
), &ids
[0]);
259 expected
.data
[0] = kBuffersStartId
;
260 expected
.data
[1] = kBuffersStartId
+ 1;
261 gl_
->DeleteBuffers(arraysize(ids
), &ids
[0]);
262 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
265 TEST_F(GLES2ImplementationTest
, DeleteFramebuffers
) {
266 GLuint ids
[2] = {kFramebuffersStartId
, kFramebuffersStartId
+ 1};
268 cmds::DeleteFramebuffersImmediate del
;
272 expected
.del
.Init(arraysize(ids
), &ids
[0]);
273 expected
.data
[0] = kFramebuffersStartId
;
274 expected
.data
[1] = kFramebuffersStartId
+ 1;
275 gl_
->DeleteFramebuffers(arraysize(ids
), &ids
[0]);
276 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
279 TEST_F(GLES2ImplementationTest
, DeleteProgram
) {
281 cmds::DeleteProgram cmd
;
284 expected
.cmd
.Init(1);
286 gl_
->DeleteProgram(1);
287 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
290 TEST_F(GLES2ImplementationTest
, DeleteRenderbuffers
) {
291 GLuint ids
[2] = {kRenderbuffersStartId
, kRenderbuffersStartId
+ 1};
293 cmds::DeleteRenderbuffersImmediate del
;
297 expected
.del
.Init(arraysize(ids
), &ids
[0]);
298 expected
.data
[0] = kRenderbuffersStartId
;
299 expected
.data
[1] = kRenderbuffersStartId
+ 1;
300 gl_
->DeleteRenderbuffers(arraysize(ids
), &ids
[0]);
301 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
304 TEST_F(GLES2ImplementationTest
, DeleteShader
) {
306 cmds::DeleteShader cmd
;
309 expected
.cmd
.Init(1);
311 gl_
->DeleteShader(1);
312 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
315 TEST_F(GLES2ImplementationTest
, DeleteTextures
) {
316 GLuint ids
[2] = {kTexturesStartId
, kTexturesStartId
+ 1};
318 cmds::DeleteTexturesImmediate del
;
322 expected
.del
.Init(arraysize(ids
), &ids
[0]);
323 expected
.data
[0] = kTexturesStartId
;
324 expected
.data
[1] = kTexturesStartId
+ 1;
325 gl_
->DeleteTextures(arraysize(ids
), &ids
[0]);
326 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
329 TEST_F(GLES2ImplementationTest
, DepthFunc
) {
334 expected
.cmd
.Init(GL_NEVER
);
336 gl_
->DepthFunc(GL_NEVER
);
337 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
340 TEST_F(GLES2ImplementationTest
, DepthMask
) {
345 expected
.cmd
.Init(true);
347 gl_
->DepthMask(true);
348 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
351 TEST_F(GLES2ImplementationTest
, DepthRangef
) {
353 cmds::DepthRangef cmd
;
356 expected
.cmd
.Init(1, 2);
358 gl_
->DepthRangef(1, 2);
359 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
362 TEST_F(GLES2ImplementationTest
, DetachShader
) {
364 cmds::DetachShader cmd
;
367 expected
.cmd
.Init(1, 2);
369 gl_
->DetachShader(1, 2);
370 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
373 TEST_F(GLES2ImplementationTest
, DisableVertexAttribArray
) {
375 cmds::DisableVertexAttribArray cmd
;
378 expected
.cmd
.Init(1);
380 gl_
->DisableVertexAttribArray(1);
381 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
384 TEST_F(GLES2ImplementationTest
, DrawArrays
) {
386 cmds::DrawArrays cmd
;
389 expected
.cmd
.Init(GL_POINTS
, 2, 3);
391 gl_
->DrawArrays(GL_POINTS
, 2, 3);
392 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
395 TEST_F(GLES2ImplementationTest
, EnableVertexAttribArray
) {
397 cmds::EnableVertexAttribArray cmd
;
400 expected
.cmd
.Init(1);
402 gl_
->EnableVertexAttribArray(1);
403 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
406 TEST_F(GLES2ImplementationTest
, Flush
) {
414 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
417 TEST_F(GLES2ImplementationTest
, FramebufferRenderbuffer
) {
419 cmds::FramebufferRenderbuffer cmd
;
422 expected
.cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
, 4);
424 gl_
->FramebufferRenderbuffer(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
426 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
429 TEST_F(GLES2ImplementationTest
, FramebufferTexture2D
) {
431 cmds::FramebufferTexture2D cmd
;
434 expected
.cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, 4);
436 gl_
->FramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
438 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
441 TEST_F(GLES2ImplementationTest
, FramebufferTexture2DInvalidConstantArg4
) {
442 gl_
->FramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
444 EXPECT_TRUE(NoCommandsWritten());
445 EXPECT_EQ(GL_INVALID_VALUE
, CheckError());
448 TEST_F(GLES2ImplementationTest
, FrontFace
) {
453 expected
.cmd
.Init(GL_CW
);
455 gl_
->FrontFace(GL_CW
);
456 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
459 TEST_F(GLES2ImplementationTest
, GenBuffers
) {
464 cmds::GenBuffersImmediate gen
;
468 expected
.gen
.Init(arraysize(ids
), &ids
[0]);
469 expected
.data
[0] = kBuffersStartId
;
470 expected
.data
[1] = kBuffersStartId
+ 1;
471 gl_
->GenBuffers(arraysize(ids
), &ids
[0]);
472 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
473 EXPECT_EQ(kBuffersStartId
, ids
[0]);
474 EXPECT_EQ(kBuffersStartId
+ 1, ids
[1]);
477 TEST_F(GLES2ImplementationTest
, GenerateMipmap
) {
479 cmds::GenerateMipmap cmd
;
482 expected
.cmd
.Init(GL_TEXTURE_2D
);
484 gl_
->GenerateMipmap(GL_TEXTURE_2D
);
485 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
488 TEST_F(GLES2ImplementationTest
, GenFramebuffers
) {
493 cmds::GenFramebuffersImmediate gen
;
497 expected
.gen
.Init(arraysize(ids
), &ids
[0]);
498 expected
.data
[0] = kFramebuffersStartId
;
499 expected
.data
[1] = kFramebuffersStartId
+ 1;
500 gl_
->GenFramebuffers(arraysize(ids
), &ids
[0]);
501 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
502 EXPECT_EQ(kFramebuffersStartId
, ids
[0]);
503 EXPECT_EQ(kFramebuffersStartId
+ 1, ids
[1]);
506 TEST_F(GLES2ImplementationTest
, GenRenderbuffers
) {
511 cmds::GenRenderbuffersImmediate gen
;
515 expected
.gen
.Init(arraysize(ids
), &ids
[0]);
516 expected
.data
[0] = kRenderbuffersStartId
;
517 expected
.data
[1] = kRenderbuffersStartId
+ 1;
518 gl_
->GenRenderbuffers(arraysize(ids
), &ids
[0]);
519 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
520 EXPECT_EQ(kRenderbuffersStartId
, ids
[0]);
521 EXPECT_EQ(kRenderbuffersStartId
+ 1, ids
[1]);
524 TEST_F(GLES2ImplementationTest
, GenTextures
) {
529 cmds::GenTexturesImmediate gen
;
533 expected
.gen
.Init(arraysize(ids
), &ids
[0]);
534 expected
.data
[0] = kTexturesStartId
;
535 expected
.data
[1] = kTexturesStartId
+ 1;
536 gl_
->GenTextures(arraysize(ids
), &ids
[0]);
537 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
538 EXPECT_EQ(kTexturesStartId
, ids
[0]);
539 EXPECT_EQ(kTexturesStartId
+ 1, ids
[1]);
541 // TODO: Implement unit test for GetActiveAttrib
542 // TODO: Implement unit test for GetActiveUniform
543 // TODO: Implement unit test for GetAttachedShaders
544 // TODO: Implement unit test for GetAttribLocation
546 TEST_F(GLES2ImplementationTest
, GetBooleanv
) {
548 cmds::GetBooleanv cmd
;
550 typedef cmds::GetBooleanv::Result Result
;
551 Result::Type result
= 0;
553 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
554 expected
.cmd
.Init(123, result1
.id
, result1
.offset
);
555 EXPECT_CALL(*command_buffer(), OnFlush())
556 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
557 .RetiresOnSaturation();
558 gl_
->GetBooleanv(123, &result
);
559 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
560 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
563 TEST_F(GLES2ImplementationTest
, GetBufferParameteriv
) {
565 cmds::GetBufferParameteriv cmd
;
567 typedef cmds::GetBufferParameteriv::Result Result
;
568 Result::Type result
= 0;
570 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
571 expected
.cmd
.Init(123, GL_BUFFER_SIZE
, result1
.id
, result1
.offset
);
572 EXPECT_CALL(*command_buffer(), OnFlush())
573 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
574 .RetiresOnSaturation();
575 gl_
->GetBufferParameteriv(123, GL_BUFFER_SIZE
, &result
);
576 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
577 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
580 TEST_F(GLES2ImplementationTest
, GetFloatv
) {
584 typedef cmds::GetFloatv::Result Result
;
585 Result::Type result
= 0;
587 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
588 expected
.cmd
.Init(123, result1
.id
, result1
.offset
);
589 EXPECT_CALL(*command_buffer(), OnFlush())
590 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
591 .RetiresOnSaturation();
592 gl_
->GetFloatv(123, &result
);
593 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
594 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
597 TEST_F(GLES2ImplementationTest
, GetFramebufferAttachmentParameteriv
) {
599 cmds::GetFramebufferAttachmentParameteriv cmd
;
601 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
602 Result::Type result
= 0;
604 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
605 expected
.cmd
.Init(123, GL_COLOR_ATTACHMENT0
,
606 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, result1
.id
,
608 EXPECT_CALL(*command_buffer(), OnFlush())
609 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
610 .RetiresOnSaturation();
611 gl_
->GetFramebufferAttachmentParameteriv(
612 123, GL_COLOR_ATTACHMENT0
, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
,
614 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
615 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
618 TEST_F(GLES2ImplementationTest
, GetIntegerv
) {
620 cmds::GetIntegerv cmd
;
622 typedef cmds::GetIntegerv::Result Result
;
623 Result::Type result
= 0;
625 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
626 expected
.cmd
.Init(123, result1
.id
, result1
.offset
);
627 EXPECT_CALL(*command_buffer(), OnFlush())
628 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
629 .RetiresOnSaturation();
630 gl_
->GetIntegerv(123, &result
);
631 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
632 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
635 TEST_F(GLES2ImplementationTest
, GetProgramiv
) {
637 cmds::GetProgramiv cmd
;
639 typedef cmds::GetProgramiv::Result Result
;
640 Result::Type result
= 0;
642 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
643 expected
.cmd
.Init(123, GL_DELETE_STATUS
, result1
.id
, result1
.offset
);
644 EXPECT_CALL(*command_buffer(), OnFlush())
645 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
646 .RetiresOnSaturation();
647 gl_
->GetProgramiv(123, GL_DELETE_STATUS
, &result
);
648 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
649 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
651 // TODO: Implement unit test for GetProgramInfoLog
653 TEST_F(GLES2ImplementationTest
, GetRenderbufferParameteriv
) {
655 cmds::GetRenderbufferParameteriv cmd
;
657 typedef cmds::GetRenderbufferParameteriv::Result Result
;
658 Result::Type result
= 0;
660 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
661 expected
.cmd
.Init(123, GL_RENDERBUFFER_RED_SIZE
, result1
.id
, result1
.offset
);
662 EXPECT_CALL(*command_buffer(), OnFlush())
663 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
664 .RetiresOnSaturation();
665 gl_
->GetRenderbufferParameteriv(123, GL_RENDERBUFFER_RED_SIZE
, &result
);
666 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
667 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
670 TEST_F(GLES2ImplementationTest
, GetShaderiv
) {
672 cmds::GetShaderiv cmd
;
674 typedef cmds::GetShaderiv::Result Result
;
675 Result::Type result
= 0;
677 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
678 expected
.cmd
.Init(123, GL_SHADER_TYPE
, result1
.id
, result1
.offset
);
679 EXPECT_CALL(*command_buffer(), OnFlush())
680 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
681 .RetiresOnSaturation();
682 gl_
->GetShaderiv(123, GL_SHADER_TYPE
, &result
);
683 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
684 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
686 // TODO: Implement unit test for GetShaderInfoLog
687 // TODO: Implement unit test for GetShaderPrecisionFormat
689 TEST_F(GLES2ImplementationTest
, GetTexParameterfv
) {
691 cmds::GetTexParameterfv cmd
;
693 typedef cmds::GetTexParameterfv::Result Result
;
694 Result::Type result
= 0;
696 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
697 expected
.cmd
.Init(123, GL_TEXTURE_MAG_FILTER
, result1
.id
, result1
.offset
);
698 EXPECT_CALL(*command_buffer(), OnFlush())
699 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
700 .RetiresOnSaturation();
701 gl_
->GetTexParameterfv(123, GL_TEXTURE_MAG_FILTER
, &result
);
702 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
703 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
706 TEST_F(GLES2ImplementationTest
, GetTexParameteriv
) {
708 cmds::GetTexParameteriv cmd
;
710 typedef cmds::GetTexParameteriv::Result Result
;
711 Result::Type result
= 0;
713 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
714 expected
.cmd
.Init(123, GL_TEXTURE_MAG_FILTER
, result1
.id
, result1
.offset
);
715 EXPECT_CALL(*command_buffer(), OnFlush())
716 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
717 .RetiresOnSaturation();
718 gl_
->GetTexParameteriv(123, GL_TEXTURE_MAG_FILTER
, &result
);
719 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
720 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
722 // TODO: Implement unit test for GetUniformfv
723 // TODO: Implement unit test for GetUniformiv
724 // TODO: Implement unit test for GetUniformLocation
726 TEST_F(GLES2ImplementationTest
, GetVertexAttribfv
) {
728 cmds::GetVertexAttribfv cmd
;
730 typedef cmds::GetVertexAttribfv::Result Result
;
731 Result::Type result
= 0;
733 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
734 expected
.cmd
.Init(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, result1
.id
,
736 EXPECT_CALL(*command_buffer(), OnFlush())
737 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
738 .RetiresOnSaturation();
739 gl_
->GetVertexAttribfv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, &result
);
740 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
741 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
744 TEST_F(GLES2ImplementationTest
, GetVertexAttribiv
) {
746 cmds::GetVertexAttribiv cmd
;
748 typedef cmds::GetVertexAttribiv::Result Result
;
749 Result::Type result
= 0;
751 ExpectedMemoryInfo result1
= GetExpectedResultMemory(4);
752 expected
.cmd
.Init(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, result1
.id
,
754 EXPECT_CALL(*command_buffer(), OnFlush())
755 .WillOnce(SetMemory(result1
.ptr
, SizedResultHelper
<Result::Type
>(1)))
756 .RetiresOnSaturation();
757 gl_
->GetVertexAttribiv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, &result
);
758 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
759 EXPECT_EQ(static_cast<Result::Type
>(1), result
);
762 TEST_F(GLES2ImplementationTest
, Hint
) {
767 expected
.cmd
.Init(GL_GENERATE_MIPMAP_HINT
, GL_FASTEST
);
769 gl_
->Hint(GL_GENERATE_MIPMAP_HINT
, GL_FASTEST
);
770 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
773 TEST_F(GLES2ImplementationTest
, IsBuffer
) {
779 ExpectedMemoryInfo result1
=
780 GetExpectedResultMemory(sizeof(cmds::IsBuffer::Result
));
781 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
783 EXPECT_CALL(*command_buffer(), OnFlush())
784 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
785 .RetiresOnSaturation();
787 GLboolean result
= gl_
->IsBuffer(1);
788 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
792 TEST_F(GLES2ImplementationTest
, IsEnabled
) {
798 ExpectedMemoryInfo result1
=
799 GetExpectedResultMemory(sizeof(cmds::IsEnabled::Result
));
800 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
802 EXPECT_CALL(*command_buffer(), OnFlush())
803 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
804 .RetiresOnSaturation();
806 GLboolean result
= gl_
->IsEnabled(1);
807 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
811 TEST_F(GLES2ImplementationTest
, IsFramebuffer
) {
813 cmds::IsFramebuffer cmd
;
817 ExpectedMemoryInfo result1
=
818 GetExpectedResultMemory(sizeof(cmds::IsFramebuffer::Result
));
819 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
821 EXPECT_CALL(*command_buffer(), OnFlush())
822 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
823 .RetiresOnSaturation();
825 GLboolean result
= gl_
->IsFramebuffer(1);
826 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
830 TEST_F(GLES2ImplementationTest
, IsProgram
) {
836 ExpectedMemoryInfo result1
=
837 GetExpectedResultMemory(sizeof(cmds::IsProgram::Result
));
838 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
840 EXPECT_CALL(*command_buffer(), OnFlush())
841 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
842 .RetiresOnSaturation();
844 GLboolean result
= gl_
->IsProgram(1);
845 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
849 TEST_F(GLES2ImplementationTest
, IsRenderbuffer
) {
851 cmds::IsRenderbuffer cmd
;
855 ExpectedMemoryInfo result1
=
856 GetExpectedResultMemory(sizeof(cmds::IsRenderbuffer::Result
));
857 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
859 EXPECT_CALL(*command_buffer(), OnFlush())
860 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
861 .RetiresOnSaturation();
863 GLboolean result
= gl_
->IsRenderbuffer(1);
864 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
868 TEST_F(GLES2ImplementationTest
, IsShader
) {
874 ExpectedMemoryInfo result1
=
875 GetExpectedResultMemory(sizeof(cmds::IsShader::Result
));
876 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
878 EXPECT_CALL(*command_buffer(), OnFlush())
879 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
880 .RetiresOnSaturation();
882 GLboolean result
= gl_
->IsShader(1);
883 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
887 TEST_F(GLES2ImplementationTest
, IsTexture
) {
893 ExpectedMemoryInfo result1
=
894 GetExpectedResultMemory(sizeof(cmds::IsTexture::Result
));
895 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
897 EXPECT_CALL(*command_buffer(), OnFlush())
898 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
899 .RetiresOnSaturation();
901 GLboolean result
= gl_
->IsTexture(1);
902 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
906 TEST_F(GLES2ImplementationTest
, LineWidth
) {
911 expected
.cmd
.Init(0.5f
);
913 gl_
->LineWidth(0.5f
);
914 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
917 TEST_F(GLES2ImplementationTest
, LinkProgram
) {
919 cmds::LinkProgram cmd
;
922 expected
.cmd
.Init(1);
925 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
928 TEST_F(GLES2ImplementationTest
, PixelStorei
) {
930 cmds::PixelStorei cmd
;
933 expected
.cmd
.Init(GL_PACK_ALIGNMENT
, 1);
935 gl_
->PixelStorei(GL_PACK_ALIGNMENT
, 1);
936 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
939 TEST_F(GLES2ImplementationTest
, PolygonOffset
) {
941 cmds::PolygonOffset cmd
;
944 expected
.cmd
.Init(1, 2);
946 gl_
->PolygonOffset(1, 2);
947 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
950 TEST_F(GLES2ImplementationTest
, ReleaseShaderCompiler
) {
952 cmds::ReleaseShaderCompiler cmd
;
957 gl_
->ReleaseShaderCompiler();
958 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
961 TEST_F(GLES2ImplementationTest
, RenderbufferStorage
) {
963 cmds::RenderbufferStorage cmd
;
966 expected
.cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, 3, 4);
968 gl_
->RenderbufferStorage(GL_RENDERBUFFER
, GL_RGBA4
, 3, 4);
969 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
972 TEST_F(GLES2ImplementationTest
, SampleCoverage
) {
974 cmds::SampleCoverage cmd
;
977 expected
.cmd
.Init(1, true);
979 gl_
->SampleCoverage(1, true);
980 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
983 TEST_F(GLES2ImplementationTest
, Scissor
) {
988 expected
.cmd
.Init(1, 2, 3, 4);
990 gl_
->Scissor(1, 2, 3, 4);
991 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
994 TEST_F(GLES2ImplementationTest
, StencilFunc
) {
996 cmds::StencilFunc cmd
;
999 expected
.cmd
.Init(GL_NEVER
, 2, 3);
1001 gl_
->StencilFunc(GL_NEVER
, 2, 3);
1002 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1005 TEST_F(GLES2ImplementationTest
, StencilFuncSeparate
) {
1007 cmds::StencilFuncSeparate cmd
;
1010 expected
.cmd
.Init(GL_FRONT
, GL_NEVER
, 3, 4);
1012 gl_
->StencilFuncSeparate(GL_FRONT
, GL_NEVER
, 3, 4);
1013 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1016 TEST_F(GLES2ImplementationTest
, StencilMask
) {
1018 cmds::StencilMask cmd
;
1021 expected
.cmd
.Init(1);
1023 gl_
->StencilMask(1);
1024 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1027 TEST_F(GLES2ImplementationTest
, StencilMaskSeparate
) {
1029 cmds::StencilMaskSeparate cmd
;
1032 expected
.cmd
.Init(GL_FRONT
, 2);
1034 gl_
->StencilMaskSeparate(GL_FRONT
, 2);
1035 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1038 TEST_F(GLES2ImplementationTest
, StencilOp
) {
1040 cmds::StencilOp cmd
;
1043 expected
.cmd
.Init(GL_KEEP
, GL_INCR
, GL_KEEP
);
1045 gl_
->StencilOp(GL_KEEP
, GL_INCR
, GL_KEEP
);
1046 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1049 TEST_F(GLES2ImplementationTest
, StencilOpSeparate
) {
1051 cmds::StencilOpSeparate cmd
;
1054 expected
.cmd
.Init(GL_FRONT
, GL_INCR
, GL_KEEP
, GL_KEEP
);
1056 gl_
->StencilOpSeparate(GL_FRONT
, GL_INCR
, GL_KEEP
, GL_KEEP
);
1057 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1060 TEST_F(GLES2ImplementationTest
, TexParameterf
) {
1062 cmds::TexParameterf cmd
;
1065 expected
.cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
1067 gl_
->TexParameterf(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
1068 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1071 TEST_F(GLES2ImplementationTest
, TexParameterfv
) {
1072 GLfloat data
[1] = {0};
1074 cmds::TexParameterfvImmediate cmd
;
1078 for (int jj
= 0; jj
< 1; ++jj
) {
1079 data
[jj
] = static_cast<GLfloat
>(jj
);
1082 expected
.cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, &data
[0]);
1083 gl_
->TexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, &data
[0]);
1084 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1087 TEST_F(GLES2ImplementationTest
, TexParameteri
) {
1089 cmds::TexParameteri cmd
;
1092 expected
.cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
1094 gl_
->TexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
1095 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1098 TEST_F(GLES2ImplementationTest
, TexParameteriv
) {
1099 GLint data
[1] = {0};
1101 cmds::TexParameterivImmediate cmd
;
1105 for (int jj
= 0; jj
< 1; ++jj
) {
1106 data
[jj
] = static_cast<GLint
>(jj
);
1109 expected
.cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, &data
[0]);
1110 gl_
->TexParameteriv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, &data
[0]);
1111 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1114 TEST_F(GLES2ImplementationTest
, Uniform1f
) {
1116 cmds::Uniform1f cmd
;
1119 expected
.cmd
.Init(1, 2);
1121 gl_
->Uniform1f(1, 2);
1122 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1125 TEST_F(GLES2ImplementationTest
, Uniform1fv
) {
1126 GLfloat data
[2][1] = {{0}};
1128 cmds::Uniform1fvImmediate cmd
;
1133 for (int ii
= 0; ii
< 2; ++ii
) {
1134 for (int jj
= 0; jj
< 1; ++jj
) {
1135 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 1 + jj
);
1138 expected
.cmd
.Init(1, 2, &data
[0][0]);
1139 gl_
->Uniform1fv(1, 2, &data
[0][0]);
1140 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1143 TEST_F(GLES2ImplementationTest
, Uniform1i
) {
1145 cmds::Uniform1i cmd
;
1148 expected
.cmd
.Init(1, 2);
1150 gl_
->Uniform1i(1, 2);
1151 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1154 TEST_F(GLES2ImplementationTest
, Uniform1iv
) {
1155 GLint data
[2][1] = {{0}};
1157 cmds::Uniform1ivImmediate cmd
;
1162 for (int ii
= 0; ii
< 2; ++ii
) {
1163 for (int jj
= 0; jj
< 1; ++jj
) {
1164 data
[ii
][jj
] = static_cast<GLint
>(ii
* 1 + jj
);
1167 expected
.cmd
.Init(1, 2, &data
[0][0]);
1168 gl_
->Uniform1iv(1, 2, &data
[0][0]);
1169 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1172 TEST_F(GLES2ImplementationTest
, Uniform2f
) {
1174 cmds::Uniform2f cmd
;
1177 expected
.cmd
.Init(1, 2, 3);
1179 gl_
->Uniform2f(1, 2, 3);
1180 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1183 TEST_F(GLES2ImplementationTest
, Uniform2fv
) {
1184 GLfloat data
[2][2] = {{0}};
1186 cmds::Uniform2fvImmediate cmd
;
1191 for (int ii
= 0; ii
< 2; ++ii
) {
1192 for (int jj
= 0; jj
< 2; ++jj
) {
1193 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 2 + jj
);
1196 expected
.cmd
.Init(1, 2, &data
[0][0]);
1197 gl_
->Uniform2fv(1, 2, &data
[0][0]);
1198 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1201 TEST_F(GLES2ImplementationTest
, Uniform2i
) {
1203 cmds::Uniform2i cmd
;
1206 expected
.cmd
.Init(1, 2, 3);
1208 gl_
->Uniform2i(1, 2, 3);
1209 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1212 TEST_F(GLES2ImplementationTest
, Uniform2iv
) {
1213 GLint data
[2][2] = {{0}};
1215 cmds::Uniform2ivImmediate cmd
;
1220 for (int ii
= 0; ii
< 2; ++ii
) {
1221 for (int jj
= 0; jj
< 2; ++jj
) {
1222 data
[ii
][jj
] = static_cast<GLint
>(ii
* 2 + jj
);
1225 expected
.cmd
.Init(1, 2, &data
[0][0]);
1226 gl_
->Uniform2iv(1, 2, &data
[0][0]);
1227 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1230 TEST_F(GLES2ImplementationTest
, Uniform3f
) {
1232 cmds::Uniform3f cmd
;
1235 expected
.cmd
.Init(1, 2, 3, 4);
1237 gl_
->Uniform3f(1, 2, 3, 4);
1238 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1241 TEST_F(GLES2ImplementationTest
, Uniform3fv
) {
1242 GLfloat data
[2][3] = {{0}};
1244 cmds::Uniform3fvImmediate cmd
;
1249 for (int ii
= 0; ii
< 2; ++ii
) {
1250 for (int jj
= 0; jj
< 3; ++jj
) {
1251 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 3 + jj
);
1254 expected
.cmd
.Init(1, 2, &data
[0][0]);
1255 gl_
->Uniform3fv(1, 2, &data
[0][0]);
1256 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1259 TEST_F(GLES2ImplementationTest
, Uniform3i
) {
1261 cmds::Uniform3i cmd
;
1264 expected
.cmd
.Init(1, 2, 3, 4);
1266 gl_
->Uniform3i(1, 2, 3, 4);
1267 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1270 TEST_F(GLES2ImplementationTest
, Uniform3iv
) {
1271 GLint data
[2][3] = {{0}};
1273 cmds::Uniform3ivImmediate cmd
;
1278 for (int ii
= 0; ii
< 2; ++ii
) {
1279 for (int jj
= 0; jj
< 3; ++jj
) {
1280 data
[ii
][jj
] = static_cast<GLint
>(ii
* 3 + jj
);
1283 expected
.cmd
.Init(1, 2, &data
[0][0]);
1284 gl_
->Uniform3iv(1, 2, &data
[0][0]);
1285 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1288 TEST_F(GLES2ImplementationTest
, Uniform4f
) {
1290 cmds::Uniform4f cmd
;
1293 expected
.cmd
.Init(1, 2, 3, 4, 5);
1295 gl_
->Uniform4f(1, 2, 3, 4, 5);
1296 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1299 TEST_F(GLES2ImplementationTest
, Uniform4fv
) {
1300 GLfloat data
[2][4] = {{0}};
1302 cmds::Uniform4fvImmediate cmd
;
1307 for (int ii
= 0; ii
< 2; ++ii
) {
1308 for (int jj
= 0; jj
< 4; ++jj
) {
1309 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 4 + jj
);
1312 expected
.cmd
.Init(1, 2, &data
[0][0]);
1313 gl_
->Uniform4fv(1, 2, &data
[0][0]);
1314 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1317 TEST_F(GLES2ImplementationTest
, Uniform4i
) {
1319 cmds::Uniform4i cmd
;
1322 expected
.cmd
.Init(1, 2, 3, 4, 5);
1324 gl_
->Uniform4i(1, 2, 3, 4, 5);
1325 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1328 TEST_F(GLES2ImplementationTest
, Uniform4iv
) {
1329 GLint data
[2][4] = {{0}};
1331 cmds::Uniform4ivImmediate cmd
;
1336 for (int ii
= 0; ii
< 2; ++ii
) {
1337 for (int jj
= 0; jj
< 4; ++jj
) {
1338 data
[ii
][jj
] = static_cast<GLint
>(ii
* 4 + jj
);
1341 expected
.cmd
.Init(1, 2, &data
[0][0]);
1342 gl_
->Uniform4iv(1, 2, &data
[0][0]);
1343 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1346 TEST_F(GLES2ImplementationTest
, UniformMatrix2fv
) {
1347 GLfloat data
[2][4] = {{0}};
1349 cmds::UniformMatrix2fvImmediate cmd
;
1354 for (int ii
= 0; ii
< 2; ++ii
) {
1355 for (int jj
= 0; jj
< 4; ++jj
) {
1356 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 4 + jj
);
1359 expected
.cmd
.Init(1, 2, &data
[0][0]);
1360 gl_
->UniformMatrix2fv(1, 2, false, &data
[0][0]);
1361 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1364 TEST_F(GLES2ImplementationTest
, UniformMatrix2fvInvalidConstantArg2
) {
1365 GLfloat data
[2][4] = {{0}};
1366 for (int ii
= 0; ii
< 2; ++ii
) {
1367 for (int jj
= 0; jj
< 4; ++jj
) {
1368 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 4 + jj
);
1371 gl_
->UniformMatrix2fv(1, 2, true, &data
[0][0]);
1372 EXPECT_TRUE(NoCommandsWritten());
1373 EXPECT_EQ(GL_INVALID_VALUE
, CheckError());
1376 TEST_F(GLES2ImplementationTest
, UniformMatrix3fv
) {
1377 GLfloat data
[2][9] = {{0}};
1379 cmds::UniformMatrix3fvImmediate cmd
;
1384 for (int ii
= 0; ii
< 2; ++ii
) {
1385 for (int jj
= 0; jj
< 9; ++jj
) {
1386 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 9 + jj
);
1389 expected
.cmd
.Init(1, 2, &data
[0][0]);
1390 gl_
->UniformMatrix3fv(1, 2, false, &data
[0][0]);
1391 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1394 TEST_F(GLES2ImplementationTest
, UniformMatrix3fvInvalidConstantArg2
) {
1395 GLfloat data
[2][9] = {{0}};
1396 for (int ii
= 0; ii
< 2; ++ii
) {
1397 for (int jj
= 0; jj
< 9; ++jj
) {
1398 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 9 + jj
);
1401 gl_
->UniformMatrix3fv(1, 2, true, &data
[0][0]);
1402 EXPECT_TRUE(NoCommandsWritten());
1403 EXPECT_EQ(GL_INVALID_VALUE
, CheckError());
1406 TEST_F(GLES2ImplementationTest
, UniformMatrix4fv
) {
1407 GLfloat data
[2][16] = {{0}};
1409 cmds::UniformMatrix4fvImmediate cmd
;
1410 GLfloat data
[2][16];
1414 for (int ii
= 0; ii
< 2; ++ii
) {
1415 for (int jj
= 0; jj
< 16; ++jj
) {
1416 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 16 + jj
);
1419 expected
.cmd
.Init(1, 2, &data
[0][0]);
1420 gl_
->UniformMatrix4fv(1, 2, false, &data
[0][0]);
1421 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1424 TEST_F(GLES2ImplementationTest
, UniformMatrix4fvInvalidConstantArg2
) {
1425 GLfloat data
[2][16] = {{0}};
1426 for (int ii
= 0; ii
< 2; ++ii
) {
1427 for (int jj
= 0; jj
< 16; ++jj
) {
1428 data
[ii
][jj
] = static_cast<GLfloat
>(ii
* 16 + jj
);
1431 gl_
->UniformMatrix4fv(1, 2, true, &data
[0][0]);
1432 EXPECT_TRUE(NoCommandsWritten());
1433 EXPECT_EQ(GL_INVALID_VALUE
, CheckError());
1436 TEST_F(GLES2ImplementationTest
, UseProgram
) {
1438 cmds::UseProgram cmd
;
1441 expected
.cmd
.Init(1);
1444 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1447 EXPECT_TRUE(NoCommandsWritten());
1450 TEST_F(GLES2ImplementationTest
, ValidateProgram
) {
1452 cmds::ValidateProgram cmd
;
1455 expected
.cmd
.Init(1);
1457 gl_
->ValidateProgram(1);
1458 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1461 TEST_F(GLES2ImplementationTest
, VertexAttrib1f
) {
1463 cmds::VertexAttrib1f cmd
;
1466 expected
.cmd
.Init(1, 2);
1468 gl_
->VertexAttrib1f(1, 2);
1469 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1472 TEST_F(GLES2ImplementationTest
, VertexAttrib1fv
) {
1473 GLfloat data
[1] = {0};
1475 cmds::VertexAttrib1fvImmediate cmd
;
1479 for (int jj
= 0; jj
< 1; ++jj
) {
1480 data
[jj
] = static_cast<GLfloat
>(jj
);
1483 expected
.cmd
.Init(1, &data
[0]);
1484 gl_
->VertexAttrib1fv(1, &data
[0]);
1485 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1488 TEST_F(GLES2ImplementationTest
, VertexAttrib2f
) {
1490 cmds::VertexAttrib2f cmd
;
1493 expected
.cmd
.Init(1, 2, 3);
1495 gl_
->VertexAttrib2f(1, 2, 3);
1496 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1499 TEST_F(GLES2ImplementationTest
, VertexAttrib2fv
) {
1500 GLfloat data
[2] = {0};
1502 cmds::VertexAttrib2fvImmediate cmd
;
1506 for (int jj
= 0; jj
< 2; ++jj
) {
1507 data
[jj
] = static_cast<GLfloat
>(jj
);
1510 expected
.cmd
.Init(1, &data
[0]);
1511 gl_
->VertexAttrib2fv(1, &data
[0]);
1512 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1515 TEST_F(GLES2ImplementationTest
, VertexAttrib3f
) {
1517 cmds::VertexAttrib3f cmd
;
1520 expected
.cmd
.Init(1, 2, 3, 4);
1522 gl_
->VertexAttrib3f(1, 2, 3, 4);
1523 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1526 TEST_F(GLES2ImplementationTest
, VertexAttrib3fv
) {
1527 GLfloat data
[3] = {0};
1529 cmds::VertexAttrib3fvImmediate cmd
;
1533 for (int jj
= 0; jj
< 3; ++jj
) {
1534 data
[jj
] = static_cast<GLfloat
>(jj
);
1537 expected
.cmd
.Init(1, &data
[0]);
1538 gl_
->VertexAttrib3fv(1, &data
[0]);
1539 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1542 TEST_F(GLES2ImplementationTest
, VertexAttrib4f
) {
1544 cmds::VertexAttrib4f cmd
;
1547 expected
.cmd
.Init(1, 2, 3, 4, 5);
1549 gl_
->VertexAttrib4f(1, 2, 3, 4, 5);
1550 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1553 TEST_F(GLES2ImplementationTest
, VertexAttrib4fv
) {
1554 GLfloat data
[4] = {0};
1556 cmds::VertexAttrib4fvImmediate cmd
;
1560 for (int jj
= 0; jj
< 4; ++jj
) {
1561 data
[jj
] = static_cast<GLfloat
>(jj
);
1564 expected
.cmd
.Init(1, &data
[0]);
1565 gl_
->VertexAttrib4fv(1, &data
[0]);
1566 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1569 TEST_F(GLES2ImplementationTest
, Viewport
) {
1574 expected
.cmd
.Init(1, 2, 3, 4);
1576 gl_
->Viewport(1, 2, 3, 4);
1577 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1580 TEST_F(GLES2ImplementationTest
, BlitFramebufferCHROMIUM
) {
1582 cmds::BlitFramebufferCHROMIUM cmd
;
1585 expected
.cmd
.Init(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST
);
1587 gl_
->BlitFramebufferCHROMIUM(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST
);
1588 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1591 TEST_F(GLES2ImplementationTest
, RenderbufferStorageMultisampleCHROMIUM
) {
1593 cmds::RenderbufferStorageMultisampleCHROMIUM cmd
;
1596 expected
.cmd
.Init(GL_RENDERBUFFER
, 2, GL_RGBA4
, 4, 5);
1598 gl_
->RenderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER
, 2, GL_RGBA4
, 4,
1600 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1603 TEST_F(GLES2ImplementationTest
, RenderbufferStorageMultisampleEXT
) {
1605 cmds::RenderbufferStorageMultisampleEXT cmd
;
1608 expected
.cmd
.Init(GL_RENDERBUFFER
, 2, GL_RGBA4
, 4, 5);
1610 gl_
->RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER
, 2, GL_RGBA4
, 4, 5);
1611 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1614 TEST_F(GLES2ImplementationTest
, FramebufferTexture2DMultisampleEXT
) {
1616 cmds::FramebufferTexture2DMultisampleEXT cmd
;
1619 expected
.cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, 4, 6);
1621 gl_
->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1622 GL_TEXTURE_2D
, 4, 0, 6);
1623 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1626 TEST_F(GLES2ImplementationTest
,
1627 FramebufferTexture2DMultisampleEXTInvalidConstantArg4
) {
1628 gl_
->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1629 GL_TEXTURE_2D
, 4, 1, 6);
1630 EXPECT_TRUE(NoCommandsWritten());
1631 EXPECT_EQ(GL_INVALID_VALUE
, CheckError());
1634 TEST_F(GLES2ImplementationTest
, TexStorage2DEXT
) {
1636 cmds::TexStorage2DEXT cmd
;
1639 expected
.cmd
.Init(GL_TEXTURE_2D
, 2, GL_RGB565
, 4, 5);
1641 gl_
->TexStorage2DEXT(GL_TEXTURE_2D
, 2, GL_RGB565
, 4, 5);
1642 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1645 TEST_F(GLES2ImplementationTest
, GenQueriesEXT
) {
1650 cmds::GenQueriesEXTImmediate gen
;
1654 expected
.gen
.Init(arraysize(ids
), &ids
[0]);
1655 expected
.data
[0] = kQueriesStartId
;
1656 expected
.data
[1] = kQueriesStartId
+ 1;
1657 gl_
->GenQueriesEXT(arraysize(ids
), &ids
[0]);
1658 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1659 EXPECT_EQ(kQueriesStartId
, ids
[0]);
1660 EXPECT_EQ(kQueriesStartId
+ 1, ids
[1]);
1663 TEST_F(GLES2ImplementationTest
, DeleteQueriesEXT
) {
1664 GLuint ids
[2] = {kQueriesStartId
, kQueriesStartId
+ 1};
1666 cmds::DeleteQueriesEXTImmediate del
;
1670 expected
.del
.Init(arraysize(ids
), &ids
[0]);
1671 expected
.data
[0] = kQueriesStartId
;
1672 expected
.data
[1] = kQueriesStartId
+ 1;
1673 gl_
->DeleteQueriesEXT(arraysize(ids
), &ids
[0]);
1674 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1676 // TODO: Implement unit test for BeginQueryEXT
1677 // TODO: Implement unit test for InsertEventMarkerEXT
1678 // TODO: Implement unit test for PushGroupMarkerEXT
1680 TEST_F(GLES2ImplementationTest
, PopGroupMarkerEXT
) {
1682 cmds::PopGroupMarkerEXT cmd
;
1685 expected
.cmd
.Init();
1687 gl_
->PopGroupMarkerEXT();
1688 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1691 TEST_F(GLES2ImplementationTest
, GenVertexArraysOES
) {
1696 cmds::GenVertexArraysOESImmediate gen
;
1700 expected
.gen
.Init(arraysize(ids
), &ids
[0]);
1701 expected
.data
[0] = kVertexArraysStartId
;
1702 expected
.data
[1] = kVertexArraysStartId
+ 1;
1703 gl_
->GenVertexArraysOES(arraysize(ids
), &ids
[0]);
1704 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1705 EXPECT_EQ(kVertexArraysStartId
, ids
[0]);
1706 EXPECT_EQ(kVertexArraysStartId
+ 1, ids
[1]);
1709 TEST_F(GLES2ImplementationTest
, DeleteVertexArraysOES
) {
1710 GLuint ids
[2] = {kVertexArraysStartId
, kVertexArraysStartId
+ 1};
1712 cmds::DeleteVertexArraysOESImmediate del
;
1716 expected
.del
.Init(arraysize(ids
), &ids
[0]);
1717 expected
.data
[0] = kVertexArraysStartId
;
1718 expected
.data
[1] = kVertexArraysStartId
+ 1;
1719 gl_
->DeleteVertexArraysOES(arraysize(ids
), &ids
[0]);
1720 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1723 TEST_F(GLES2ImplementationTest
, IsVertexArrayOES
) {
1725 cmds::IsVertexArrayOES cmd
;
1729 ExpectedMemoryInfo result1
=
1730 GetExpectedResultMemory(sizeof(cmds::IsVertexArrayOES::Result
));
1731 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
1733 EXPECT_CALL(*command_buffer(), OnFlush())
1734 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
1735 .RetiresOnSaturation();
1737 GLboolean result
= gl_
->IsVertexArrayOES(1);
1738 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1739 EXPECT_TRUE(result
);
1741 // TODO: Implement unit test for EnableFeatureCHROMIUM
1743 TEST_F(GLES2ImplementationTest
, ResizeCHROMIUM
) {
1745 cmds::ResizeCHROMIUM cmd
;
1748 expected
.cmd
.Init(1, 2, 3);
1750 gl_
->ResizeCHROMIUM(1, 2, 3);
1751 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1753 // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM
1754 // TODO: Implement unit test for CreateStreamTextureCHROMIUM
1755 // TODO: Implement unit test for GetTranslatedShaderSourceANGLE
1757 TEST_F(GLES2ImplementationTest
, TexImageIOSurface2DCHROMIUM
) {
1759 cmds::TexImageIOSurface2DCHROMIUM cmd
;
1762 expected
.cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5);
1764 gl_
->TexImageIOSurface2DCHROMIUM(GL_TEXTURE_2D
, 2, 3, 4, 5);
1765 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1768 TEST_F(GLES2ImplementationTest
, CopyTextureCHROMIUM
) {
1770 cmds::CopyTextureCHROMIUM cmd
;
1773 expected
.cmd
.Init(1, 2, 3, 4, GL_ALPHA
, GL_UNSIGNED_BYTE
);
1775 gl_
->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA
, GL_UNSIGNED_BYTE
);
1776 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1779 TEST_F(GLES2ImplementationTest
, DrawArraysInstancedANGLE
) {
1781 cmds::DrawArraysInstancedANGLE cmd
;
1784 expected
.cmd
.Init(GL_POINTS
, 2, 3, 4);
1786 gl_
->DrawArraysInstancedANGLE(GL_POINTS
, 2, 3, 4);
1787 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1790 TEST_F(GLES2ImplementationTest
, VertexAttribDivisorANGLE
) {
1792 cmds::VertexAttribDivisorANGLE cmd
;
1795 expected
.cmd
.Init(1, 2);
1797 gl_
->VertexAttribDivisorANGLE(1, 2);
1798 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1800 // TODO: Implement unit test for GenMailboxCHROMIUM
1801 // TODO: Implement unit test for BindUniformLocationCHROMIUM
1803 TEST_F(GLES2ImplementationTest
, GenValuebuffersCHROMIUM
) {
1808 cmds::GenValuebuffersCHROMIUMImmediate gen
;
1812 expected
.gen
.Init(arraysize(ids
), &ids
[0]);
1813 expected
.data
[0] = kValuebuffersStartId
;
1814 expected
.data
[1] = kValuebuffersStartId
+ 1;
1815 gl_
->GenValuebuffersCHROMIUM(arraysize(ids
), &ids
[0]);
1816 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1817 EXPECT_EQ(kValuebuffersStartId
, ids
[0]);
1818 EXPECT_EQ(kValuebuffersStartId
+ 1, ids
[1]);
1821 TEST_F(GLES2ImplementationTest
, DeleteValuebuffersCHROMIUM
) {
1822 GLuint ids
[2] = {kValuebuffersStartId
, kValuebuffersStartId
+ 1};
1824 cmds::DeleteValuebuffersCHROMIUMImmediate del
;
1828 expected
.del
.Init(arraysize(ids
), &ids
[0]);
1829 expected
.data
[0] = kValuebuffersStartId
;
1830 expected
.data
[1] = kValuebuffersStartId
+ 1;
1831 gl_
->DeleteValuebuffersCHROMIUM(arraysize(ids
), &ids
[0]);
1832 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1835 TEST_F(GLES2ImplementationTest
, IsValuebufferCHROMIUM
) {
1837 cmds::IsValuebufferCHROMIUM cmd
;
1841 ExpectedMemoryInfo result1
=
1842 GetExpectedResultMemory(sizeof(cmds::IsValuebufferCHROMIUM::Result
));
1843 expected
.cmd
.Init(1, result1
.id
, result1
.offset
);
1845 EXPECT_CALL(*command_buffer(), OnFlush())
1846 .WillOnce(SetMemory(result1
.ptr
, uint32_t(1)))
1847 .RetiresOnSaturation();
1849 GLboolean result
= gl_
->IsValuebufferCHROMIUM(1);
1850 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1851 EXPECT_TRUE(result
);
1854 TEST_F(GLES2ImplementationTest
, BindValuebufferCHROMIUM
) {
1856 cmds::BindValuebufferCHROMIUM cmd
;
1859 expected
.cmd
.Init(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
, 2);
1861 gl_
->BindValuebufferCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
, 2);
1862 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1864 gl_
->BindValuebufferCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
, 2);
1865 EXPECT_TRUE(NoCommandsWritten());
1868 TEST_F(GLES2ImplementationTest
, SubscribeValueCHROMIUM
) {
1870 cmds::SubscribeValueCHROMIUM cmd
;
1873 expected
.cmd
.Init(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
,
1874 GL_MOUSE_POSITION_CHROMIUM
);
1876 gl_
->SubscribeValueCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
,
1877 GL_MOUSE_POSITION_CHROMIUM
);
1878 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1881 TEST_F(GLES2ImplementationTest
, PopulateSubscribedValuesCHROMIUM
) {
1883 cmds::PopulateSubscribedValuesCHROMIUM cmd
;
1886 expected
.cmd
.Init(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
);
1888 gl_
->PopulateSubscribedValuesCHROMIUM(GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
);
1889 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1892 TEST_F(GLES2ImplementationTest
, UniformValuebufferCHROMIUM
) {
1894 cmds::UniformValuebufferCHROMIUM cmd
;
1897 expected
.cmd
.Init(1, GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
,
1898 GL_MOUSE_POSITION_CHROMIUM
);
1900 gl_
->UniformValuebufferCHROMIUM(1, GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
,
1901 GL_MOUSE_POSITION_CHROMIUM
);
1902 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1905 TEST_F(GLES2ImplementationTest
, BindTexImage2DCHROMIUM
) {
1907 cmds::BindTexImage2DCHROMIUM cmd
;
1910 expected
.cmd
.Init(GL_TEXTURE_2D
, 2);
1912 gl_
->BindTexImage2DCHROMIUM(GL_TEXTURE_2D
, 2);
1913 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1916 TEST_F(GLES2ImplementationTest
, ReleaseTexImage2DCHROMIUM
) {
1918 cmds::ReleaseTexImage2DCHROMIUM cmd
;
1921 expected
.cmd
.Init(GL_TEXTURE_2D
, 2);
1923 gl_
->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D
, 2);
1924 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1927 TEST_F(GLES2ImplementationTest
, DiscardFramebufferEXT
) {
1928 GLenum data
[2][1] = {{0}};
1930 cmds::DiscardFramebufferEXTImmediate cmd
;
1935 for (int ii
= 0; ii
< 2; ++ii
) {
1936 for (int jj
= 0; jj
< 1; ++jj
) {
1937 data
[ii
][jj
] = static_cast<GLenum
>(ii
* 1 + jj
);
1940 expected
.cmd
.Init(1, 2, &data
[0][0]);
1941 gl_
->DiscardFramebufferEXT(1, 2, &data
[0][0]);
1942 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1945 TEST_F(GLES2ImplementationTest
, LoseContextCHROMIUM
) {
1947 cmds::LoseContextCHROMIUM cmd
;
1950 expected
.cmd
.Init(GL_GUILTY_CONTEXT_RESET_ARB
, GL_GUILTY_CONTEXT_RESET_ARB
);
1952 gl_
->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB
,
1953 GL_GUILTY_CONTEXT_RESET_ARB
);
1954 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1956 // TODO: Implement unit test for InsertSyncPointCHROMIUM
1958 TEST_F(GLES2ImplementationTest
, WaitSyncPointCHROMIUM
) {
1960 cmds::WaitSyncPointCHROMIUM cmd
;
1963 expected
.cmd
.Init(1);
1965 gl_
->WaitSyncPointCHROMIUM(1);
1966 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1969 TEST_F(GLES2ImplementationTest
, DrawBuffersEXT
) {
1970 GLenum data
[1][1] = {{0}};
1972 cmds::DrawBuffersEXTImmediate cmd
;
1977 for (int ii
= 0; ii
< 1; ++ii
) {
1978 for (int jj
= 0; jj
< 1; ++jj
) {
1979 data
[ii
][jj
] = static_cast<GLenum
>(ii
* 1 + jj
);
1982 expected
.cmd
.Init(1, &data
[0][0]);
1983 gl_
->DrawBuffersEXT(1, &data
[0][0]);
1984 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1987 TEST_F(GLES2ImplementationTest
, DiscardBackbufferCHROMIUM
) {
1989 cmds::DiscardBackbufferCHROMIUM cmd
;
1992 expected
.cmd
.Init();
1994 gl_
->DiscardBackbufferCHROMIUM();
1995 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
1998 TEST_F(GLES2ImplementationTest
, MatrixLoadfCHROMIUM
) {
1999 GLfloat data
[16] = {0};
2001 cmds::MatrixLoadfCHROMIUMImmediate cmd
;
2005 for (int jj
= 0; jj
< 16; ++jj
) {
2006 data
[jj
] = static_cast<GLfloat
>(jj
);
2009 expected
.cmd
.Init(GL_PATH_PROJECTION_CHROMIUM
, &data
[0]);
2010 gl_
->MatrixLoadfCHROMIUM(GL_PATH_PROJECTION_CHROMIUM
, &data
[0]);
2011 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
2014 TEST_F(GLES2ImplementationTest
, MatrixLoadIdentityCHROMIUM
) {
2016 cmds::MatrixLoadIdentityCHROMIUM cmd
;
2019 expected
.cmd
.Init(GL_PATH_PROJECTION_CHROMIUM
);
2021 gl_
->MatrixLoadIdentityCHROMIUM(GL_PATH_PROJECTION_CHROMIUM
);
2022 EXPECT_EQ(0, memcmp(&expected
, commands_
, sizeof(expected
)));
2024 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_