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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 7704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7715 TEST_F(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) { | 7715 TEST_F(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) { |
7716 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1); | 7716 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1); |
7717 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); | 7717 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); |
7718 | 7718 |
7719 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; | 7719 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; |
7720 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1); | 7720 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1); |
7721 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); | 7721 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); |
7722 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 7722 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
7723 } | 7723 } |
7724 | 7724 |
| 7725 TEST_F(GLES2DecoderTest, OrphanGLImageWithTexImage2D) { |
| 7726 group().image_manager()->AddImage(gfx::GLImage::CreateGLImage(0).get(), 1); |
| 7727 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); |
| 7728 |
| 7729 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; |
| 7730 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1); |
| 7731 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); |
| 7732 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 7733 |
| 7734 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7735 0, 0); |
| 7736 TextureRef* texture_ref = group().texture_manager()->GetTexture( |
| 7737 client_texture_id_); |
| 7738 ASSERT_TRUE(texture_ref != NULL); |
| 7739 Texture* texture = texture_ref->texture(); |
| 7740 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7741 } |
| 7742 |
7725 TEST_F(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { | 7743 TEST_F(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) { |
7726 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7744 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
7727 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7745 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
7728 0, 0); | 7746 0, 0); |
7729 TextureRef* texture_ref = group().texture_manager()->GetTexture( | 7747 TextureRef* texture_ref = group().texture_manager()->GetTexture( |
7730 client_texture_id_); | 7748 client_texture_id_); |
7731 ASSERT_TRUE(texture_ref != NULL); | 7749 ASSERT_TRUE(texture_ref != NULL); |
7732 Texture* texture = texture_ref->texture(); | 7750 Texture* texture = texture_ref->texture(); |
7733 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 7751 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
7734 | 7752 |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9064 // TODO(gman): TexImage2DImmediate | 9082 // TODO(gman): TexImage2DImmediate |
9065 | 9083 |
9066 // TODO(gman): TexSubImage2DImmediate | 9084 // TODO(gman): TexSubImage2DImmediate |
9067 | 9085 |
9068 // TODO(gman): UseProgram | 9086 // TODO(gman): UseProgram |
9069 | 9087 |
9070 // TODO(gman): SwapBuffers | 9088 // TODO(gman): SwapBuffers |
9071 | 9089 |
9072 } // namespace gles2 | 9090 } // namespace gles2 |
9073 } // namespace gpu | 9091 } // namespace gpu |
OLD | NEW |