diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 08:26:51 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 08:26:51 +0000 |
commit | 968351b5e4615c95f83e4ef33fabdb7328609211 (patch) | |
tree | 2748324516dde7a7c88c9aac8ccc41c493827daa /gpu/command_buffer/service/framebuffer_manager_unittest.cc | |
parent | b0d839907704d0e558fa3dd750e268c196814350 (diff) | |
download | chromium_src-968351b5e4615c95f83e4ef33fabdb7328609211.zip chromium_src-968351b5e4615c95f83e4ef33fabdb7328609211.tar.gz chromium_src-968351b5e4615c95f83e4ef33fabdb7328609211.tar.bz2 |
Optimize glCheckFramebuffer checks.
This CL basically tries to cache the "framebuffer complete"
state of framebuffers in the command buffer.
TEST=unit tests
BUG=102230
Review URL: http://codereview.chromium.org/9008001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/framebuffer_manager_unittest.cc')
-rw-r--r-- | gpu/command_buffer/service/framebuffer_manager_unittest.cc | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/framebuffer_manager_unittest.cc b/gpu/command_buffer/service/framebuffer_manager_unittest.cc index f7aa23a..f6a8b0d 100644 --- a/gpu/command_buffer/service/framebuffer_manager_unittest.cc +++ b/gpu/command_buffer/service/framebuffer_manager_unittest.cc @@ -161,6 +161,7 @@ TEST_F(FramebufferInfoTest, Basic) { info_->IsPossiblyComplete()); EXPECT_TRUE(info_->IsCleared()); EXPECT_EQ(static_cast<GLenum>(0), info_->GetColorAttachmentFormat()); + EXPECT_FALSE(manager_.IsComplete(info_)); } TEST_F(FramebufferInfoTest, AttachRenderbuffer) { @@ -250,7 +251,8 @@ TEST_F(FramebufferInfoTest, AttachRenderbuffer) { EXPECT_TRUE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); // check marking them as cleared. - info_->MarkAttachmentsAsCleared(&renderbuffer_manager_, &texture_manager_); + manager_.MarkAttachmentsAsCleared( + info_, &renderbuffer_manager_, &texture_manager_); EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), @@ -298,7 +300,8 @@ TEST_F(FramebufferInfoTest, AttachRenderbuffer) { EXPECT_TRUE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); // Clear it. - info_->MarkAttachmentsAsCleared(&renderbuffer_manager_, &texture_manager_); + manager_.MarkAttachmentsAsCleared( + info_, &renderbuffer_manager_, &texture_manager_); EXPECT_FALSE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); EXPECT_TRUE(info_->IsCleared()); @@ -565,6 +568,52 @@ TEST_F(FramebufferInfoTest, UnbindTexture) { EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) == NULL); } +TEST_F(FramebufferInfoTest, IsCompleteMarkAsComplete) { + const GLuint kRenderbufferClient1Id = 33; + const GLuint kRenderbufferService1Id = 333; + const GLuint kTextureClient2Id = 34; + const GLuint kTextureService2Id = 334; + const GLenum kTarget1 = GL_TEXTURE_2D; + const GLint kLevel1 = 0; + + FeatureInfo feature_info; + renderbuffer_manager_.CreateRenderbufferInfo( + kRenderbufferClient1Id, kRenderbufferService1Id); + RenderbufferManager::RenderbufferInfo* rb_info1 = + renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient1Id); + ASSERT_TRUE(rb_info1 != NULL); + texture_manager_.CreateTextureInfo( + &feature_info, kTextureClient2Id, kTextureService2Id); + TextureManager::TextureInfo* tex_info2 = + texture_manager_.GetTextureInfo(kTextureClient2Id); + ASSERT_TRUE(tex_info2 != NULL); + + // Check MarkAsComlete marks as complete. + manager_.MarkAsComplete(info_); + EXPECT_TRUE(manager_.IsComplete(info_)); + + // Check at attaching marks as not complete. + info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info2, kTarget1, kLevel1); + EXPECT_FALSE(manager_.IsComplete(info_)); + manager_.MarkAsComplete(info_); + EXPECT_TRUE(manager_.IsComplete(info_)); + info_->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, rb_info1); + EXPECT_FALSE(manager_.IsComplete(info_)); + + // Check MarkAttachmentsAsCleared marks as complete. + manager_.MarkAttachmentsAsCleared( + info_, &renderbuffer_manager_, &texture_manager_); + EXPECT_TRUE(manager_.IsComplete(info_)); + + // Check Unbind marks as not complete. + info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info1); + EXPECT_FALSE(manager_.IsComplete(info_)); + manager_.MarkAsComplete(info_); + EXPECT_TRUE(manager_.IsComplete(info_)); + info_->UnbindTexture(kTarget1, tex_info2); + EXPECT_FALSE(manager_.IsComplete(info_)); +} + } // namespace gles2 } // namespace gpu |