| 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 3583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3594 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); | 3594 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); |
| 3595 EXPECT_EQ(3, width); | 3595 EXPECT_EQ(3, width); |
| 3596 EXPECT_EQ(1, height); | 3596 EXPECT_EQ(1, height); |
| 3597 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 3597 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 3598 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 3598 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 3599 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 3599 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 3600 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 3600 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 3601 | 3601 |
| 3602 // Bind image to texture. | 3602 // Bind image to texture. |
| 3603 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | 3603 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. |
| 3604 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); | 3604 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0); |
| 3605 EXPECT_TRUE( | 3605 EXPECT_TRUE( |
| 3606 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); | 3606 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); |
| 3607 // Image should now be set. | 3607 // Image should now be set. |
| 3608 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 3608 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 3609 | 3609 |
| 3610 // Define new texture image. | 3610 // Define new texture image. |
| 3611 DoTexImage2D( | 3611 DoTexImage2D( |
| 3612 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 3612 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 3613 EXPECT_TRUE( | 3613 EXPECT_TRUE( |
| 3614 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); | 3614 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); |
| 3615 // Image should no longer be set. | 3615 // Image should no longer be set. |
| 3616 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 3616 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 3617 } | 3617 } |
| 3618 | 3618 |
| 3619 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) { | 3619 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) { |
| 3620 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); | 3620 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); |
| 3621 GetImageManager()->AddImage(image.get(), 1); | 3621 GetImageManager()->AddImage(image.get(), 1); |
| 3622 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); | 3622 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); |
| 3623 | 3623 |
| 3624 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; | 3624 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; |
| 3625 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1); | 3625 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1, 0); |
| 3626 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); | 3626 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); |
| 3627 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 3627 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 3628 } | 3628 } |
| 3629 | 3629 |
| 3630 TEST_P(GLES2DecoderTest, OrphanGLImageWithTexImage2D) { | 3630 TEST_P(GLES2DecoderTest, OrphanGLImageWithTexImage2D) { |
| 3631 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); | 3631 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); |
| 3632 GetImageManager()->AddImage(image.get(), 1); | 3632 GetImageManager()->AddImage(image.get(), 1); |
| 3633 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 3633 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 3634 | 3634 |
| 3635 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); | 3635 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0); |
| 3636 | 3636 |
| 3637 TextureRef* texture_ref = | 3637 TextureRef* texture_ref = |
| 3638 group().texture_manager()->GetTexture(client_texture_id_); | 3638 group().texture_manager()->GetTexture(client_texture_id_); |
| 3639 ASSERT_TRUE(texture_ref != NULL); | 3639 ASSERT_TRUE(texture_ref != NULL); |
| 3640 Texture* texture = texture_ref->texture(); | 3640 Texture* texture = texture_ref->texture(); |
| 3641 | 3641 |
| 3642 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); | 3642 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); |
| 3643 DoTexImage2D( | 3643 DoTexImage2D( |
| 3644 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 3644 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 3645 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 3645 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3666 GLenum type = GL_UNSIGNED_BYTE; | 3666 GLenum type = GL_UNSIGNED_BYTE; |
| 3667 uint32_t pixels_shm_id = kSharedMemoryId; | 3667 uint32_t pixels_shm_id = kSharedMemoryId; |
| 3668 uint32_t pixels_shm_offset = kSharedMemoryOffset; | 3668 uint32_t pixels_shm_offset = kSharedMemoryOffset; |
| 3669 GLboolean internal = 0; | 3669 GLboolean internal = 0; |
| 3670 | 3670 |
| 3671 // Define texture first. | 3671 // Define texture first. |
| 3672 DoTexImage2D(target, level, format, width, height, border, format, type, | 3672 DoTexImage2D(target, level, format, width, height, border, format, type, |
| 3673 pixels_shm_id, pixels_shm_offset); | 3673 pixels_shm_id, pixels_shm_offset); |
| 3674 | 3674 |
| 3675 // Bind texture to GLImage. | 3675 // Bind texture to GLImage. |
| 3676 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); | 3676 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0); |
| 3677 | 3677 |
| 3678 // Check binding. | 3678 // Check binding. |
| 3679 TextureRef* texture_ref = | 3679 TextureRef* texture_ref = |
| 3680 group().texture_manager()->GetTexture(client_texture_id_); | 3680 group().texture_manager()->GetTexture(client_texture_id_); |
| 3681 ASSERT_TRUE(texture_ref != NULL); | 3681 ASSERT_TRUE(texture_ref != NULL); |
| 3682 Texture* texture = texture_ref->texture(); | 3682 Texture* texture = texture_ref->texture(); |
| 3683 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); | 3683 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); |
| 3684 | 3684 |
| 3685 // TexSubImage2D should not unbind GLImage. | 3685 // TexSubImage2D should not unbind GLImage. |
| 3686 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width, | 3686 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3710 GLenum format = GL_RGBA; | 3710 GLenum format = GL_RGBA; |
| 3711 GLenum type = GL_UNSIGNED_BYTE; | 3711 GLenum type = GL_UNSIGNED_BYTE; |
| 3712 uint32_t pixels_shm_id = kSharedMemoryId; | 3712 uint32_t pixels_shm_id = kSharedMemoryId; |
| 3713 uint32_t pixels_shm_offset = kSharedMemoryOffset; | 3713 uint32_t pixels_shm_offset = kSharedMemoryOffset; |
| 3714 | 3714 |
| 3715 // Define texture first. | 3715 // Define texture first. |
| 3716 DoTexImage2D(target, level, format, width, height, border, format, type, | 3716 DoTexImage2D(target, level, format, width, height, border, format, type, |
| 3717 pixels_shm_id, pixels_shm_offset); | 3717 pixels_shm_id, pixels_shm_offset); |
| 3718 | 3718 |
| 3719 // Bind texture to GLImage. | 3719 // Bind texture to GLImage. |
| 3720 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); | 3720 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0); |
| 3721 | 3721 |
| 3722 // Check binding. | 3722 // Check binding. |
| 3723 TextureRef* texture_ref = | 3723 TextureRef* texture_ref = |
| 3724 group().texture_manager()->GetTexture(client_texture_id_); | 3724 group().texture_manager()->GetTexture(client_texture_id_); |
| 3725 ASSERT_TRUE(texture_ref != NULL); | 3725 ASSERT_TRUE(texture_ref != NULL); |
| 3726 Texture* texture = texture_ref->texture(); | 3726 Texture* texture = texture_ref->texture(); |
| 3727 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); | 3727 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); |
| 3728 | 3728 |
| 3729 // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage. | 3729 // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage. |
| 3730 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) | 3730 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3762 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); | 3762 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); |
| 3763 EXPECT_EQ(3, width); | 3763 EXPECT_EQ(3, width); |
| 3764 EXPECT_EQ(1, height); | 3764 EXPECT_EQ(1, height); |
| 3765 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 3765 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 3766 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 3766 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 3767 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 3767 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 3768 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 3768 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 3769 | 3769 |
| 3770 // Bind image to texture. | 3770 // Bind image to texture. |
| 3771 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | 3771 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. |
| 3772 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); | 3772 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0); |
| 3773 EXPECT_TRUE( | 3773 EXPECT_TRUE( |
| 3774 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); | 3774 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); |
| 3775 // Image should now be set. | 3775 // Image should now be set. |
| 3776 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 3776 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 3777 | 3777 |
| 3778 // Release image from texture. | 3778 // Release image from texture. |
| 3779 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | 3779 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. |
| 3780 EXPECT_CALL(*gl_, GetError()) | 3780 EXPECT_CALL(*gl_, GetError()) |
| 3781 .WillOnce(Return(GL_NO_ERROR)) | 3781 .WillOnce(Return(GL_NO_ERROR)) |
| 3782 .WillOnce(Return(GL_NO_ERROR)) | 3782 .WillOnce(Return(GL_NO_ERROR)) |
| 3783 .RetiresOnSaturation(); | 3783 .RetiresOnSaturation(); |
| 3784 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; | 3784 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; |
| 3785 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); | 3785 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); |
| 3786 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); | 3786 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); |
| 3787 EXPECT_TRUE( | 3787 EXPECT_TRUE( |
| 3788 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); | 3788 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); |
| 3789 // Image should no longer be set. | 3789 // Image should no longer be set. |
| 3790 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 3790 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 3791 } | 3791 } |
| 3792 | 3792 |
| 3793 class MockGLImage : public gl::GLImage { | 3793 class MockGLImage : public gl::GLImage { |
| 3794 public: | 3794 public: |
| 3795 MockGLImage() {} | 3795 MockGLImage() {} |
| 3796 | 3796 |
| 3797 // Overridden from gl::GLImage: | 3797 // Overridden from gl::GLImage: |
| 3798 MOCK_METHOD0(GetSize, gfx::Size()); | 3798 MOCK_METHOD0(GetSize, gfx::Size()); |
| 3799 MOCK_METHOD0(GetInternalFormat, unsigned()); | 3799 MOCK_METHOD0(GetInternalFormat, unsigned()); |
| 3800 MOCK_METHOD1(BindTexImage, bool(unsigned)); | 3800 MOCK_METHOD2(BindTexImage, bool(unsigned, gl::GLFence*)); |
| 3801 MOCK_METHOD1(ReleaseTexImage, void(unsigned)); | 3801 MOCK_METHOD1(ReleaseTexImage, void(unsigned)); |
| 3802 MOCK_METHOD1(CopyTexImage, bool(unsigned)); | 3802 MOCK_METHOD1(CopyTexImage, bool(unsigned)); |
| 3803 MOCK_METHOD3(CopyTexSubImage, | 3803 MOCK_METHOD3(CopyTexSubImage, |
| 3804 bool(unsigned, const gfx::Point&, const gfx::Rect&)); | 3804 bool(unsigned, const gfx::Point&, const gfx::Rect&)); |
| 3805 MOCK_METHOD5(ScheduleOverlayPlane, bool(gfx::AcceleratedWidget, | 3805 MOCK_METHOD5(ScheduleOverlayPlane, bool(gfx::AcceleratedWidget, |
| 3806 int, | 3806 int, |
| 3807 gfx::OverlayTransform, | 3807 gfx::OverlayTransform, |
| 3808 const gfx::Rect&, | 3808 const gfx::Rect&, |
| 3809 const gfx::RectF&)); | 3809 const gfx::RectF&)); |
| 3810 MOCK_METHOD3(OnMemoryDump, | 3810 MOCK_METHOD3(OnMemoryDump, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3834 group().texture_manager()->GetTexture(client_texture_id_); | 3834 group().texture_manager()->GetTexture(client_texture_id_); |
| 3835 ASSERT_TRUE(texture_ref != NULL); | 3835 ASSERT_TRUE(texture_ref != NULL); |
| 3836 Texture* texture = texture_ref->texture(); | 3836 Texture* texture = texture_ref->texture(); |
| 3837 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 3837 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
| 3838 | 3838 |
| 3839 const int32_t kImageId = 1; | 3839 const int32_t kImageId = 1; |
| 3840 scoped_refptr<MockGLImage> image(new MockGLImage); | 3840 scoped_refptr<MockGLImage> image(new MockGLImage); |
| 3841 GetImageManager()->AddImage(image.get(), kImageId); | 3841 GetImageManager()->AddImage(image.get(), kImageId); |
| 3842 | 3842 |
| 3843 // Bind image to texture. | 3843 // Bind image to texture. |
| 3844 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) | 3844 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D, nullptr)) |
| 3845 .Times(1) | 3845 .Times(1) |
| 3846 .WillOnce(Return(false)) | 3846 .WillOnce(Return(false)) |
| 3847 .RetiresOnSaturation(); | 3847 .RetiresOnSaturation(); |
| 3848 EXPECT_CALL(*image.get(), GetSize()) | 3848 EXPECT_CALL(*image.get(), GetSize()) |
| 3849 .Times(1) | 3849 .Times(1) |
| 3850 .WillOnce(Return(gfx::Size(1, 1))) | 3850 .WillOnce(Return(gfx::Size(1, 1))) |
| 3851 .RetiresOnSaturation(); | 3851 .RetiresOnSaturation(); |
| 3852 EXPECT_CALL(*image.get(), GetInternalFormat()) | 3852 EXPECT_CALL(*image.get(), GetInternalFormat()) |
| 3853 .Times(1) | 3853 .Times(1) |
| 3854 .WillOnce(Return(GL_RGBA)) | 3854 .WillOnce(Return(GL_RGBA)) |
| 3855 .RetiresOnSaturation(); | 3855 .RetiresOnSaturation(); |
| 3856 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | 3856 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. |
| 3857 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId); | 3857 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId, 0); |
| 3858 | 3858 |
| 3859 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 3859 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 3860 SetupExpectationsForApplyingDefaultDirtyState(); | 3860 SetupExpectationsForApplyingDefaultDirtyState(); |
| 3861 | 3861 |
| 3862 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | 3862 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. |
| 3863 EXPECT_CALL(*gl_, GetError()) | 3863 EXPECT_CALL(*gl_, GetError()) |
| 3864 .WillOnce(Return(GL_NO_ERROR)) | 3864 .WillOnce(Return(GL_NO_ERROR)) |
| 3865 .WillOnce(Return(GL_NO_ERROR)) | 3865 .WillOnce(Return(GL_NO_ERROR)) |
| 3866 .RetiresOnSaturation(); | 3866 .RetiresOnSaturation(); |
| 3867 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(2).RetiresOnSaturation(); | 3867 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(2).RetiresOnSaturation(); |
| 3868 EXPECT_CALL(*image.get(), CopyTexImage(GL_TEXTURE_2D)) | 3868 EXPECT_CALL(*image.get(), CopyTexImage(GL_TEXTURE_2D)) |
| 3869 .Times(1) | 3869 .Times(1) |
| 3870 .WillOnce(Return(true)) | 3870 .WillOnce(Return(true)) |
| 3871 .RetiresOnSaturation(); | 3871 .RetiresOnSaturation(); |
| 3872 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 3872 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3873 .Times(1) | 3873 .Times(1) |
| 3874 .RetiresOnSaturation(); | 3874 .RetiresOnSaturation(); |
| 3875 DrawArrays cmd; | 3875 DrawArrays cmd; |
| 3876 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 3876 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 3877 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3877 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3878 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3878 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3879 | 3879 |
| 3880 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 3880 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 3881 // Re-bind image to texture. | 3881 // Re-bind image to texture. |
| 3882 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; | 3882 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; |
| 3883 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, kImageId); | 3883 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, kImageId); |
| 3884 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); | 3884 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); |
| 3885 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) | 3885 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D, nullptr)) |
| 3886 .Times(1) | 3886 .Times(1) |
| 3887 .WillOnce(Return(false)) | 3887 .WillOnce(Return(false)) |
| 3888 .RetiresOnSaturation(); | 3888 .RetiresOnSaturation(); |
| 3889 EXPECT_CALL(*image.get(), GetSize()) | 3889 EXPECT_CALL(*image.get(), GetSize()) |
| 3890 .Times(1) | 3890 .Times(1) |
| 3891 .WillOnce(Return(gfx::Size(1, 1))) | 3891 .WillOnce(Return(gfx::Size(1, 1))) |
| 3892 .RetiresOnSaturation(); | 3892 .RetiresOnSaturation(); |
| 3893 EXPECT_CALL(*image.get(), GetInternalFormat()) | 3893 EXPECT_CALL(*image.get(), GetInternalFormat()) |
| 3894 .Times(1) | 3894 .Times(1) |
| 3895 .WillOnce(Return(GL_RGBA)) | 3895 .WillOnce(Return(GL_RGBA)) |
| 3896 .RetiresOnSaturation(); | 3896 .RetiresOnSaturation(); |
| 3897 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId); | 3897 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId, 0); |
| 3898 | 3898 |
| 3899 DoBindFramebuffer( | 3899 DoBindFramebuffer( |
| 3900 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 3900 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| 3901 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | 3901 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. |
| 3902 EXPECT_CALL(*gl_, GetError()) | 3902 EXPECT_CALL(*gl_, GetError()) |
| 3903 .WillOnce(Return(GL_NO_ERROR)) | 3903 .WillOnce(Return(GL_NO_ERROR)) |
| 3904 .WillOnce(Return(GL_NO_ERROR)) | 3904 .WillOnce(Return(GL_NO_ERROR)) |
| 3905 .RetiresOnSaturation(); | 3905 .RetiresOnSaturation(); |
| 3906 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(1).RetiresOnSaturation(); | 3906 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(1).RetiresOnSaturation(); |
| 3907 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) | 3907 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4579 int image_id = use_rgb_emulation * 2 + destination_texture_index; | 4579 int image_id = use_rgb_emulation * 2 + destination_texture_index; |
| 4580 scoped_refptr<gl::GLImage> image; | 4580 scoped_refptr<gl::GLImage> image; |
| 4581 if (use_rgb_emulation) | 4581 if (use_rgb_emulation) |
| 4582 image = new EmulatingRGBImageStub; | 4582 image = new EmulatingRGBImageStub; |
| 4583 else | 4583 else |
| 4584 image = new gl::GLImageStub; | 4584 image = new gl::GLImageStub; |
| 4585 GetImageManager()->AddImage(image.get(), image_id); | 4585 GetImageManager()->AddImage(image.get(), image_id); |
| 4586 EXPECT_FALSE(GetImageManager()->LookupImage(image_id) == NULL); | 4586 EXPECT_FALSE(GetImageManager()->LookupImage(image_id) == NULL); |
| 4587 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); | 4587 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| 4588 | 4588 |
| 4589 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); | 4589 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id, 0); |
| 4590 DoFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, | 4590 DoFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, |
| 4591 kFBOClientTextureId, kFBOServiceTextureId, level, | 4591 kFBOClientTextureId, kFBOServiceTextureId, level, |
| 4592 GL_NO_ERROR); | 4592 GL_NO_ERROR); |
| 4593 | 4593 |
| 4594 GLenum destination_texture_format = | 4594 GLenum destination_texture_format = |
| 4595 destination_texture_formats[destination_texture_index]; | 4595 destination_texture_formats[destination_texture_index]; |
| 4596 bool should_succeed = | 4596 bool should_succeed = |
| 4597 !use_rgb_emulation || (destination_texture_format == GL_RGB); | 4597 !use_rgb_emulation || (destination_texture_format == GL_RGB); |
| 4598 if (should_succeed) { | 4598 if (should_succeed) { |
| 4599 EXPECT_CALL(*gl_, GetError()) | 4599 EXPECT_CALL(*gl_, GetError()) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4687 // TODO(gman): CompressedTexSubImage2DImmediate | 4687 // TODO(gman): CompressedTexSubImage2DImmediate |
| 4688 | 4688 |
| 4689 // TODO(gman): TexImage2D | 4689 // TODO(gman): TexImage2D |
| 4690 | 4690 |
| 4691 // TODO(gman): TexImage2DImmediate | 4691 // TODO(gman): TexImage2DImmediate |
| 4692 | 4692 |
| 4693 // TODO(gman): TexSubImage2DImmediate | 4693 // TODO(gman): TexSubImage2DImmediate |
| 4694 | 4694 |
| 4695 } // namespace gles2 | 4695 } // namespace gles2 |
| 4696 } // namespace gpu | 4696 } // namespace gpu |
| OLD | NEW |