| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 using ::testing::AtMost; | 35 using ::testing::AtMost; |
| 36 using ::testing::DoAll; | 36 using ::testing::DoAll; |
| 37 using ::testing::InSequence; | 37 using ::testing::InSequence; |
| 38 using ::testing::Invoke; | 38 using ::testing::Invoke; |
| 39 using ::testing::InvokeWithoutArgs; | 39 using ::testing::InvokeWithoutArgs; |
| 40 using ::testing::MatcherCast; | 40 using ::testing::MatcherCast; |
| 41 using ::testing::Pointee; | 41 using ::testing::Pointee; |
| 42 using ::testing::Return; | 42 using ::testing::Return; |
| 43 using ::testing::SetArrayArgument; | 43 using ::testing::SetArrayArgument; |
| 44 using ::testing::SetArgPointee; | 44 using ::testing::SetArgPointee; |
| 45 using ::testing::SetArgumentPointee; | |
| 46 using ::testing::StrEq; | 45 using ::testing::StrEq; |
| 47 using ::testing::StrictMock; | 46 using ::testing::StrictMock; |
| 48 using ::testing::WithArg; | 47 using ::testing::WithArg; |
| 49 | 48 |
| 50 namespace { | 49 namespace { |
| 51 | 50 |
| 52 void NormalizeInitState(gpu::gles2::GLES2DecoderTestBase::InitState* init) { | 51 void NormalizeInitState(gpu::gles2::GLES2DecoderTestBase::InitState* init) { |
| 53 CHECK(init); | 52 CHECK(init); |
| 54 const char* kVAOExtensions[] = { | 53 const char* kVAOExtensions[] = { |
| 55 "GL_OES_vertex_array_object", | 54 "GL_OES_vertex_array_object", |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // expectations. | 231 // expectations. |
| 233 EXPECT_CALL(*mock_decoder_, DoCommands(_, _, _, _)).WillRepeatedly( | 232 EXPECT_CALL(*mock_decoder_, DoCommands(_, _, _, _)).WillRepeatedly( |
| 234 Invoke(mock_decoder_.get(), &MockGLES2Decoder::FakeDoCommands)); | 233 Invoke(mock_decoder_.get(), &MockGLES2Decoder::FakeDoCommands)); |
| 235 | 234 |
| 236 EXPECT_TRUE(group_->Initialize(mock_decoder_.get(), init.context_type, | 235 EXPECT_TRUE(group_->Initialize(mock_decoder_.get(), init.context_type, |
| 237 DisallowedFeatures())); | 236 DisallowedFeatures())); |
| 238 | 237 |
| 239 if (init.context_type == CONTEXT_TYPE_WEBGL2 || | 238 if (init.context_type == CONTEXT_TYPE_WEBGL2 || |
| 240 init.context_type == CONTEXT_TYPE_OPENGLES3) { | 239 init.context_type == CONTEXT_TYPE_OPENGLES3) { |
| 241 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _)) | 240 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _)) |
| 242 .WillOnce(SetArgumentPointee<1>(kMaxColorAttachments)) | 241 .WillOnce(SetArgPointee<1>(kMaxColorAttachments)) |
| 243 .RetiresOnSaturation(); | 242 .RetiresOnSaturation(); |
| 244 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) | 243 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) |
| 245 .WillOnce(SetArgumentPointee<1>(kMaxDrawBuffers)) | 244 .WillOnce(SetArgPointee<1>(kMaxDrawBuffers)) |
| 246 .RetiresOnSaturation(); | 245 .RetiresOnSaturation(); |
| 247 | 246 |
| 248 EXPECT_CALL(*gl_, GenTransformFeedbacks(1, _)) | 247 EXPECT_CALL(*gl_, GenTransformFeedbacks(1, _)) |
| 249 .WillOnce(SetArgumentPointee<1>(kServiceDefaultTransformFeedbackId)) | 248 .WillOnce(SetArgPointee<1>(kServiceDefaultTransformFeedbackId)) |
| 250 .RetiresOnSaturation(); | 249 .RetiresOnSaturation(); |
| 251 EXPECT_CALL(*gl_, BindTransformFeedback(GL_TRANSFORM_FEEDBACK, | 250 EXPECT_CALL(*gl_, BindTransformFeedback(GL_TRANSFORM_FEEDBACK, |
| 252 kServiceDefaultTransformFeedbackId)) | 251 kServiceDefaultTransformFeedbackId)) |
| 253 .Times(1) | 252 .Times(1) |
| 254 .RetiresOnSaturation(); | 253 .RetiresOnSaturation(); |
| 255 } | 254 } |
| 256 | 255 |
| 257 if (group_->feature_info()->feature_flags().native_vertex_array_object) { | 256 if (group_->feature_info()->feature_flags().native_vertex_array_object) { |
| 258 EXPECT_CALL(*gl_, GenVertexArraysOES(1, _)) | 257 EXPECT_CALL(*gl_, GenVertexArraysOES(1, _)) |
| 259 .WillOnce(SetArgumentPointee<1>(kServiceVertexArrayId)) | 258 .WillOnce(SetArgPointee<1>(kServiceVertexArrayId)) |
| 260 .RetiresOnSaturation(); | 259 .RetiresOnSaturation(); |
| 261 EXPECT_CALL(*gl_, BindVertexArrayOES(_)).Times(1).RetiresOnSaturation(); | 260 EXPECT_CALL(*gl_, BindVertexArrayOES(_)).Times(1).RetiresOnSaturation(); |
| 262 } | 261 } |
| 263 | 262 |
| 264 if (group_->feature_info()->workarounds().init_vertex_attributes) | 263 if (group_->feature_info()->workarounds().init_vertex_attributes) |
| 265 AddExpectationsForVertexAttribManager(); | 264 AddExpectationsForVertexAttribManager(); |
| 266 | 265 |
| 267 AddExpectationsForBindVertexArrayOES(); | 266 AddExpectationsForBindVertexArrayOES(); |
| 268 | 267 |
| 269 if (!group_->feature_info()->gl_version_info().BehavesLikeGLES()) { | 268 if (!group_->feature_info()->gl_version_info().BehavesLikeGLES()) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 .RetiresOnSaturation(); | 341 .RetiresOnSaturation(); |
| 343 | 342 |
| 344 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER, 0)) | 343 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER, 0)) |
| 345 .Times(1) | 344 .Times(1) |
| 346 .RetiresOnSaturation(); | 345 .RetiresOnSaturation(); |
| 347 | 346 |
| 348 if (group_->feature_info()->gl_version_info().is_desktop_core_profile) { | 347 if (group_->feature_info()->gl_version_info().is_desktop_core_profile) { |
| 349 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( | 348 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( |
| 350 GL_FRAMEBUFFER, GL_BACK_LEFT, | 349 GL_FRAMEBUFFER, GL_BACK_LEFT, |
| 351 GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, _)) | 350 GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, _)) |
| 352 .WillOnce(SetArgumentPointee<3>(normalized_init.has_alpha ? 8 : 0)) | 351 .WillOnce(SetArgPointee<3>(normalized_init.has_alpha ? 8 : 0)) |
| 353 .RetiresOnSaturation(); | 352 .RetiresOnSaturation(); |
| 354 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( | 353 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( |
| 355 GL_FRAMEBUFFER, GL_DEPTH, | 354 GL_FRAMEBUFFER, GL_DEPTH, |
| 356 GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, _)) | 355 GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, _)) |
| 357 .WillOnce(SetArgumentPointee<3>(normalized_init.has_depth ? 24 : 0)) | 356 .WillOnce(SetArgPointee<3>(normalized_init.has_depth ? 24 : 0)) |
| 358 .RetiresOnSaturation(); | 357 .RetiresOnSaturation(); |
| 359 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( | 358 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( |
| 360 GL_FRAMEBUFFER, GL_STENCIL, | 359 GL_FRAMEBUFFER, GL_STENCIL, |
| 361 GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, _)) | 360 GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, _)) |
| 362 .WillOnce(SetArgumentPointee<3>(normalized_init.has_stencil ? 8 : 0)) | 361 .WillOnce(SetArgPointee<3>(normalized_init.has_stencil ? 8 : 0)) |
| 363 .RetiresOnSaturation(); | 362 .RetiresOnSaturation(); |
| 364 } else { | 363 } else { |
| 365 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) | 364 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
| 366 .WillOnce(SetArgumentPointee<1>(normalized_init.has_alpha ? 8 : 0)) | 365 .WillOnce(SetArgPointee<1>(normalized_init.has_alpha ? 8 : 0)) |
| 367 .RetiresOnSaturation(); | 366 .RetiresOnSaturation(); |
| 368 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 367 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
| 369 .WillOnce(SetArgumentPointee<1>(normalized_init.has_depth ? 24 : 0)) | 368 .WillOnce(SetArgPointee<1>(normalized_init.has_depth ? 24 : 0)) |
| 370 .RetiresOnSaturation(); | 369 .RetiresOnSaturation(); |
| 371 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) | 370 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
| 372 .WillOnce(SetArgumentPointee<1>(normalized_init.has_stencil ? 8 : 0)) | 371 .WillOnce(SetArgPointee<1>(normalized_init.has_stencil ? 8 : 0)) |
| 373 .RetiresOnSaturation(); | 372 .RetiresOnSaturation(); |
| 374 } | 373 } |
| 375 | 374 |
| 376 if (!group_->feature_info()->gl_version_info().BehavesLikeGLES()) { | 375 if (!group_->feature_info()->gl_version_info().BehavesLikeGLES()) { |
| 377 EXPECT_CALL(*gl_, Enable(GL_VERTEX_PROGRAM_POINT_SIZE)) | 376 EXPECT_CALL(*gl_, Enable(GL_VERTEX_PROGRAM_POINT_SIZE)) |
| 378 .Times(1) | 377 .Times(1) |
| 379 .RetiresOnSaturation(); | 378 .RetiresOnSaturation(); |
| 380 | 379 |
| 381 EXPECT_CALL(*gl_, Enable(GL_POINT_SPRITE)) | 380 EXPECT_CALL(*gl_, Enable(GL_POINT_SPRITE)) |
| 382 .Times(1) | 381 .Times(1) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 EXPECT_CALL(*context_, MakeCurrent(surface_.get())).WillOnce(Return(true)); | 472 EXPECT_CALL(*context_, MakeCurrent(surface_.get())).WillOnce(Return(true)); |
| 474 if (context_->WasAllocatedUsingRobustnessExtension()) { | 473 if (context_->WasAllocatedUsingRobustnessExtension()) { |
| 475 EXPECT_CALL(*gl_, GetGraphicsResetStatusARB()) | 474 EXPECT_CALL(*gl_, GetGraphicsResetStatusARB()) |
| 476 .WillOnce(Return(GL_NO_ERROR)); | 475 .WillOnce(Return(GL_NO_ERROR)); |
| 477 } | 476 } |
| 478 decoder_->MakeCurrent(); | 477 decoder_->MakeCurrent(); |
| 479 decoder_->set_engine(engine_.get()); | 478 decoder_->set_engine(engine_.get()); |
| 480 decoder_->BeginDecoding(); | 479 decoder_->BeginDecoding(); |
| 481 | 480 |
| 482 EXPECT_CALL(*gl_, GenBuffersARB(_, _)) | 481 EXPECT_CALL(*gl_, GenBuffersARB(_, _)) |
| 483 .WillOnce(SetArgumentPointee<1>(kServiceBufferId)) | 482 .WillOnce(SetArgPointee<1>(kServiceBufferId)) |
| 484 .RetiresOnSaturation(); | 483 .RetiresOnSaturation(); |
| 485 GenHelper<cmds::GenBuffersImmediate>(client_buffer_id_); | 484 GenHelper<cmds::GenBuffersImmediate>(client_buffer_id_); |
| 486 EXPECT_CALL(*gl_, GenFramebuffersEXT(_, _)) | 485 EXPECT_CALL(*gl_, GenFramebuffersEXT(_, _)) |
| 487 .WillOnce(SetArgumentPointee<1>(kServiceFramebufferId)) | 486 .WillOnce(SetArgPointee<1>(kServiceFramebufferId)) |
| 488 .RetiresOnSaturation(); | 487 .RetiresOnSaturation(); |
| 489 GenHelper<cmds::GenFramebuffersImmediate>(client_framebuffer_id_); | 488 GenHelper<cmds::GenFramebuffersImmediate>(client_framebuffer_id_); |
| 490 EXPECT_CALL(*gl_, GenRenderbuffersEXT(_, _)) | 489 EXPECT_CALL(*gl_, GenRenderbuffersEXT(_, _)) |
| 491 .WillOnce(SetArgumentPointee<1>(kServiceRenderbufferId)) | 490 .WillOnce(SetArgPointee<1>(kServiceRenderbufferId)) |
| 492 .RetiresOnSaturation(); | 491 .RetiresOnSaturation(); |
| 493 GenHelper<cmds::GenRenderbuffersImmediate>(client_renderbuffer_id_); | 492 GenHelper<cmds::GenRenderbuffersImmediate>(client_renderbuffer_id_); |
| 494 EXPECT_CALL(*gl_, GenTextures(_, _)) | 493 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 495 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)) | 494 .WillOnce(SetArgPointee<1>(kServiceTextureId)) |
| 496 .RetiresOnSaturation(); | 495 .RetiresOnSaturation(); |
| 497 GenHelper<cmds::GenTexturesImmediate>(client_texture_id_); | 496 GenHelper<cmds::GenTexturesImmediate>(client_texture_id_); |
| 498 EXPECT_CALL(*gl_, GenBuffersARB(_, _)) | 497 EXPECT_CALL(*gl_, GenBuffersARB(_, _)) |
| 499 .WillOnce(SetArgumentPointee<1>(kServiceElementBufferId)) | 498 .WillOnce(SetArgPointee<1>(kServiceElementBufferId)) |
| 500 .RetiresOnSaturation(); | 499 .RetiresOnSaturation(); |
| 501 GenHelper<cmds::GenBuffersImmediate>(client_element_buffer_id_); | 500 GenHelper<cmds::GenBuffersImmediate>(client_element_buffer_id_); |
| 502 GenHelper<cmds::GenQueriesEXTImmediate>(client_query_id_); | 501 GenHelper<cmds::GenQueriesEXTImmediate>(client_query_id_); |
| 503 | 502 |
| 504 DoCreateProgram(client_program_id_, kServiceProgramId); | 503 DoCreateProgram(client_program_id_, kServiceProgramId); |
| 505 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); | 504 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); |
| 506 | 505 |
| 507 // Unsafe commands. | 506 // Unsafe commands. |
| 508 bool reset_unsafe_es3_apis_enabled = false; | 507 bool reset_unsafe_es3_apis_enabled = false; |
| 509 if (!decoder_->unsafe_es3_apis_enabled()) { | 508 if (!decoder_->unsafe_es3_apis_enabled()) { |
| 510 decoder_->set_unsafe_es3_apis_enabled(true); | 509 decoder_->set_unsafe_es3_apis_enabled(true); |
| 511 reset_unsafe_es3_apis_enabled = true; | 510 reset_unsafe_es3_apis_enabled = true; |
| 512 } | 511 } |
| 513 | 512 |
| 514 const gl::GLVersionInfo* version = context_->GetVersionInfo(); | 513 const gl::GLVersionInfo* version = context_->GetVersionInfo(); |
| 515 if (version->IsAtLeastGL(3, 3) || version->IsAtLeastGLES(3, 0)) { | 514 if (version->IsAtLeastGL(3, 3) || version->IsAtLeastGLES(3, 0)) { |
| 516 EXPECT_CALL(*gl_, GenSamplers(_, _)) | 515 EXPECT_CALL(*gl_, GenSamplers(_, _)) |
| 517 .WillOnce(SetArgumentPointee<1>(kServiceSamplerId)) | 516 .WillOnce(SetArgPointee<1>(kServiceSamplerId)) |
| 518 .RetiresOnSaturation(); | 517 .RetiresOnSaturation(); |
| 519 GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_); | 518 GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_); |
| 520 } | 519 } |
| 521 if (version->IsAtLeastGL(4, 0) || version->IsAtLeastGLES(3, 0)) { | 520 if (version->IsAtLeastGL(4, 0) || version->IsAtLeastGLES(3, 0)) { |
| 522 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _)) | 521 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _)) |
| 523 .WillOnce(SetArgumentPointee<1>(kServiceTransformFeedbackId)) | 522 .WillOnce(SetArgPointee<1>(kServiceTransformFeedbackId)) |
| 524 .RetiresOnSaturation(); | 523 .RetiresOnSaturation(); |
| 525 GenHelper<cmds::GenTransformFeedbacksImmediate>( | 524 GenHelper<cmds::GenTransformFeedbacksImmediate>( |
| 526 client_transformfeedback_id_); | 525 client_transformfeedback_id_); |
| 527 } | 526 } |
| 528 | 527 |
| 529 if (init.extensions.find("GL_ARB_sync ") != std::string::npos || | 528 if (init.extensions.find("GL_ARB_sync ") != std::string::npos || |
| 530 version->IsAtLeastGL(3, 2) || version->IsAtLeastGLES(3, 0)) { | 529 version->IsAtLeastGL(3, 2) || version->IsAtLeastGLES(3, 0)) { |
| 531 DoFenceSync(client_sync_id_, kServiceSyncId); | 530 DoFenceSync(client_sync_id_, kServiceSyncId); |
| 532 } | 531 } |
| 533 | 532 |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 .Times(1) | 1427 .Times(1) |
| 1429 .RetiresOnSaturation(); | 1428 .RetiresOnSaturation(); |
| 1430 cmds::VertexAttribDivisorANGLE cmd; | 1429 cmds::VertexAttribDivisorANGLE cmd; |
| 1431 cmd.Init(index, divisor); | 1430 cmd.Init(index, divisor); |
| 1432 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1431 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1433 } | 1432 } |
| 1434 | 1433 |
| 1435 void GLES2DecoderTestBase::AddExpectationsForGenVertexArraysOES(){ | 1434 void GLES2DecoderTestBase::AddExpectationsForGenVertexArraysOES(){ |
| 1436 if (group_->feature_info()->feature_flags().native_vertex_array_object) { | 1435 if (group_->feature_info()->feature_flags().native_vertex_array_object) { |
| 1437 EXPECT_CALL(*gl_, GenVertexArraysOES(1, _)) | 1436 EXPECT_CALL(*gl_, GenVertexArraysOES(1, _)) |
| 1438 .WillOnce(SetArgumentPointee<1>(kServiceVertexArrayId)) | 1437 .WillOnce(SetArgPointee<1>(kServiceVertexArrayId)) |
| 1439 .RetiresOnSaturation(); | 1438 .RetiresOnSaturation(); |
| 1440 } | 1439 } |
| 1441 } | 1440 } |
| 1442 | 1441 |
| 1443 void GLES2DecoderTestBase::AddExpectationsForDeleteVertexArraysOES(){ | 1442 void GLES2DecoderTestBase::AddExpectationsForDeleteVertexArraysOES(){ |
| 1444 if (group_->feature_info()->feature_flags().native_vertex_array_object) { | 1443 if (group_->feature_info()->feature_flags().native_vertex_array_object) { |
| 1445 EXPECT_CALL(*gl_, DeleteVertexArraysOES(1, _)) | 1444 EXPECT_CALL(*gl_, DeleteVertexArraysOES(1, _)) |
| 1446 .Times(1) | 1445 .Times(1) |
| 1447 .RetiresOnSaturation(); | 1446 .RetiresOnSaturation(); |
| 1448 } | 1447 } |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 kOutputVariable1ColorName, kOutputVariable1Index, | 1799 kOutputVariable1ColorName, kOutputVariable1Index, |
| 1801 }}; | 1800 }}; |
| 1802 static TestHelper::ProgramOutputInfo kProgramOutputsESSL3[] = {{ | 1801 static TestHelper::ProgramOutputInfo kProgramOutputsESSL3[] = {{ |
| 1803 kOutputVariable1NameESSL3, kOutputVariable1Size, kOutputVariable1Type, | 1802 kOutputVariable1NameESSL3, kOutputVariable1Size, kOutputVariable1Type, |
| 1804 kOutputVariable1ColorName, kOutputVariable1Index, | 1803 kOutputVariable1ColorName, kOutputVariable1Index, |
| 1805 }}; | 1804 }}; |
| 1806 TestHelper::ProgramOutputInfo* program_outputs = | 1805 TestHelper::ProgramOutputInfo* program_outputs = |
| 1807 shader_language_version_ == 100 ? kProgramOutputsESSL1 | 1806 shader_language_version_ == 100 ? kProgramOutputsESSL1 |
| 1808 : kProgramOutputsESSL3; | 1807 : kProgramOutputsESSL3; |
| 1809 const size_t kNumProgramOutputs = 1; | 1808 const size_t kNumProgramOutputs = 1; |
| 1809 const int kNumUniformBlocks = 2; |
| 1810 const int kUniformBlockBinding[] = { 0, 1 }; |
| 1811 const int kUniformBlockDataSize[] = { 32, 16 }; |
| 1810 | 1812 |
| 1811 { | 1813 { |
| 1812 InSequence s; | 1814 InSequence s; |
| 1813 | 1815 |
| 1814 EXPECT_CALL(*gl_, | 1816 EXPECT_CALL(*gl_, |
| 1815 AttachShader(program_service_id, vertex_shader_service_id)) | 1817 AttachShader(program_service_id, vertex_shader_service_id)) |
| 1816 .Times(1) | 1818 .Times(1) |
| 1817 .RetiresOnSaturation(); | 1819 .RetiresOnSaturation(); |
| 1818 EXPECT_CALL(*gl_, | 1820 EXPECT_CALL(*gl_, |
| 1819 AttachShader(program_service_id, fragment_shader_service_id)) | 1821 AttachShader(program_service_id, fragment_shader_service_id)) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1847 nullptr, nullptr, nullptr, nullptr, | 1849 nullptr, nullptr, nullptr, nullptr, |
| 1848 &frag_output_variable_list, nullptr); | 1850 &frag_output_variable_list, nullptr); |
| 1849 | 1851 |
| 1850 cmds::AttachShader attach_cmd; | 1852 cmds::AttachShader attach_cmd; |
| 1851 attach_cmd.Init(program_client_id, vertex_shader_client_id); | 1853 attach_cmd.Init(program_client_id, vertex_shader_client_id); |
| 1852 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1854 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
| 1853 | 1855 |
| 1854 attach_cmd.Init(program_client_id, fragment_shader_client_id); | 1856 attach_cmd.Init(program_client_id, fragment_shader_client_id); |
| 1855 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1857 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
| 1856 | 1858 |
| 1859 if (shader_language_version_ == 300) { |
| 1860 EXPECT_CALL(*gl_, GetProgramiv( |
| 1861 program_service_id, GL_ACTIVE_UNIFORM_BLOCKS, _)) |
| 1862 .WillOnce(SetArgPointee<2>(kNumUniformBlocks)) |
| 1863 .RetiresOnSaturation(); |
| 1864 for (int ii = 0; ii < kNumUniformBlocks; ++ii) { |
| 1865 EXPECT_CALL(*gl_, |
| 1866 GetActiveUniformBlockiv(program_service_id, ii, |
| 1867 GL_UNIFORM_BLOCK_BINDING, _)) |
| 1868 .WillOnce(SetArgPointee<3>(kUniformBlockBinding[ii])) |
| 1869 .RetiresOnSaturation(); |
| 1870 EXPECT_CALL(*gl_, |
| 1871 GetActiveUniformBlockiv(program_service_id, ii, |
| 1872 GL_UNIFORM_BLOCK_DATA_SIZE, _)) |
| 1873 .WillOnce(SetArgPointee<3>(kUniformBlockDataSize[ii])) |
| 1874 .RetiresOnSaturation(); |
| 1875 } |
| 1876 } |
| 1877 |
| 1857 cmds::LinkProgram link_cmd; | 1878 cmds::LinkProgram link_cmd; |
| 1858 link_cmd.Init(program_client_id); | 1879 link_cmd.Init(program_client_id); |
| 1859 | 1880 |
| 1860 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd)); | 1881 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd)); |
| 1861 } | 1882 } |
| 1862 | 1883 |
| 1863 void GLES2DecoderTestBase::DoEnableDisable(GLenum cap, bool enable) { | 1884 void GLES2DecoderTestBase::DoEnableDisable(GLenum cap, bool enable) { |
| 1864 SetupExpectationsForEnableDisable(cap, enable); | 1885 SetupExpectationsForEnableDisable(cap, enable); |
| 1865 if (enable) { | 1886 if (enable) { |
| 1866 cmds::Enable cmd; | 1887 cmds::Enable cmd; |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 SetupDefaultProgram(); | 2110 SetupDefaultProgram(); |
| 2090 } | 2111 } |
| 2091 | 2112 |
| 2092 // Include the auto-generated part of this file. We split this because it means | 2113 // Include the auto-generated part of this file. We split this because it means |
| 2093 // we can easily edit the non-auto generated parts right here in this file | 2114 // we can easily edit the non-auto generated parts right here in this file |
| 2094 // instead of having to edit some template or the code generator. | 2115 // instead of having to edit some template or the code generator. |
| 2095 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 2116 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
| 2096 | 2117 |
| 2097 } // namespace gles2 | 2118 } // namespace gles2 |
| 2098 } // namespace gpu | 2119 } // namespace gpu |
| OLD | NEW |