OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is auto-generated from | 5 // This file is auto-generated from |
6 // gpu/command_buffer/build_gles2_cmd_buffer.py | 6 // gpu/command_buffer/build_gles2_cmd_buffer.py |
7 // It's formatted by clang-format using chromium coding style: | 7 // It's formatted by clang-format using chromium coding style: |
8 // clang-format -i -style=chromium filename | 8 // clang-format -i -style=chromium filename |
9 // DO NOT EDIT! | 9 // DO NOT EDIT! |
10 | 10 |
11 // This file is included by gles2_implementation.h to declare the | 11 // This file is included by gles2_implementation.h to declare the |
12 // GL api functions. | 12 // GL api functions. |
13 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ | 13 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ |
14 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ | 14 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ |
15 | 15 |
16 TEST_F(GLES2ImplementationTest, AttachShader) { | 16 TEST_F(GLES2ImplementationTest, AttachShader) { |
17 struct Cmds { | 17 struct Cmds { |
18 cmds::AttachShader cmd; | 18 cmds::AttachShader cmd; |
19 }; | 19 }; |
20 Cmds expected; | 20 Cmds expected; |
21 expected.cmd.Init(1, 2); | 21 expected.cmd.Init(1, 2); |
22 | 22 |
23 gl_->AttachShader(1, 2); | 23 gl_->AttachShader(1, 2); |
24 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 24 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
25 } | 25 } |
26 // TODO: Implement unit test for BindAttribLocation | 26 // TODO(zmo): Implement unit test for BindAttribLocation |
27 | 27 |
28 TEST_F(GLES2ImplementationTest, BindBuffer) { | 28 TEST_F(GLES2ImplementationTest, BindBuffer) { |
29 struct Cmds { | 29 struct Cmds { |
30 cmds::BindBuffer cmd; | 30 cmds::BindBuffer cmd; |
31 }; | 31 }; |
32 Cmds expected; | 32 Cmds expected; |
33 expected.cmd.Init(GL_ARRAY_BUFFER, 2); | 33 expected.cmd.Init(GL_ARRAY_BUFFER, 2); |
34 | 34 |
35 gl_->BindBuffer(GL_ARRAY_BUFFER, 2); | 35 gl_->BindBuffer(GL_ARRAY_BUFFER, 2); |
36 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 36 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 TEST_F(GLES2ImplementationTest, CompileShader) { | 302 TEST_F(GLES2ImplementationTest, CompileShader) { |
303 struct Cmds { | 303 struct Cmds { |
304 cmds::CompileShader cmd; | 304 cmds::CompileShader cmd; |
305 }; | 305 }; |
306 Cmds expected; | 306 Cmds expected; |
307 expected.cmd.Init(1); | 307 expected.cmd.Init(1); |
308 | 308 |
309 gl_->CompileShader(1); | 309 gl_->CompileShader(1); |
310 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 310 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
311 } | 311 } |
312 // TODO: Implement unit test for CompressedTexImage2D | 312 // TODO(zmo): Implement unit test for CompressedTexImage2D |
313 // TODO: Implement unit test for CompressedTexSubImage2D | 313 // TODO(zmo): Implement unit test for CompressedTexSubImage2D |
314 | 314 |
315 TEST_F(GLES2ImplementationTest, CopyBufferSubData) { | 315 TEST_F(GLES2ImplementationTest, CopyBufferSubData) { |
316 struct Cmds { | 316 struct Cmds { |
317 cmds::CopyBufferSubData cmd; | 317 cmds::CopyBufferSubData cmd; |
318 }; | 318 }; |
319 Cmds expected; | 319 Cmds expected; |
320 expected.cmd.Init(GL_ARRAY_BUFFER, GL_ARRAY_BUFFER, 3, 4, 5); | 320 expected.cmd.Init(GL_ARRAY_BUFFER, GL_ARRAY_BUFFER, 3, 4, 5); |
321 | 321 |
322 gl_->CopyBufferSubData(GL_ARRAY_BUFFER, GL_ARRAY_BUFFER, 3, 4, 5); | 322 gl_->CopyBufferSubData(GL_ARRAY_BUFFER, GL_ARRAY_BUFFER, 3, 4, 5); |
323 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 323 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 }; | 731 }; |
732 Cmds expected; | 732 Cmds expected; |
733 expected.gen.Init(arraysize(ids), &ids[0]); | 733 expected.gen.Init(arraysize(ids), &ids[0]); |
734 expected.data[0] = kTransformFeedbacksStartId; | 734 expected.data[0] = kTransformFeedbacksStartId; |
735 expected.data[1] = kTransformFeedbacksStartId + 1; | 735 expected.data[1] = kTransformFeedbacksStartId + 1; |
736 gl_->GenTransformFeedbacks(arraysize(ids), &ids[0]); | 736 gl_->GenTransformFeedbacks(arraysize(ids), &ids[0]); |
737 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 737 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
738 EXPECT_EQ(kTransformFeedbacksStartId, ids[0]); | 738 EXPECT_EQ(kTransformFeedbacksStartId, ids[0]); |
739 EXPECT_EQ(kTransformFeedbacksStartId + 1, ids[1]); | 739 EXPECT_EQ(kTransformFeedbacksStartId + 1, ids[1]); |
740 } | 740 } |
741 // TODO: Implement unit test for GetActiveAttrib | 741 // TODO(zmo): Implement unit test for GetActiveAttrib |
742 // TODO: Implement unit test for GetActiveUniform | 742 // TODO(zmo): Implement unit test for GetActiveUniform |
743 // TODO: Implement unit test for GetAttachedShaders | 743 // TODO(zmo): Implement unit test for GetAttachedShaders |
744 // TODO: Implement unit test for GetAttribLocation | 744 // TODO(zmo): Implement unit test for GetAttribLocation |
745 | 745 |
746 TEST_F(GLES2ImplementationTest, GetBooleanv) { | 746 TEST_F(GLES2ImplementationTest, GetBooleanv) { |
747 struct Cmds { | 747 struct Cmds { |
748 cmds::GetBooleanv cmd; | 748 cmds::GetBooleanv cmd; |
749 }; | 749 }; |
750 typedef cmds::GetBooleanv::Result Result; | 750 typedef cmds::GetBooleanv::Result Result; |
751 Result::Type result = 0; | 751 Result::Type result = 0; |
752 Cmds expected; | 752 Cmds expected; |
753 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 753 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
754 expected.cmd.Init(123, result1.id, result1.offset); | 754 expected.cmd.Init(123, result1.id, result1.offset); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 Cmds expected; | 786 Cmds expected; |
787 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 787 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
788 expected.cmd.Init(123, result1.id, result1.offset); | 788 expected.cmd.Init(123, result1.id, result1.offset); |
789 EXPECT_CALL(*command_buffer(), OnFlush()) | 789 EXPECT_CALL(*command_buffer(), OnFlush()) |
790 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 790 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
791 .RetiresOnSaturation(); | 791 .RetiresOnSaturation(); |
792 gl_->GetFloatv(123, &result); | 792 gl_->GetFloatv(123, &result); |
793 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 793 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
794 EXPECT_EQ(static_cast<Result::Type>(1), result); | 794 EXPECT_EQ(static_cast<Result::Type>(1), result); |
795 } | 795 } |
| 796 // TODO(zmo): Implement unit test for GetFragDataLocation |
796 | 797 |
797 TEST_F(GLES2ImplementationTest, GetFramebufferAttachmentParameteriv) { | 798 TEST_F(GLES2ImplementationTest, GetFramebufferAttachmentParameteriv) { |
798 struct Cmds { | 799 struct Cmds { |
799 cmds::GetFramebufferAttachmentParameteriv cmd; | 800 cmds::GetFramebufferAttachmentParameteriv cmd; |
800 }; | 801 }; |
801 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result; | 802 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result; |
802 Result::Type result = 0; | 803 Result::Type result = 0; |
803 Cmds expected; | 804 Cmds expected; |
804 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 805 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
805 expected.cmd.Init(123, GL_COLOR_ATTACHMENT0, | 806 expected.cmd.Init(123, GL_COLOR_ATTACHMENT0, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 Cmds expected; | 860 Cmds expected; |
860 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 861 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
861 expected.cmd.Init(123, GL_DELETE_STATUS, result1.id, result1.offset); | 862 expected.cmd.Init(123, GL_DELETE_STATUS, result1.id, result1.offset); |
862 EXPECT_CALL(*command_buffer(), OnFlush()) | 863 EXPECT_CALL(*command_buffer(), OnFlush()) |
863 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 864 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
864 .RetiresOnSaturation(); | 865 .RetiresOnSaturation(); |
865 gl_->GetProgramiv(123, GL_DELETE_STATUS, &result); | 866 gl_->GetProgramiv(123, GL_DELETE_STATUS, &result); |
866 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 867 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
867 EXPECT_EQ(static_cast<Result::Type>(1), result); | 868 EXPECT_EQ(static_cast<Result::Type>(1), result); |
868 } | 869 } |
869 // TODO: Implement unit test for GetProgramInfoLog | 870 // TODO(zmo): Implement unit test for GetProgramInfoLog |
870 | 871 |
871 TEST_F(GLES2ImplementationTest, GetRenderbufferParameteriv) { | 872 TEST_F(GLES2ImplementationTest, GetRenderbufferParameteriv) { |
872 struct Cmds { | 873 struct Cmds { |
873 cmds::GetRenderbufferParameteriv cmd; | 874 cmds::GetRenderbufferParameteriv cmd; |
874 }; | 875 }; |
875 typedef cmds::GetRenderbufferParameteriv::Result Result; | 876 typedef cmds::GetRenderbufferParameteriv::Result Result; |
876 Result::Type result = 0; | 877 Result::Type result = 0; |
877 Cmds expected; | 878 Cmds expected; |
878 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 879 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
879 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset); | 880 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 Cmds expected; | 929 Cmds expected; |
929 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 930 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
930 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset); | 931 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset); |
931 EXPECT_CALL(*command_buffer(), OnFlush()) | 932 EXPECT_CALL(*command_buffer(), OnFlush()) |
932 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 933 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
933 .RetiresOnSaturation(); | 934 .RetiresOnSaturation(); |
934 gl_->GetShaderiv(123, GL_SHADER_TYPE, &result); | 935 gl_->GetShaderiv(123, GL_SHADER_TYPE, &result); |
935 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 936 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
936 EXPECT_EQ(static_cast<Result::Type>(1), result); | 937 EXPECT_EQ(static_cast<Result::Type>(1), result); |
937 } | 938 } |
938 // TODO: Implement unit test for GetShaderInfoLog | 939 // TODO(zmo): Implement unit test for GetShaderInfoLog |
939 // TODO: Implement unit test for GetShaderPrecisionFormat | 940 // TODO(zmo): Implement unit test for GetShaderPrecisionFormat |
940 | 941 |
941 TEST_F(GLES2ImplementationTest, GetTexParameterfv) { | 942 TEST_F(GLES2ImplementationTest, GetTexParameterfv) { |
942 struct Cmds { | 943 struct Cmds { |
943 cmds::GetTexParameterfv cmd; | 944 cmds::GetTexParameterfv cmd; |
944 }; | 945 }; |
945 typedef cmds::GetTexParameterfv::Result Result; | 946 typedef cmds::GetTexParameterfv::Result Result; |
946 Result::Type result = 0; | 947 Result::Type result = 0; |
947 Cmds expected; | 948 Cmds expected; |
948 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 949 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
949 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); | 950 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); |
(...skipping 14 matching lines...) Expand all Loading... |
964 Cmds expected; | 965 Cmds expected; |
965 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 966 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
966 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); | 967 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); |
967 EXPECT_CALL(*command_buffer(), OnFlush()) | 968 EXPECT_CALL(*command_buffer(), OnFlush()) |
968 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 969 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
969 .RetiresOnSaturation(); | 970 .RetiresOnSaturation(); |
970 gl_->GetTexParameteriv(123, GL_TEXTURE_MAG_FILTER, &result); | 971 gl_->GetTexParameteriv(123, GL_TEXTURE_MAG_FILTER, &result); |
971 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 972 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
972 EXPECT_EQ(static_cast<Result::Type>(1), result); | 973 EXPECT_EQ(static_cast<Result::Type>(1), result); |
973 } | 974 } |
974 // TODO: Implement unit test for GetUniformfv | 975 // TODO(zmo): Implement unit test for GetUniformfv |
975 // TODO: Implement unit test for GetUniformiv | 976 // TODO(zmo): Implement unit test for GetUniformiv |
976 // TODO: Implement unit test for GetUniformLocation | 977 // TODO(zmo): Implement unit test for GetUniformLocation |
977 | 978 |
978 TEST_F(GLES2ImplementationTest, GetVertexAttribfv) { | 979 TEST_F(GLES2ImplementationTest, GetVertexAttribfv) { |
979 struct Cmds { | 980 struct Cmds { |
980 cmds::GetVertexAttribfv cmd; | 981 cmds::GetVertexAttribfv cmd; |
981 }; | 982 }; |
982 typedef cmds::GetVertexAttribfv::Result Result; | 983 typedef cmds::GetVertexAttribfv::Result Result; |
983 Result::Type result = 0; | 984 Result::Type result = 0; |
984 Cmds expected; | 985 Cmds expected; |
985 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 986 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
986 expected.cmd.Init(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, | 987 expected.cmd.Init(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 struct Cmds { | 1398 struct Cmds { |
1398 cmds::Scissor cmd; | 1399 cmds::Scissor cmd; |
1399 }; | 1400 }; |
1400 Cmds expected; | 1401 Cmds expected; |
1401 expected.cmd.Init(1, 2, 3, 4); | 1402 expected.cmd.Init(1, 2, 3, 4); |
1402 | 1403 |
1403 gl_->Scissor(1, 2, 3, 4); | 1404 gl_->Scissor(1, 2, 3, 4); |
1404 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1405 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1405 } | 1406 } |
1406 | 1407 |
| 1408 TEST_F(GLES2ImplementationTest, ShaderSource) { |
| 1409 const uint32 kBucketId = GLES2Implementation::kResultBucketId; |
| 1410 const char* kString1 = "happy"; |
| 1411 const char* kString2 = "ending"; |
| 1412 const size_t kString1Size = ::strlen(kString1) + 1; |
| 1413 const size_t kString2Size = ::strlen(kString2) + 1; |
| 1414 const size_t kHeaderSize = sizeof(GLint) * 3; |
| 1415 const size_t kSourceSize = kHeaderSize + kString1Size + kString2Size; |
| 1416 const size_t kPaddedHeaderSize = |
| 1417 transfer_buffer_->RoundToAlignment(kHeaderSize); |
| 1418 const size_t kPaddedString1Size = |
| 1419 transfer_buffer_->RoundToAlignment(kString1Size); |
| 1420 const size_t kPaddedString2Size = |
| 1421 transfer_buffer_->RoundToAlignment(kString2Size); |
| 1422 struct Cmds { |
| 1423 cmd::SetBucketSize set_bucket_size; |
| 1424 cmd::SetBucketData set_bucket_header; |
| 1425 cmd::SetToken set_token1; |
| 1426 cmd::SetBucketData set_bucket_data1; |
| 1427 cmd::SetToken set_token2; |
| 1428 cmd::SetBucketData set_bucket_data2; |
| 1429 cmd::SetToken set_token3; |
| 1430 cmds::ShaderSourceBucket shader_source_bucket; |
| 1431 cmd::SetBucketSize clear_bucket_size; |
| 1432 }; |
| 1433 |
| 1434 ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize); |
| 1435 ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedString1Size); |
| 1436 ExpectedMemoryInfo mem2 = GetExpectedMemory(kPaddedString2Size); |
| 1437 |
| 1438 Cmds expected; |
| 1439 expected.set_bucket_size.Init(kBucketId, kSourceSize); |
| 1440 expected.set_bucket_header.Init(kBucketId, 0, kHeaderSize, mem0.id, |
| 1441 mem0.offset); |
| 1442 expected.set_token1.Init(GetNextToken()); |
| 1443 expected.set_bucket_data1.Init(kBucketId, kHeaderSize, kString1Size, mem1.id, |
| 1444 mem1.offset); |
| 1445 expected.set_token2.Init(GetNextToken()); |
| 1446 expected.set_bucket_data2.Init(kBucketId, kHeaderSize + kString1Size, |
| 1447 kString2Size, mem2.id, mem2.offset); |
| 1448 expected.set_token3.Init(GetNextToken()); |
| 1449 expected.shader_source_bucket.Init(1, kBucketId); |
| 1450 expected.clear_bucket_size.Init(kBucketId, 0); |
| 1451 const char* kStrings[] = {kString1, kString2}; |
| 1452 gl_->ShaderSource(1, 2, kStrings, NULL); |
| 1453 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1454 } |
| 1455 |
| 1456 TEST_F(GLES2ImplementationTest, ShaderSourceWithLength) { |
| 1457 const uint32 kBucketId = GLES2Implementation::kResultBucketId; |
| 1458 const char* kString = "foobar******"; |
| 1459 const size_t kStringSize = 6; // We only need "foobar". |
| 1460 const size_t kHeaderSize = sizeof(GLint) * 2; |
| 1461 const size_t kSourceSize = kHeaderSize + kStringSize + 1; |
| 1462 const size_t kPaddedHeaderSize = |
| 1463 transfer_buffer_->RoundToAlignment(kHeaderSize); |
| 1464 const size_t kPaddedStringSize = |
| 1465 transfer_buffer_->RoundToAlignment(kStringSize + 1); |
| 1466 struct Cmds { |
| 1467 cmd::SetBucketSize set_bucket_size; |
| 1468 cmd::SetBucketData set_bucket_header; |
| 1469 cmd::SetToken set_token1; |
| 1470 cmd::SetBucketData set_bucket_data; |
| 1471 cmd::SetToken set_token2; |
| 1472 cmds::ShaderSourceBucket shader_source_bucket; |
| 1473 cmd::SetBucketSize clear_bucket_size; |
| 1474 }; |
| 1475 |
| 1476 ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize); |
| 1477 ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedStringSize); |
| 1478 |
| 1479 Cmds expected; |
| 1480 expected.set_bucket_size.Init(kBucketId, kSourceSize); |
| 1481 expected.set_bucket_header.Init(kBucketId, 0, kHeaderSize, mem0.id, |
| 1482 mem0.offset); |
| 1483 expected.set_token1.Init(GetNextToken()); |
| 1484 expected.set_bucket_data.Init(kBucketId, kHeaderSize, kStringSize + 1, |
| 1485 mem1.id, mem1.offset); |
| 1486 expected.set_token2.Init(GetNextToken()); |
| 1487 expected.shader_source_bucket.Init(1, kBucketId); |
| 1488 expected.clear_bucket_size.Init(kBucketId, 0); |
| 1489 const char* kStrings[] = {kString}; |
| 1490 const GLint kLength[] = {kStringSize}; |
| 1491 gl_->ShaderSource(1, 1, kStrings, kLength); |
| 1492 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1493 } |
| 1494 |
1407 TEST_F(GLES2ImplementationTest, StencilFunc) { | 1495 TEST_F(GLES2ImplementationTest, StencilFunc) { |
1408 struct Cmds { | 1496 struct Cmds { |
1409 cmds::StencilFunc cmd; | 1497 cmds::StencilFunc cmd; |
1410 }; | 1498 }; |
1411 Cmds expected; | 1499 Cmds expected; |
1412 expected.cmd.Init(GL_NEVER, 2, 3); | 1500 expected.cmd.Init(GL_NEVER, 2, 3); |
1413 | 1501 |
1414 gl_->StencilFunc(GL_NEVER, 2, 3); | 1502 gl_->StencilFunc(GL_NEVER, 2, 3); |
1415 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1503 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1416 } | 1504 } |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 cmds::DeleteQueriesEXTImmediate del; | 2528 cmds::DeleteQueriesEXTImmediate del; |
2441 GLuint data[2]; | 2529 GLuint data[2]; |
2442 }; | 2530 }; |
2443 Cmds expected; | 2531 Cmds expected; |
2444 expected.del.Init(arraysize(ids), &ids[0]); | 2532 expected.del.Init(arraysize(ids), &ids[0]); |
2445 expected.data[0] = kQueriesStartId; | 2533 expected.data[0] = kQueriesStartId; |
2446 expected.data[1] = kQueriesStartId + 1; | 2534 expected.data[1] = kQueriesStartId + 1; |
2447 gl_->DeleteQueriesEXT(arraysize(ids), &ids[0]); | 2535 gl_->DeleteQueriesEXT(arraysize(ids), &ids[0]); |
2448 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2536 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2449 } | 2537 } |
2450 // TODO: Implement unit test for BeginQueryEXT | 2538 // TODO(zmo): Implement unit test for BeginQueryEXT |
2451 | 2539 |
2452 TEST_F(GLES2ImplementationTest, BeginTransformFeedback) { | 2540 TEST_F(GLES2ImplementationTest, BeginTransformFeedback) { |
2453 struct Cmds { | 2541 struct Cmds { |
2454 cmds::BeginTransformFeedback cmd; | 2542 cmds::BeginTransformFeedback cmd; |
2455 }; | 2543 }; |
2456 Cmds expected; | 2544 Cmds expected; |
2457 expected.cmd.Init(GL_POINTS); | 2545 expected.cmd.Init(GL_POINTS); |
2458 | 2546 |
2459 gl_->BeginTransformFeedback(GL_POINTS); | 2547 gl_->BeginTransformFeedback(GL_POINTS); |
2460 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2548 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2461 } | 2549 } |
2462 | 2550 |
2463 TEST_F(GLES2ImplementationTest, EndTransformFeedback) { | 2551 TEST_F(GLES2ImplementationTest, EndTransformFeedback) { |
2464 struct Cmds { | 2552 struct Cmds { |
2465 cmds::EndTransformFeedback cmd; | 2553 cmds::EndTransformFeedback cmd; |
2466 }; | 2554 }; |
2467 Cmds expected; | 2555 Cmds expected; |
2468 expected.cmd.Init(); | 2556 expected.cmd.Init(); |
2469 | 2557 |
2470 gl_->EndTransformFeedback(); | 2558 gl_->EndTransformFeedback(); |
2471 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2559 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2472 } | 2560 } |
2473 // TODO: Implement unit test for InsertEventMarkerEXT | 2561 // TODO(zmo): Implement unit test for InsertEventMarkerEXT |
2474 // TODO: Implement unit test for PushGroupMarkerEXT | 2562 // TODO(zmo): Implement unit test for PushGroupMarkerEXT |
2475 | 2563 |
2476 TEST_F(GLES2ImplementationTest, PopGroupMarkerEXT) { | 2564 TEST_F(GLES2ImplementationTest, PopGroupMarkerEXT) { |
2477 struct Cmds { | 2565 struct Cmds { |
2478 cmds::PopGroupMarkerEXT cmd; | 2566 cmds::PopGroupMarkerEXT cmd; |
2479 }; | 2567 }; |
2480 Cmds expected; | 2568 Cmds expected; |
2481 expected.cmd.Init(); | 2569 expected.cmd.Init(); |
2482 | 2570 |
2483 gl_->PopGroupMarkerEXT(); | 2571 gl_->PopGroupMarkerEXT(); |
2484 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2572 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2527 expected.cmd.Init(1, result1.id, result1.offset); | 2615 expected.cmd.Init(1, result1.id, result1.offset); |
2528 | 2616 |
2529 EXPECT_CALL(*command_buffer(), OnFlush()) | 2617 EXPECT_CALL(*command_buffer(), OnFlush()) |
2530 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE))) | 2618 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE))) |
2531 .RetiresOnSaturation(); | 2619 .RetiresOnSaturation(); |
2532 | 2620 |
2533 GLboolean result = gl_->IsVertexArrayOES(1); | 2621 GLboolean result = gl_->IsVertexArrayOES(1); |
2534 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2622 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2535 EXPECT_TRUE(result); | 2623 EXPECT_TRUE(result); |
2536 } | 2624 } |
2537 // TODO: Implement unit test for EnableFeatureCHROMIUM | 2625 // TODO(zmo): Implement unit test for EnableFeatureCHROMIUM |
2538 | 2626 |
2539 TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) { | 2627 TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) { |
2540 struct Cmds { | 2628 struct Cmds { |
2541 cmds::ResizeCHROMIUM cmd; | 2629 cmds::ResizeCHROMIUM cmd; |
2542 }; | 2630 }; |
2543 Cmds expected; | 2631 Cmds expected; |
2544 expected.cmd.Init(1, 2, 3); | 2632 expected.cmd.Init(1, 2, 3); |
2545 | 2633 |
2546 gl_->ResizeCHROMIUM(1, 2, 3); | 2634 gl_->ResizeCHROMIUM(1, 2, 3); |
2547 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2635 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2548 } | 2636 } |
2549 // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM | 2637 // TODO(zmo): Implement unit test for GetRequestableExtensionsCHROMIUM |
2550 // TODO: Implement unit test for CreateStreamTextureCHROMIUM | 2638 // TODO(zmo): Implement unit test for CreateStreamTextureCHROMIUM |
2551 // TODO: Implement unit test for GetTranslatedShaderSourceANGLE | 2639 // TODO(zmo): Implement unit test for GetTranslatedShaderSourceANGLE |
2552 | 2640 |
2553 TEST_F(GLES2ImplementationTest, TexImageIOSurface2DCHROMIUM) { | 2641 TEST_F(GLES2ImplementationTest, TexImageIOSurface2DCHROMIUM) { |
2554 struct Cmds { | 2642 struct Cmds { |
2555 cmds::TexImageIOSurface2DCHROMIUM cmd; | 2643 cmds::TexImageIOSurface2DCHROMIUM cmd; |
2556 }; | 2644 }; |
2557 Cmds expected; | 2645 Cmds expected; |
2558 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5); | 2646 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5); |
2559 | 2647 |
2560 gl_->TexImageIOSurface2DCHROMIUM(GL_TEXTURE_2D, 2, 3, 4, 5); | 2648 gl_->TexImageIOSurface2DCHROMIUM(GL_TEXTURE_2D, 2, 3, 4, 5); |
2561 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2649 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
(...skipping 24 matching lines...) Expand all Loading... |
2586 TEST_F(GLES2ImplementationTest, VertexAttribDivisorANGLE) { | 2674 TEST_F(GLES2ImplementationTest, VertexAttribDivisorANGLE) { |
2587 struct Cmds { | 2675 struct Cmds { |
2588 cmds::VertexAttribDivisorANGLE cmd; | 2676 cmds::VertexAttribDivisorANGLE cmd; |
2589 }; | 2677 }; |
2590 Cmds expected; | 2678 Cmds expected; |
2591 expected.cmd.Init(1, 2); | 2679 expected.cmd.Init(1, 2); |
2592 | 2680 |
2593 gl_->VertexAttribDivisorANGLE(1, 2); | 2681 gl_->VertexAttribDivisorANGLE(1, 2); |
2594 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2682 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2595 } | 2683 } |
2596 // TODO: Implement unit test for GenMailboxCHROMIUM | 2684 // TODO(zmo): Implement unit test for GenMailboxCHROMIUM |
2597 // TODO: Implement unit test for BindUniformLocationCHROMIUM | 2685 // TODO(zmo): Implement unit test for BindUniformLocationCHROMIUM |
2598 | 2686 |
2599 TEST_F(GLES2ImplementationTest, GenValuebuffersCHROMIUM) { | 2687 TEST_F(GLES2ImplementationTest, GenValuebuffersCHROMIUM) { |
2600 GLuint ids[2] = { | 2688 GLuint ids[2] = { |
2601 0, | 2689 0, |
2602 }; | 2690 }; |
2603 struct Cmds { | 2691 struct Cmds { |
2604 cmds::GenValuebuffersCHROMIUMImmediate gen; | 2692 cmds::GenValuebuffersCHROMIUMImmediate gen; |
2605 GLuint data[2]; | 2693 GLuint data[2]; |
2606 }; | 2694 }; |
2607 Cmds expected; | 2695 Cmds expected; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2742 struct Cmds { | 2830 struct Cmds { |
2743 cmds::LoseContextCHROMIUM cmd; | 2831 cmds::LoseContextCHROMIUM cmd; |
2744 }; | 2832 }; |
2745 Cmds expected; | 2833 Cmds expected; |
2746 expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_GUILTY_CONTEXT_RESET_ARB); | 2834 expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_GUILTY_CONTEXT_RESET_ARB); |
2747 | 2835 |
2748 gl_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 2836 gl_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
2749 GL_GUILTY_CONTEXT_RESET_ARB); | 2837 GL_GUILTY_CONTEXT_RESET_ARB); |
2750 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2838 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2751 } | 2839 } |
2752 // TODO: Implement unit test for InsertSyncPointCHROMIUM | 2840 // TODO(zmo): Implement unit test for InsertSyncPointCHROMIUM |
2753 | 2841 |
2754 TEST_F(GLES2ImplementationTest, WaitSyncPointCHROMIUM) { | 2842 TEST_F(GLES2ImplementationTest, WaitSyncPointCHROMIUM) { |
2755 struct Cmds { | 2843 struct Cmds { |
2756 cmds::WaitSyncPointCHROMIUM cmd; | 2844 cmds::WaitSyncPointCHROMIUM cmd; |
2757 }; | 2845 }; |
2758 Cmds expected; | 2846 Cmds expected; |
2759 expected.cmd.Init(1); | 2847 expected.cmd.Init(1); |
2760 | 2848 |
2761 gl_->WaitSyncPointCHROMIUM(1); | 2849 gl_->WaitSyncPointCHROMIUM(1); |
2762 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2850 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2811 struct Cmds { | 2899 struct Cmds { |
2812 cmds::MatrixLoadIdentityCHROMIUM cmd; | 2900 cmds::MatrixLoadIdentityCHROMIUM cmd; |
2813 }; | 2901 }; |
2814 Cmds expected; | 2902 Cmds expected; |
2815 expected.cmd.Init(GL_PATH_PROJECTION_CHROMIUM); | 2903 expected.cmd.Init(GL_PATH_PROJECTION_CHROMIUM); |
2816 | 2904 |
2817 gl_->MatrixLoadIdentityCHROMIUM(GL_PATH_PROJECTION_CHROMIUM); | 2905 gl_->MatrixLoadIdentityCHROMIUM(GL_PATH_PROJECTION_CHROMIUM); |
2818 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2906 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2819 } | 2907 } |
2820 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ | 2908 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ |
OLD | NEW |