| 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 3742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3753 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 3753 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 3754 CopyTexImage2D cmd; | 3754 CopyTexImage2D cmd; |
| 3755 cmd.Init(target, level, destination_texture_format, 0, 0, width, height); | 3755 cmd.Init(target, level, destination_texture_format, 0, 0, width, height); |
| 3756 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3756 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3757 GLenum expectation = should_succeed ? GL_NO_ERROR : GL_INVALID_OPERATION; | 3757 GLenum expectation = should_succeed ? GL_NO_ERROR : GL_INVALID_OPERATION; |
| 3758 EXPECT_EQ(expectation, static_cast<GLenum>(GetGLError())); | 3758 EXPECT_EQ(expectation, static_cast<GLenum>(GetGLError())); |
| 3759 } | 3759 } |
| 3760 } | 3760 } |
| 3761 } | 3761 } |
| 3762 | 3762 |
| 3763 TEST_P(GLES2DecoderTest, BindTextureValidArgs) { |
| 3764 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
| 3765 .Times(1) |
| 3766 .RetiresOnSaturation(); |
| 3767 if (!feature_info()->gl_version_info().BehavesLikeGLES() && |
| 3768 feature_info()->gl_version_info().IsAtLeastGL(3, 2)) { |
| 3769 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, |
| 3770 GL_DEPTH_TEXTURE_MODE, |
| 3771 GL_RED)) |
| 3772 .Times(1) |
| 3773 .RetiresOnSaturation(); |
| 3774 } |
| 3775 cmds::BindTexture cmd; |
| 3776 cmd.Init(GL_TEXTURE_2D, client_texture_id_); |
| 3777 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3778 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3779 } |
| 3780 |
| 3781 TEST_P(GLES2DecoderTest, BindTextureValidArgsNewId) { |
| 3782 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) |
| 3783 .Times(1) |
| 3784 .RetiresOnSaturation(); |
| 3785 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 3786 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); |
| 3787 if (!feature_info()->gl_version_info().BehavesLikeGLES() && |
| 3788 feature_info()->gl_version_info().IsAtLeastGL(3, 2)) { |
| 3789 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, |
| 3790 GL_DEPTH_TEXTURE_MODE, |
| 3791 GL_RED)) |
| 3792 .Times(1) |
| 3793 .RetiresOnSaturation(); |
| 3794 } |
| 3795 cmds::BindTexture cmd; |
| 3796 cmd.Init(GL_TEXTURE_2D, kNewClientId); |
| 3797 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3798 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3799 EXPECT_TRUE(GetTexture(kNewClientId) != NULL); |
| 3800 } |
| 3801 |
| 3802 TEST_P(GLES2DecoderTest, BindTextureInvalidArgs) { |
| 3803 EXPECT_CALL(*gl_, BindTexture(_, _)).Times(0); |
| 3804 cmds::BindTexture cmd; |
| 3805 cmd.Init(GL_TEXTURE_1D, client_texture_id_); |
| 3806 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3807 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 3808 |
| 3809 cmd.Init(GL_TEXTURE_3D, client_texture_id_); |
| 3810 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3811 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 3812 } |
| 3813 |
| 3763 // TODO(gman): Complete this test. | 3814 // TODO(gman): Complete this test. |
| 3764 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) { | 3815 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) { |
| 3765 // } | 3816 // } |
| 3766 | 3817 |
| 3767 // TODO(gman): CompressedTexImage2D | 3818 // TODO(gman): CompressedTexImage2D |
| 3768 | 3819 |
| 3769 // TODO(gman): CompressedTexImage2DImmediate | 3820 // TODO(gman): CompressedTexImage2DImmediate |
| 3770 | 3821 |
| 3771 // TODO(gman): CompressedTexSubImage2DImmediate | 3822 // TODO(gman): CompressedTexSubImage2DImmediate |
| 3772 | 3823 |
| 3773 // TODO(gman): TexImage2D | 3824 // TODO(gman): TexImage2D |
| 3774 | 3825 |
| 3775 // TODO(gman): TexImage2DImmediate | 3826 // TODO(gman): TexImage2DImmediate |
| 3776 | 3827 |
| 3777 // TODO(gman): TexSubImage2DImmediate | 3828 // TODO(gman): TexSubImage2DImmediate |
| 3778 | 3829 |
| 3779 } // namespace gles2 | 3830 } // namespace gles2 |
| 3780 } // namespace gpu | 3831 } // namespace gpu |
| OLD | NEW |