| 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.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 11 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 11 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 13 #include "gpu/command_buffer/service/context_group.h" | 13 #include "gpu/command_buffer/service/context_group.h" |
| 14 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 14 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
| 15 #include "gpu/command_buffer/service/program_manager.h" | 15 #include "gpu/command_buffer/service/program_manager.h" |
| 16 #include "gpu/command_buffer/service/test_helper.h" | 16 #include "gpu/command_buffer/service/test_helper.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "ui/gl/gl_mock.h" | 18 #include "ui/gl/gl_mock.h" |
| 19 | 19 |
| 20 using ::gl::MockGLInterface; | 20 using ::gl::MockGLInterface; |
| 21 using ::testing::_; | 21 using ::testing::_; |
| 22 using ::testing::AnyNumber; | 22 using ::testing::AnyNumber; |
| 23 using ::testing::DoAll; | 23 using ::testing::DoAll; |
| 24 using ::testing::InSequence; | 24 using ::testing::InSequence; |
| 25 using ::testing::MatcherCast; | 25 using ::testing::MatcherCast; |
| 26 using ::testing::Pointee; | 26 using ::testing::Pointee; |
| 27 using ::testing::Return; | 27 using ::testing::Return; |
| 28 using ::testing::SetArrayArgument; | 28 using ::testing::SetArrayArgument; |
| 29 using ::testing::SetArgumentPointee; | 29 using ::testing::SetArgPointee; |
| 30 using ::testing::StrEq; | 30 using ::testing::StrEq; |
| 31 | 31 |
| 32 namespace gpu { | 32 namespace gpu { |
| 33 namespace gles2 { | 33 namespace gles2 { |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 void ShaderCacheCb(const std::string& key, const std::string& shader) { | 36 void ShaderCacheCb(const std::string& key, const std::string& shader) { |
| 37 } | 37 } |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 .Times(1) | 607 .Times(1) |
| 608 .RetiresOnSaturation(); | 608 .RetiresOnSaturation(); |
| 609 EXPECT_CALL(*gl_, | 609 EXPECT_CALL(*gl_, |
| 610 AttachShader(kServiceProgramId, kServiceFragmentShaderId)) | 610 AttachShader(kServiceProgramId, kServiceFragmentShaderId)) |
| 611 .Times(1) | 611 .Times(1) |
| 612 .RetiresOnSaturation(); | 612 .RetiresOnSaturation(); |
| 613 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId)) | 613 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId)) |
| 614 .Times(1) | 614 .Times(1) |
| 615 .RetiresOnSaturation(); | 615 .RetiresOnSaturation(); |
| 616 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _)) | 616 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _)) |
| 617 .WillOnce(SetArgumentPointee<2>(1)); | 617 .WillOnce(SetArgPointee<2>(1)); |
| 618 EXPECT_CALL(*gl_, | 618 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _)) |
| 619 GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _)) | 619 .WillOnce(SetArgPointee<2>(strlen(log) + 1)) |
| 620 .WillOnce(SetArgumentPointee<2>(strlen(log) + 1)) | |
| 621 .RetiresOnSaturation(); | 620 .RetiresOnSaturation(); |
| 622 EXPECT_CALL(*gl_, | 621 EXPECT_CALL(*gl_, GetProgramInfoLog(kServiceProgramId, strlen(log) + 1, _, _)) |
| 623 GetProgramInfoLog(kServiceProgramId, strlen(log) + 1, _, _)) | 622 .WillOnce(DoAll(SetArgPointee<2>(strlen(log)), |
| 624 .WillOnce(DoAll( | 623 SetArrayArgument<3>(log, log + strlen(log) + 1))) |
| 625 SetArgumentPointee<2>(strlen(log)), | |
| 626 SetArrayArgument<3>(log, log + strlen(log) + 1))) | |
| 627 .RetiresOnSaturation(); | 624 .RetiresOnSaturation(); |
| 628 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _)) | 625 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _)) |
| 629 .WillOnce(SetArgumentPointee<2>(0)); | 626 .WillOnce(SetArgPointee<2>(0)); |
| 630 EXPECT_CALL( | 627 EXPECT_CALL( |
| 631 *gl_, | 628 *gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _)) |
| 632 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _)) | 629 .WillOnce(SetArgPointee<2>(0)); |
| 633 .WillOnce(SetArgumentPointee<2>(0)); | |
| 634 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORMS, _)) | 630 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORMS, _)) |
| 635 .WillOnce(SetArgumentPointee<2>(0)); | 631 .WillOnce(SetArgPointee<2>(0)); |
| 636 | 632 |
| 637 Program* program = GetProgram(client_program_id_); | 633 Program* program = GetProgram(client_program_id_); |
| 638 ASSERT_TRUE(program != NULL); | 634 ASSERT_TRUE(program != NULL); |
| 639 | 635 |
| 640 cmds::AttachShader attach_cmd; | 636 cmds::AttachShader attach_cmd; |
| 641 attach_cmd.Init(client_program_id_, kClientVertexShaderId); | 637 attach_cmd.Init(client_program_id_, kClientVertexShaderId); |
| 642 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 638 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
| 643 | 639 |
| 644 attach_cmd.Init(client_program_id_, kClientFragmentShaderId); | 640 attach_cmd.Init(client_program_id_, kClientFragmentShaderId); |
| 645 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 641 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 InSequence dummy; | 719 InSequence dummy; |
| 724 EXPECT_CALL(*gl_, | 720 EXPECT_CALL(*gl_, |
| 725 AttachShader(kServiceProgramId, kServiceVertexShaderId)) | 721 AttachShader(kServiceProgramId, kServiceVertexShaderId)) |
| 726 .Times(1) | 722 .Times(1) |
| 727 .RetiresOnSaturation(); | 723 .RetiresOnSaturation(); |
| 728 EXPECT_CALL(*gl_, | 724 EXPECT_CALL(*gl_, |
| 729 AttachShader(kServiceProgramId, kServiceFragmentShaderId)) | 725 AttachShader(kServiceProgramId, kServiceFragmentShaderId)) |
| 730 .Times(1) | 726 .Times(1) |
| 731 .RetiresOnSaturation(); | 727 .RetiresOnSaturation(); |
| 732 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _)) | 728 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_LINK_STATUS, _)) |
| 733 .WillOnce(SetArgumentPointee<2>(1)); | 729 .WillOnce(SetArgPointee<2>(1)); |
| 734 EXPECT_CALL(*gl_, | 730 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _)) |
| 735 GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _)) | 731 .WillOnce(SetArgPointee<2>(0)) |
| 736 .WillOnce(SetArgumentPointee<2>(0)) | |
| 737 .RetiresOnSaturation(); | 732 .RetiresOnSaturation(); |
| 738 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _)) | 733 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTES, _)) |
| 739 .WillOnce(SetArgumentPointee<2>(0)); | 734 .WillOnce(SetArgPointee<2>(0)); |
| 740 EXPECT_CALL( | 735 EXPECT_CALL( |
| 741 *gl_, | 736 *gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _)) |
| 742 GetProgramiv(kServiceProgramId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _)) | 737 .WillOnce(SetArgPointee<2>(0)); |
| 743 .WillOnce(SetArgumentPointee<2>(0)); | |
| 744 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORMS, _)) | 738 EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_ACTIVE_UNIFORMS, _)) |
| 745 .WillOnce(SetArgumentPointee<2>(0)); | 739 .WillOnce(SetArgPointee<2>(0)); |
| 746 | 740 |
| 747 cmds::AttachShader attach_cmd; | 741 cmds::AttachShader attach_cmd; |
| 748 attach_cmd.Init(client_program_id_, kClientVertexShaderId); | 742 attach_cmd.Init(client_program_id_, kClientVertexShaderId); |
| 749 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 743 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
| 750 | 744 |
| 751 attach_cmd.Init(client_program_id_, kClientFragmentShaderId); | 745 attach_cmd.Init(client_program_id_, kClientFragmentShaderId); |
| 752 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 746 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
| 753 }; | 747 }; |
| 754 | 748 |
| 755 template <> | 749 template <> |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 TestAcceptedUniform(GL_FLOAT_MAT4x2, Program::kUniformMatrix4x2f, true); | 1055 TestAcceptedUniform(GL_FLOAT_MAT4x2, Program::kUniformMatrix4x2f, true); |
| 1062 } | 1056 } |
| 1063 | 1057 |
| 1064 TEST_P(GLES3DecoderTest2, AcceptsUniform_GL_FLOAT_MAT4x3) { | 1058 TEST_P(GLES3DecoderTest2, AcceptsUniform_GL_FLOAT_MAT4x3) { |
| 1065 TestAcceptedUniform(GL_FLOAT_MAT4x3, Program::kUniformMatrix4x3f, true); | 1059 TestAcceptedUniform(GL_FLOAT_MAT4x3, Program::kUniformMatrix4x3f, true); |
| 1066 } | 1060 } |
| 1067 | 1061 |
| 1068 } // namespace gles2 | 1062 } // namespace gles2 |
| 1069 } // namespace gpu | 1063 } // namespace gpu |
| 1070 | 1064 |
| OLD | NEW |