Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc

Issue 1401423003: Re-land: ui: Move GLImage::BindTexImage fallback from GLImage implementations to GLES2CmdDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 89dec15acd0cef4cc0ece6cf5dba74552742bbde..e0c59542f0cda3d36db324df7a61ed1cd19aab14 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
@@ -2627,7 +2627,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, nullptr) == nullptr);
// Bind image to texture.
// ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
@@ -2635,7 +2635,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, nullptr) == nullptr);
// Define new texture image.
DoTexImage2D(
@@ -2643,7 +2643,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, nullptr) == nullptr);
}
TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) {
@@ -2669,10 +2669,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, nullptr) == 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, nullptr) == nullptr);
}
TEST_P(GLES2DecoderTest, GLImageAttachedAfterSubTexImage2D) {
@@ -2710,7 +2710,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, nullptr) == image.get());
// TexSubImage2D should not unbind GLImage.
EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width,
@@ -2722,7 +2722,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, nullptr) == image.get());
}
TEST_P(GLES2DecoderTest, GLImageAttachedAfterClearLevel) {
@@ -2754,7 +2754,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, nullptr) == image.get());
// ClearLevel should use glTexSubImage2D to avoid unbinding GLImage.
EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId))
@@ -2766,7 +2766,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, nullptr) == image.get());
}
TEST_P(GLES2DecoderTest, ReleaseTexImage2DCHROMIUM) {
@@ -2795,7 +2795,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, nullptr) == nullptr);
// Bind image to texture.
// ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
@@ -2803,7 +2803,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, nullptr) == nullptr);
// Release image from texture.
// ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
@@ -2817,7 +2817,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, nullptr) == nullptr);
}
class MockGLImage : public gfx::GLImage {
@@ -2830,6 +2830,7 @@ class MockGLImage : public gfx::GLImage {
MOCK_METHOD1(Destroy, void(bool));
MOCK_METHOD1(BindTexImage, bool(unsigned));
MOCK_METHOD1(ReleaseTexImage, void(unsigned));
+ MOCK_METHOD1(CopyTexImage, bool(unsigned));
MOCK_METHOD3(CopyTexSubImage,
bool(unsigned, const gfx::Point&, const gfx::Rect&));
MOCK_METHOD0(WillUseTexImage, void());
@@ -2986,8 +2987,8 @@ TEST_P(GLES2DecoderManualInitTest, DrawWithGLImageExternal) {
group().texture_manager()->SetLevelInfo(texture_ref, GL_TEXTURE_EXTERNAL_OES,
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());
+ group().texture_manager()->SetLevelImage(texture_ref, GL_TEXTURE_EXTERNAL_OES,
+ 0, image.get(), Texture::BOUND);
DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
EXPECT_EQ(GL_NO_ERROR, GetGLError());

Powered by Google App Engine
This is Rietveld 408576698