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/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
10 #include "gpu/command_buffer/common/id_allocator.h" | 10 #include "gpu/command_buffer/common/id_allocator.h" |
(...skipping 7895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7906 | 7906 |
7907 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7907 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
7908 EXPECT_EQ(3, width); | 7908 EXPECT_EQ(3, width); |
7909 EXPECT_EQ(1, height); | 7909 EXPECT_EQ(1, height); |
7910 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 7910 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
7911 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7911 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
7912 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7912 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
7913 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7913 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
7914 | 7914 |
7915 // Bind image to texture. | 7915 // Bind image to texture. |
7916 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | |
7917 EXPECT_CALL(*gl_, GetError()) | |
7918 .Times(2) | |
7919 .WillOnce(Return(GL_NO_ERROR)) | |
no sievers
2013/04/08 20:02:52
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_
| |
7920 .RetiresOnSaturation(); | |
7916 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; | 7921 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; |
7917 bind_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); | 7922 bind_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); |
7918 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); | 7923 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); |
7919 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7924 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
7920 // Image should now be set. | 7925 // Image should now be set. |
7921 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7926 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
7922 | 7927 |
7923 // Define new texture image. | 7928 // Define new texture image. |
7924 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7929 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
7925 0, 0); | 7930 0, 0); |
(...skipping 19 matching lines...) Expand all Loading... | |
7945 | 7950 |
7946 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7951 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
7947 EXPECT_EQ(3, width); | 7952 EXPECT_EQ(3, width); |
7948 EXPECT_EQ(1, height); | 7953 EXPECT_EQ(1, height); |
7949 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 7954 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
7950 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7955 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
7951 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7956 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
7952 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7957 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
7953 | 7958 |
7954 // Bind image to texture. | 7959 // Bind image to texture. |
7960 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | |
7961 EXPECT_CALL(*gl_, GetError()) | |
7962 .Times(2) | |
7963 .WillOnce(Return(GL_NO_ERROR)) | |
7964 .RetiresOnSaturation(); | |
7955 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; | 7965 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; |
7956 bind_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); | 7966 bind_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); |
7957 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); | 7967 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); |
7958 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7968 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
7959 // Image should now be set. | 7969 // Image should now be set. |
7960 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7970 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
7961 | 7971 |
7962 // Release image from texture. | 7972 // Release image from texture. |
7973 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. | |
7974 EXPECT_CALL(*gl_, GetError()) | |
7975 .Times(2) | |
7976 .WillOnce(Return(GL_NO_ERROR)) | |
7977 .RetiresOnSaturation(); | |
7963 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; | 7978 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; |
7964 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); | 7979 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); |
7965 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); | 7980 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); |
7966 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7981 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
7967 // Image should no longer be set. | 7982 // Image should no longer be set. |
7968 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); | 7983 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
7969 } | 7984 } |
7970 | 7985 |
7971 TEST_F(GLES2DecoderManualInitTest, GpuMemoryManagerCHROMIUM) { | 7986 TEST_F(GLES2DecoderManualInitTest, GpuMemoryManagerCHROMIUM) { |
7972 InitDecoder( | 7987 InitDecoder( |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8513 // TODO(gman): TexImage2DImmediate | 8528 // TODO(gman): TexImage2DImmediate |
8514 | 8529 |
8515 // TODO(gman): TexSubImage2DImmediate | 8530 // TODO(gman): TexSubImage2DImmediate |
8516 | 8531 |
8517 // TODO(gman): UseProgram | 8532 // TODO(gman): UseProgram |
8518 | 8533 |
8519 // TODO(gman): SwapBuffers | 8534 // TODO(gman): SwapBuffers |
8520 | 8535 |
8521 } // namespace gles2 | 8536 } // namespace gles2 |
8522 } // namespace gpu | 8537 } // namespace gpu |
OLD | NEW |