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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 3853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3864 ASSERT_TRUE(texture_ref != NULL); | 3864 ASSERT_TRUE(texture_ref != NULL); |
3865 Texture* texture = texture_ref->texture(); | 3865 Texture* texture = texture_ref->texture(); |
3866 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 3866 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
3867 | 3867 |
3868 const int32_t kImageId = 1; | 3868 const int32_t kImageId = 1; |
3869 scoped_refptr<MockGLImage> image(new MockGLImage); | 3869 scoped_refptr<MockGLImage> image(new MockGLImage); |
3870 GetImageManager()->AddImage(image.get(), kImageId); | 3870 GetImageManager()->AddImage(image.get(), kImageId); |
3871 | 3871 |
3872 // Bind image to texture. | 3872 // Bind image to texture. |
3873 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) | 3873 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) |
3874 .Times(1) | 3874 .Times(2) |
3875 .WillOnce(Return(false)) | 3875 .WillRepeatedly(Return(false)) |
3876 .RetiresOnSaturation(); | 3876 .RetiresOnSaturation(); |
3877 EXPECT_CALL(*image.get(), GetSize()) | 3877 EXPECT_CALL(*image.get(), GetSize()) |
3878 .Times(1) | 3878 .Times(1) |
3879 .WillOnce(Return(gfx::Size(1, 1))) | 3879 .WillOnce(Return(gfx::Size(1, 1))) |
3880 .RetiresOnSaturation(); | 3880 .RetiresOnSaturation(); |
3881 EXPECT_CALL(*image.get(), GetInternalFormat()) | 3881 EXPECT_CALL(*image.get(), GetInternalFormat()) |
3882 .Times(1) | 3882 .Times(1) |
3883 .WillOnce(Return(GL_RGBA)) | 3883 .WillOnce(Return(GL_RGBA)) |
3884 .RetiresOnSaturation(); | 3884 .RetiresOnSaturation(); |
| 3885 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
| 3886 .Times(1) |
| 3887 .RetiresOnSaturation(); |
3885 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | 3888 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. |
3886 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId); | 3889 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId); |
3887 | 3890 |
3888 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 3891 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
3889 SetupExpectationsForApplyingDefaultDirtyState(); | 3892 SetupExpectationsForApplyingDefaultDirtyState(); |
3890 | 3893 |
3891 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | 3894 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. |
3892 EXPECT_CALL(*gl_, GetError()) | 3895 EXPECT_CALL(*gl_, GetError()) |
3893 .WillOnce(Return(GL_NO_ERROR)) | 3896 .WillOnce(Return(GL_NO_ERROR)) |
3894 .WillOnce(Return(GL_NO_ERROR)) | 3897 .WillOnce(Return(GL_NO_ERROR)) |
3895 .RetiresOnSaturation(); | 3898 .RetiresOnSaturation(); |
3896 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(2).RetiresOnSaturation(); | 3899 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(2).RetiresOnSaturation(); |
3897 EXPECT_CALL(*image.get(), CopyTexImage(GL_TEXTURE_2D)) | 3900 EXPECT_CALL(*image.get(), CopyTexImage(GL_TEXTURE_2D)) |
3898 .Times(1) | 3901 .Times(1) |
3899 .WillOnce(Return(true)) | 3902 .WillOnce(Return(true)) |
3900 .RetiresOnSaturation(); | 3903 .RetiresOnSaturation(); |
3901 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 3904 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
3902 .Times(1) | 3905 .Times(1) |
3903 .RetiresOnSaturation(); | 3906 .RetiresOnSaturation(); |
3904 DrawArrays cmd; | 3907 DrawArrays cmd; |
3905 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 3908 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
3906 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3909 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3907 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3910 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3908 | 3911 |
3909 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 3912 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 3913 |
| 3914 Mock::VerifyAndClearExpectations(gl_.get()); |
3910 // Re-bind image to texture. | 3915 // Re-bind image to texture. |
3911 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; | 3916 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; |
3912 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, kImageId); | 3917 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, kImageId); |
3913 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); | 3918 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); |
3914 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) | 3919 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) |
3915 .Times(1) | 3920 .Times(2) |
3916 .WillOnce(Return(false)) | 3921 .WillRepeatedly(Return(false)) |
3917 .RetiresOnSaturation(); | 3922 .RetiresOnSaturation(); |
3918 EXPECT_CALL(*image.get(), GetSize()) | 3923 EXPECT_CALL(*image.get(), GetSize()) |
3919 .Times(1) | 3924 .Times(1) |
3920 .WillOnce(Return(gfx::Size(1, 1))) | 3925 .WillOnce(Return(gfx::Size(1, 1))) |
3921 .RetiresOnSaturation(); | 3926 .RetiresOnSaturation(); |
3922 EXPECT_CALL(*image.get(), GetInternalFormat()) | 3927 EXPECT_CALL(*image.get(), GetInternalFormat()) |
3923 .Times(1) | 3928 .Times(1) |
3924 .WillOnce(Return(GL_RGBA)) | 3929 .WillOnce(Return(GL_RGBA)) |
3925 .RetiresOnSaturation(); | 3930 .RetiresOnSaturation(); |
3926 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId); | 3931 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId); |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4966 // TODO(gman): CompressedTexSubImage2DImmediate | 4971 // TODO(gman): CompressedTexSubImage2DImmediate |
4967 | 4972 |
4968 // TODO(gman): TexImage2D | 4973 // TODO(gman): TexImage2D |
4969 | 4974 |
4970 // TODO(gman): TexImage2DImmediate | 4975 // TODO(gman): TexImage2DImmediate |
4971 | 4976 |
4972 // TODO(gman): TexSubImage2DImmediate | 4977 // TODO(gman): TexSubImage2DImmediate |
4973 | 4978 |
4974 } // namespace gles2 | 4979 } // namespace gles2 |
4975 } // namespace gpu | 4980 } // namespace gpu |
OLD | NEW |