| 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 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 Cmds expected; | 60 Cmds expected; |
| 61 expected.cmd.Init(GL_RENDERBUFFER, 2); | 61 expected.cmd.Init(GL_RENDERBUFFER, 2); |
| 62 | 62 |
| 63 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2); | 63 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2); |
| 64 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 64 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 65 ClearCommands(); | 65 ClearCommands(); |
| 66 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2); | 66 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2); |
| 67 EXPECT_TRUE(NoCommandsWritten()); | 67 EXPECT_TRUE(NoCommandsWritten()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 TEST_F(GLES2ImplementationTest, BindSampler) { |
| 71 struct Cmds { |
| 72 cmds::BindSampler cmd; |
| 73 }; |
| 74 Cmds expected; |
| 75 expected.cmd.Init(1, 2); |
| 76 |
| 77 gl_->BindSampler(1, 2); |
| 78 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 79 } |
| 80 |
| 70 TEST_F(GLES2ImplementationTest, BlendColor) { | 81 TEST_F(GLES2ImplementationTest, BlendColor) { |
| 71 struct Cmds { | 82 struct Cmds { |
| 72 cmds::BlendColor cmd; | 83 cmds::BlendColor cmd; |
| 73 }; | 84 }; |
| 74 Cmds expected; | 85 Cmds expected; |
| 75 expected.cmd.Init(1, 2, 3, 4); | 86 expected.cmd.Init(1, 2, 3, 4); |
| 76 | 87 |
| 77 gl_->BlendColor(1, 2, 3, 4); | 88 gl_->BlendColor(1, 2, 3, 4); |
| 78 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 89 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 79 } | 90 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 GLuint data[2]; | 316 GLuint data[2]; |
| 306 }; | 317 }; |
| 307 Cmds expected; | 318 Cmds expected; |
| 308 expected.del.Init(arraysize(ids), &ids[0]); | 319 expected.del.Init(arraysize(ids), &ids[0]); |
| 309 expected.data[0] = kRenderbuffersStartId; | 320 expected.data[0] = kRenderbuffersStartId; |
| 310 expected.data[1] = kRenderbuffersStartId + 1; | 321 expected.data[1] = kRenderbuffersStartId + 1; |
| 311 gl_->DeleteRenderbuffers(arraysize(ids), &ids[0]); | 322 gl_->DeleteRenderbuffers(arraysize(ids), &ids[0]); |
| 312 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 323 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 313 } | 324 } |
| 314 | 325 |
| 326 TEST_F(GLES2ImplementationTest, DeleteSamplers) { |
| 327 GLuint ids[2] = {kSamplersStartId, kSamplersStartId + 1}; |
| 328 struct Cmds { |
| 329 cmds::DeleteSamplersImmediate del; |
| 330 GLuint data[2]; |
| 331 }; |
| 332 Cmds expected; |
| 333 expected.del.Init(arraysize(ids), &ids[0]); |
| 334 expected.data[0] = kSamplersStartId; |
| 335 expected.data[1] = kSamplersStartId + 1; |
| 336 gl_->DeleteSamplers(arraysize(ids), &ids[0]); |
| 337 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 338 } |
| 339 |
| 315 TEST_F(GLES2ImplementationTest, DeleteShader) { | 340 TEST_F(GLES2ImplementationTest, DeleteShader) { |
| 316 struct Cmds { | 341 struct Cmds { |
| 317 cmds::DeleteShader cmd; | 342 cmds::DeleteShader cmd; |
| 318 }; | 343 }; |
| 319 Cmds expected; | 344 Cmds expected; |
| 320 expected.cmd.Init(1); | 345 expected.cmd.Init(1); |
| 321 | 346 |
| 322 gl_->DeleteShader(1); | 347 gl_->DeleteShader(1); |
| 323 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 348 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 324 } | 349 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 Cmds expected; | 561 Cmds expected; |
| 537 expected.gen.Init(arraysize(ids), &ids[0]); | 562 expected.gen.Init(arraysize(ids), &ids[0]); |
| 538 expected.data[0] = kRenderbuffersStartId; | 563 expected.data[0] = kRenderbuffersStartId; |
| 539 expected.data[1] = kRenderbuffersStartId + 1; | 564 expected.data[1] = kRenderbuffersStartId + 1; |
| 540 gl_->GenRenderbuffers(arraysize(ids), &ids[0]); | 565 gl_->GenRenderbuffers(arraysize(ids), &ids[0]); |
| 541 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 566 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 542 EXPECT_EQ(kRenderbuffersStartId, ids[0]); | 567 EXPECT_EQ(kRenderbuffersStartId, ids[0]); |
| 543 EXPECT_EQ(kRenderbuffersStartId + 1, ids[1]); | 568 EXPECT_EQ(kRenderbuffersStartId + 1, ids[1]); |
| 544 } | 569 } |
| 545 | 570 |
| 571 TEST_F(GLES2ImplementationTest, GenSamplers) { |
| 572 GLuint ids[2] = { |
| 573 0, |
| 574 }; |
| 575 struct Cmds { |
| 576 cmds::GenSamplersImmediate gen; |
| 577 GLuint data[2]; |
| 578 }; |
| 579 Cmds expected; |
| 580 expected.gen.Init(arraysize(ids), &ids[0]); |
| 581 expected.data[0] = kSamplersStartId; |
| 582 expected.data[1] = kSamplersStartId + 1; |
| 583 gl_->GenSamplers(arraysize(ids), &ids[0]); |
| 584 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 585 EXPECT_EQ(kSamplersStartId, ids[0]); |
| 586 EXPECT_EQ(kSamplersStartId + 1, ids[1]); |
| 587 } |
| 588 |
| 546 TEST_F(GLES2ImplementationTest, GenTextures) { | 589 TEST_F(GLES2ImplementationTest, GenTextures) { |
| 547 GLuint ids[2] = { | 590 GLuint ids[2] = { |
| 548 0, | 591 0, |
| 549 }; | 592 }; |
| 550 struct Cmds { | 593 struct Cmds { |
| 551 cmds::GenTexturesImmediate gen; | 594 cmds::GenTexturesImmediate gen; |
| 552 GLuint data[2]; | 595 GLuint data[2]; |
| 553 }; | 596 }; |
| 554 Cmds expected; | 597 Cmds expected; |
| 555 expected.gen.Init(arraysize(ids), &ids[0]); | 598 expected.gen.Init(arraysize(ids), &ids[0]); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 743 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
| 701 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset); | 744 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset); |
| 702 EXPECT_CALL(*command_buffer(), OnFlush()) | 745 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 703 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) | 746 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
| 704 .RetiresOnSaturation(); | 747 .RetiresOnSaturation(); |
| 705 gl_->GetRenderbufferParameteriv(123, GL_RENDERBUFFER_RED_SIZE, &result); | 748 gl_->GetRenderbufferParameteriv(123, GL_RENDERBUFFER_RED_SIZE, &result); |
| 706 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 749 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 707 EXPECT_EQ(static_cast<Result::Type>(1), result); | 750 EXPECT_EQ(static_cast<Result::Type>(1), result); |
| 708 } | 751 } |
| 709 | 752 |
| 753 TEST_F(GLES2ImplementationTest, GetSamplerParameterfv) { |
| 754 struct Cmds { |
| 755 cmds::GetSamplerParameterfv cmd; |
| 756 }; |
| 757 typedef cmds::GetSamplerParameterfv::Result Result; |
| 758 Result::Type result = 0; |
| 759 Cmds expected; |
| 760 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
| 761 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); |
| 762 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 763 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
| 764 .RetiresOnSaturation(); |
| 765 gl_->GetSamplerParameterfv(123, GL_TEXTURE_MAG_FILTER, &result); |
| 766 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 767 EXPECT_EQ(static_cast<Result::Type>(1), result); |
| 768 } |
| 769 |
| 770 TEST_F(GLES2ImplementationTest, GetSamplerParameteriv) { |
| 771 struct Cmds { |
| 772 cmds::GetSamplerParameteriv cmd; |
| 773 }; |
| 774 typedef cmds::GetSamplerParameteriv::Result Result; |
| 775 Result::Type result = 0; |
| 776 Cmds expected; |
| 777 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
| 778 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset); |
| 779 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 780 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) |
| 781 .RetiresOnSaturation(); |
| 782 gl_->GetSamplerParameteriv(123, GL_TEXTURE_MAG_FILTER, &result); |
| 783 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 784 EXPECT_EQ(static_cast<Result::Type>(1), result); |
| 785 } |
| 786 |
| 710 TEST_F(GLES2ImplementationTest, GetShaderiv) { | 787 TEST_F(GLES2ImplementationTest, GetShaderiv) { |
| 711 struct Cmds { | 788 struct Cmds { |
| 712 cmds::GetShaderiv cmd; | 789 cmds::GetShaderiv cmd; |
| 713 }; | 790 }; |
| 714 typedef cmds::GetShaderiv::Result Result; | 791 typedef cmds::GetShaderiv::Result Result; |
| 715 Result::Type result = 0; | 792 Result::Type result = 0; |
| 716 Cmds expected; | 793 Cmds expected; |
| 717 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); | 794 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); |
| 718 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset); | 795 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset); |
| 719 EXPECT_CALL(*command_buffer(), OnFlush()) | 796 EXPECT_CALL(*command_buffer(), OnFlush()) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 | 1011 |
| 935 EXPECT_CALL(*command_buffer(), OnFlush()) | 1012 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 936 .WillOnce(SetMemory(result1.ptr, uint32_t(1))) | 1013 .WillOnce(SetMemory(result1.ptr, uint32_t(1))) |
| 937 .RetiresOnSaturation(); | 1014 .RetiresOnSaturation(); |
| 938 | 1015 |
| 939 GLboolean result = gl_->IsRenderbuffer(1); | 1016 GLboolean result = gl_->IsRenderbuffer(1); |
| 940 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1017 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 941 EXPECT_TRUE(result); | 1018 EXPECT_TRUE(result); |
| 942 } | 1019 } |
| 943 | 1020 |
| 1021 TEST_F(GLES2ImplementationTest, IsSampler) { |
| 1022 struct Cmds { |
| 1023 cmds::IsSampler cmd; |
| 1024 }; |
| 1025 |
| 1026 Cmds expected; |
| 1027 ExpectedMemoryInfo result1 = |
| 1028 GetExpectedResultMemory(sizeof(cmds::IsSampler::Result)); |
| 1029 expected.cmd.Init(1, result1.id, result1.offset); |
| 1030 |
| 1031 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 1032 .WillOnce(SetMemory(result1.ptr, uint32_t(1))) |
| 1033 .RetiresOnSaturation(); |
| 1034 |
| 1035 GLboolean result = gl_->IsSampler(1); |
| 1036 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1037 EXPECT_TRUE(result); |
| 1038 } |
| 1039 |
| 944 TEST_F(GLES2ImplementationTest, IsShader) { | 1040 TEST_F(GLES2ImplementationTest, IsShader) { |
| 945 struct Cmds { | 1041 struct Cmds { |
| 946 cmds::IsShader cmd; | 1042 cmds::IsShader cmd; |
| 947 }; | 1043 }; |
| 948 | 1044 |
| 949 Cmds expected; | 1045 Cmds expected; |
| 950 ExpectedMemoryInfo result1 = | 1046 ExpectedMemoryInfo result1 = |
| 951 GetExpectedResultMemory(sizeof(cmds::IsShader::Result)); | 1047 GetExpectedResultMemory(sizeof(cmds::IsShader::Result)); |
| 952 expected.cmd.Init(1, result1.id, result1.offset); | 1048 expected.cmd.Init(1, result1.id, result1.offset); |
| 953 | 1049 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 struct Cmds { | 1156 struct Cmds { |
| 1061 cmds::SampleCoverage cmd; | 1157 cmds::SampleCoverage cmd; |
| 1062 }; | 1158 }; |
| 1063 Cmds expected; | 1159 Cmds expected; |
| 1064 expected.cmd.Init(1, true); | 1160 expected.cmd.Init(1, true); |
| 1065 | 1161 |
| 1066 gl_->SampleCoverage(1, true); | 1162 gl_->SampleCoverage(1, true); |
| 1067 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1163 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1068 } | 1164 } |
| 1069 | 1165 |
| 1166 TEST_F(GLES2ImplementationTest, SamplerParameterf) { |
| 1167 struct Cmds { |
| 1168 cmds::SamplerParameterf cmd; |
| 1169 }; |
| 1170 Cmds expected; |
| 1171 expected.cmd.Init(1, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 1172 |
| 1173 gl_->SamplerParameterf(1, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 1174 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1175 } |
| 1176 |
| 1177 TEST_F(GLES2ImplementationTest, SamplerParameterfv) { |
| 1178 GLfloat data[1] = {0}; |
| 1179 struct Cmds { |
| 1180 cmds::SamplerParameterfvImmediate cmd; |
| 1181 GLfloat data[1]; |
| 1182 }; |
| 1183 |
| 1184 for (int jj = 0; jj < 1; ++jj) { |
| 1185 data[jj] = static_cast<GLfloat>(jj); |
| 1186 } |
| 1187 Cmds expected; |
| 1188 expected.cmd.Init(1, GL_TEXTURE_MAG_FILTER, &data[0]); |
| 1189 gl_->SamplerParameterfv(1, GL_TEXTURE_MAG_FILTER, &data[0]); |
| 1190 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1191 } |
| 1192 |
| 1193 TEST_F(GLES2ImplementationTest, SamplerParameteri) { |
| 1194 struct Cmds { |
| 1195 cmds::SamplerParameteri cmd; |
| 1196 }; |
| 1197 Cmds expected; |
| 1198 expected.cmd.Init(1, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 1199 |
| 1200 gl_->SamplerParameteri(1, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 1201 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1202 } |
| 1203 |
| 1204 TEST_F(GLES2ImplementationTest, SamplerParameteriv) { |
| 1205 GLint data[1] = {0}; |
| 1206 struct Cmds { |
| 1207 cmds::SamplerParameterivImmediate cmd; |
| 1208 GLint data[1]; |
| 1209 }; |
| 1210 |
| 1211 for (int jj = 0; jj < 1; ++jj) { |
| 1212 data[jj] = static_cast<GLint>(jj); |
| 1213 } |
| 1214 Cmds expected; |
| 1215 expected.cmd.Init(1, GL_TEXTURE_MAG_FILTER, &data[0]); |
| 1216 gl_->SamplerParameteriv(1, GL_TEXTURE_MAG_FILTER, &data[0]); |
| 1217 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1218 } |
| 1219 |
| 1070 TEST_F(GLES2ImplementationTest, Scissor) { | 1220 TEST_F(GLES2ImplementationTest, Scissor) { |
| 1071 struct Cmds { | 1221 struct Cmds { |
| 1072 cmds::Scissor cmd; | 1222 cmds::Scissor cmd; |
| 1073 }; | 1223 }; |
| 1074 Cmds expected; | 1224 Cmds expected; |
| 1075 expected.cmd.Init(1, 2, 3, 4); | 1225 expected.cmd.Init(1, 2, 3, 4); |
| 1076 | 1226 |
| 1077 gl_->Scissor(1, 2, 3, 4); | 1227 gl_->Scissor(1, 2, 3, 4); |
| 1078 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1228 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 1079 } | 1229 } |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2463 struct Cmds { | 2613 struct Cmds { |
| 2464 cmds::MatrixLoadIdentityCHROMIUM cmd; | 2614 cmds::MatrixLoadIdentityCHROMIUM cmd; |
| 2465 }; | 2615 }; |
| 2466 Cmds expected; | 2616 Cmds expected; |
| 2467 expected.cmd.Init(GL_PATH_PROJECTION_CHROMIUM); | 2617 expected.cmd.Init(GL_PATH_PROJECTION_CHROMIUM); |
| 2468 | 2618 |
| 2469 gl_->MatrixLoadIdentityCHROMIUM(GL_PATH_PROJECTION_CHROMIUM); | 2619 gl_->MatrixLoadIdentityCHROMIUM(GL_PATH_PROJECTION_CHROMIUM); |
| 2470 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2620 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 2471 } | 2621 } |
| 2472 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ | 2622 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ |
| OLD | NEW |