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

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

Issue 2895493002: Fix fbo completeness check when non-base-level texture image is attached. (Closed)
Patch Set: handle a bug related to TexStorage Created 3 years, 7 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 e250553aba61d6018a5a16abead22ca3940f83a2..0b167790a8878e26f804351e11257870c9b15da5 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
@@ -1342,7 +1342,7 @@ TEST_P(GLES3DecoderTest, CopyTexSubImage3DFeedbackLoopFails) {
// The source and the target for CopyTexSubImage3D are the same 3d texture.
// And level / zoffset of 3D texture equal to level / layer of read attachment
// in fbo.
- GLint kLevel = 1;
+ GLint kLevel = 0; // This has to be base level, or fbo is incomplete.
GLint kLayer = 0; // kZoffset is 0
EXPECT_CALL(*gl_, FramebufferTextureLayer(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
@@ -4400,24 +4400,36 @@ class GLES2DecoderTexStorageFormatAndTypeTest
void DoTexStorageFormatAndType(const InitState& init,
GLenum format,
GLenum adjusted_internal_format) {
+ GLsizei kWidth = 512;
+ GLsizei kHeight = 512;
+ // Purposely set kLevels to be smaller than 10 = log2(512) + 1.
+ GLsizei kLevels = 5;
InitDecoder(init);
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
- EXPECT_CALL(*gl_, TexStorage2DEXT(GL_TEXTURE_2D, 2, format, 2, 2))
+ EXPECT_CALL(
+ *gl_, TexStorage2DEXT(GL_TEXTURE_2D, kLevels, format, kWidth, kHeight))
.Times(1)
.RetiresOnSaturation();
TexStorage2DEXT cmd;
- cmd.Init(GL_TEXTURE_2D, 2, format, 2, 2);
+ cmd.Init(GL_TEXTURE_2D, kLevels, format, kWidth, kHeight);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
EXPECT_EQ(GL_NO_ERROR, GetGLError());
TextureRef* texture_ref =
group().texture_manager()->GetTexture(client_texture_id_);
Texture* texture = texture_ref->texture();
- GLenum type;
- GLenum internal_format;
- EXPECT_TRUE(
- texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
- EXPECT_EQ(static_cast<GLenum>(adjusted_internal_format), internal_format);
- EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
+ for (GLsizei ii = 0; ii < kLevels; ++ii) {
+ GLenum type = 0, internal_format = 0;
+ GLsizei level_width = 0, level_height = 0;
+ EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, static_cast<GLint>(ii),
+ &type, &internal_format));
+ EXPECT_EQ(static_cast<GLenum>(adjusted_internal_format), internal_format);
+ EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
+ EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, static_cast<GLint>(ii),
+ &level_width, &level_height, nullptr));
+ EXPECT_EQ(kWidth >> ii, level_width);
+ EXPECT_EQ(kHeight >> ii, level_height);
+ }
+ EXPECT_TRUE(texture->texture_complete());
}
};
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager_unittest.cc ('k') | gpu/command_buffer/service/mailbox_manager_sync.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698