| Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
|
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
|
| index 2495c9aebff6f18c43c6d638034b5380950da7a0..c30bcda653f300f3802410a2bb0074d4f56d6ffe 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
|
| @@ -35,6 +35,7 @@
|
|
|
| using ::gl::MockGLInterface;
|
| using ::testing::_;
|
| +using ::testing::AnyNumber;
|
| using ::testing::DoAll;
|
| using ::testing::InSequence;
|
| using ::testing::Invoke;
|
| @@ -1367,7 +1368,83 @@ TEST_P(GLES3DecoderTest, CopyTexSubImage3DFeedbackLoopFails) {
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
|
| }
|
| +/*
|
| +TEST_P(GLES3DecoderTest, CopyTexSubImage3DMarksTextureAsCleared) {
|
| + DoBindTexture(GL_TEXTURE_3D, client_texture_id_, kServiceTextureId);
|
| + DoTexImage3D(
|
| + GL_TEXTURE_3D, 0, GL_RGB8, 2, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0, 0);
|
| +
|
| + TextureManager* manager = group().texture_manager();
|
| + TextureRef* texture_ref = manager->GetTexture(client_texture_id_);
|
| + ASSERT_TRUE(texture_ref != NULL);
|
| + Texture* texture = texture_ref->texture();
|
| +
|
| + CopyTexSubImage3D cmd;
|
| +
|
| + // clear the left part of layer 0
|
| + EXPECT_CALL(*gl_, GetError())
|
| + .WillOnce(Return(GL_NO_ERROR))
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, GenBuffersARB(_, _))
|
| + .Times(AnyNumber());
|
| + EXPECT_CALL(*gl_, DeleteBuffersARB(_, _))
|
| + .Times(AnyNumber());
|
| + EXPECT_CALL(*gl_, CopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0,
|
| + 0, 0, 1, 2))
|
| + .Times(1)
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, GetError())
|
| + .WillOnce(Return(GL_NO_ERROR))
|
| + .RetiresOnSaturation();
|
| + cmd.Init(GL_TEXTURE_3D, 0, 0, 0, 0,
|
| + 0, 0, 1, 2);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| +
|
| + EXPECT_FALSE(texture->SafeToRenderFrom());
|
| +
|
| + // clear the right part of layer 0
|
| + EXPECT_CALL(*gl_, GetError())
|
| + .WillOnce(Return(GL_NO_ERROR))
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, GenBuffersARB(_, _))
|
| + .Times(AnyNumber());
|
| + EXPECT_CALL(*gl_, DeleteBuffersARB(_, _))
|
| + .Times(AnyNumber());
|
| + EXPECT_CALL(*gl_, CopyTexSubImage3D(GL_TEXTURE_3D, 0, 1, 0, 0,
|
| + 0, 0, 1, 2))
|
| + .Times(1)
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, GetError())
|
| + .WillOnce(Return(GL_NO_ERROR))
|
| + .RetiresOnSaturation();
|
| + cmd.Init(GL_TEXTURE_3D, 0, 1, 0, 0,
|
| + 0, 0, 1, 2);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| +
|
| + EXPECT_FALSE(texture->SafeToRenderFrom());
|
| +
|
| + // clear layer 1
|
| + EXPECT_CALL(*gl_, GetError())
|
| + .WillOnce(Return(GL_NO_ERROR))
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, GenBuffersARB(_, _))
|
| + .Times(AnyNumber());
|
| + EXPECT_CALL(*gl_, DeleteBuffersARB(_, _))
|
| + .Times(AnyNumber());
|
| + EXPECT_CALL(*gl_, CopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0,
|
| + 0, 0, 2, 2))
|
| + .Times(1)
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_, GetError())
|
| + .WillOnce(Return(GL_NO_ERROR))
|
| + .RetiresOnSaturation();
|
| + cmd.Init(GL_TEXTURE_3D, 0, 0, 0, 0,
|
| + 0, 0, 2, 2);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
|
|
| + EXPECT_TRUE(texture->SafeToRenderFrom());
|
| +}
|
| +*/
|
| TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) {
|
| const uint32_t kBucketId = 123;
|
| const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
|
| @@ -1907,8 +1984,6 @@ TEST_P(GLES2DecoderManualInitTest, CompressedTexImage2DETC1) {
|
| EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
|
| }
|
|
|
| -
|
| -
|
| TEST_P(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) {
|
| InitState init;
|
| init.extensions = "GL_OES_EGL_image_external";
|
| @@ -3296,7 +3371,7 @@ TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUM) {
|
| EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
|
| EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
|
| EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == NULL);
|
|
|
| // Bind image to texture.
|
| // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
|
| @@ -3304,7 +3379,7 @@ TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUM) {
|
| EXPECT_TRUE(
|
| texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
|
| // Image should now be set.
|
| - EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
|
| + EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == NULL);
|
|
|
| // Define new texture image.
|
| DoTexImage2D(
|
| @@ -3312,7 +3387,7 @@ TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUM) {
|
| EXPECT_TRUE(
|
| texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
|
| // Image should no longer be set.
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == NULL);
|
| }
|
|
|
| TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) {
|
| @@ -3338,10 +3413,10 @@ TEST_P(GLES2DecoderTest, OrphanGLImageWithTexImage2D) {
|
| ASSERT_TRUE(texture_ref != NULL);
|
| Texture* texture = texture_ref->texture();
|
|
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == image.get());
|
| DoTexImage2D(
|
| GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == NULL);
|
| }
|
|
|
| TEST_P(GLES2DecoderTest, GLImageAttachedAfterSubTexImage2D) {
|
| @@ -3379,7 +3454,7 @@ TEST_P(GLES2DecoderTest, GLImageAttachedAfterSubTexImage2D) {
|
| group().texture_manager()->GetTexture(client_texture_id_);
|
| ASSERT_TRUE(texture_ref != NULL);
|
| Texture* texture = texture_ref->texture();
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == image.get());
|
|
|
| // TexSubImage2D should not unbind GLImage.
|
| EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width,
|
| @@ -3391,7 +3466,7 @@ TEST_P(GLES2DecoderTest, GLImageAttachedAfterSubTexImage2D) {
|
| format, type, pixels_shm_id, pixels_shm_offset,
|
| internal);
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(tex_sub_image_2d_cmd));
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == image.get());
|
| }
|
|
|
| TEST_P(GLES2DecoderTest, GLImageAttachedAfterClearLevel) {
|
| @@ -3423,7 +3498,7 @@ TEST_P(GLES2DecoderTest, GLImageAttachedAfterClearLevel) {
|
| group().texture_manager()->GetTexture(client_texture_id_);
|
| ASSERT_TRUE(texture_ref != NULL);
|
| Texture* texture = texture_ref->texture();
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == image.get());
|
|
|
| // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage.
|
| EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId))
|
| @@ -3435,7 +3510,7 @@ TEST_P(GLES2DecoderTest, GLImageAttachedAfterClearLevel) {
|
| .RetiresOnSaturation();
|
| GetDecoder()->ClearLevel(texture, target, level, format, type, 0, 0, width,
|
| height);
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == image.get());
|
| }
|
|
|
| TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) {
|
| @@ -3464,7 +3539,7 @@ TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) {
|
| EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
|
| EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
|
| EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == NULL);
|
|
|
| // Bind image to texture.
|
| // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
|
| @@ -3472,7 +3547,7 @@ TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) {
|
| EXPECT_TRUE(
|
| texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
|
| // Image should now be set.
|
| - EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
|
| + EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == NULL);
|
|
|
| // Release image from texture.
|
| // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
|
| @@ -3486,7 +3561,7 @@ TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) {
|
| EXPECT_TRUE(
|
| texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
|
| // Image should no longer be set.
|
| - EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
|
| + EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0, 0) == NULL);
|
| }
|
|
|
| class MockGLImage : public gl::GLImage {
|
| @@ -3654,7 +3729,7 @@ TEST_P(GLES2DecoderManualInitTest, DrawWithGLImageExternal) {
|
| 0, GL_RGBA, 0, 0, 1, 0, GL_RGBA,
|
| GL_UNSIGNED_BYTE, gfx::Rect());
|
| group().texture_manager()->SetLevelImage(texture_ref, GL_TEXTURE_EXTERNAL_OES,
|
| - 0, image.get(), Texture::BOUND);
|
| + 0, 0, image.get(), Texture::BOUND);
|
|
|
| DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
|
|