diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-19 00:14:41 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-19 00:14:41 +0000 |
commit | 80eb6b5e4b1e3c95853d9abe98bc3f151be5f86c (patch) | |
tree | acc7e791308bafadded4ceec4ac6c2b9e766f8f2 /gpu/command_buffer/service/framebuffer_manager_unittest.cc | |
parent | 462d4a3f2f11a6cb6933749df8a9349260d94af3 (diff) | |
download | chromium_src-80eb6b5e4b1e3c95853d9abe98bc3f151be5f86c.zip chromium_src-80eb6b5e4b1e3c95853d9abe98bc3f151be5f86c.tar.gz chromium_src-80eb6b5e4b1e3c95853d9abe98bc3f151be5f86c.tar.bz2 |
Fix TextureManager optimizations.
The issue was the texture manager was originaly written
assuming you could not use deleted textures. Now that
we allow using deleted textures (per OpenGL ES), textures
that get manipulated after being removed from the
TextureManager would mess up it's bookkeeping.
So no every TextureInfo has a pointer to it's manager.
On destruction it will call into the TextureManager to
update the bookkeeping. That means all TextureInfos have
to be deleted before the TextureManager.
R=apatrick@chromium.org
BUG=109900
TEST=unit tests
Review URL: http://codereview.chromium.org/9211008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118189 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 | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/gpu/command_buffer/service/framebuffer_manager_unittest.cc b/gpu/command_buffer/service/framebuffer_manager_unittest.cc index f6a8b0d..cbe524a 100644 --- a/gpu/command_buffer/service/framebuffer_manager_unittest.cc +++ b/gpu/command_buffer/service/framebuffer_manager_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,7 +19,7 @@ class FramebufferManagerTest : public testing::Test { public: FramebufferManagerTest() - : texture_manager_(kMaxTextureSize, kMaxCubemapSize), + : texture_manager_(new FeatureInfo(), kMaxTextureSize, kMaxCubemapSize), renderbuffer_manager_(kMaxRenderbufferSize, kMaxSamples) { } @@ -108,7 +108,7 @@ class FramebufferInfoTest : public testing::Test { FramebufferInfoTest() : manager_(), - texture_manager_(kMaxTextureSize, kMaxCubemapSize), + texture_manager_(new FeatureInfo(), kMaxTextureSize, kMaxCubemapSize), renderbuffer_manager_(kMaxRenderbufferSize, kMaxSamples) { } ~FramebufferInfoTest() { @@ -398,10 +398,8 @@ TEST_F(FramebufferInfoTest, AttachTexture) { EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), info_->IsPossiblyComplete()); - FeatureInfo feature_info; - texture_manager_.CreateTextureInfo( - &feature_info, kTextureClient1Id, kTextureService1Id); - TextureManager::TextureInfo* tex_info1 = + texture_manager_.CreateTextureInfo(kTextureClient1Id, kTextureService1Id); + TextureManager::TextureInfo::Ref tex_info1 = texture_manager_.GetTextureInfo(kTextureClient1Id); ASSERT_TRUE(tex_info1 != NULL); @@ -413,15 +411,15 @@ TEST_F(FramebufferInfoTest, AttachTexture) { EXPECT_TRUE(info_->IsCleared()); EXPECT_EQ(static_cast<GLenum>(0), info_->GetColorAttachmentFormat()); - texture_manager_.SetInfoTarget(&feature_info, tex_info1, GL_TEXTURE_2D); + texture_manager_.SetInfoTarget(tex_info1, GL_TEXTURE_2D); texture_manager_.SetLevelInfo( - &feature_info, tex_info1, GL_TEXTURE_2D, kLevel1, + tex_info1, GL_TEXTURE_2D, kLevel1, kFormat1, kWidth1, kHeight1, kDepth, kBorder, kFormat1, kType, false); EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), info_->IsPossiblyComplete()); EXPECT_FALSE(info_->IsCleared()); texture_manager_.SetLevelInfo( - &feature_info, tex_info1, GL_TEXTURE_2D, kLevel1, + tex_info1, GL_TEXTURE_2D, kLevel1, kFormat1, kWidth1, kHeight1, kDepth, kBorder, kFormat1, kType, true); EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), info_->IsPossiblyComplete()); @@ -438,14 +436,13 @@ TEST_F(FramebufferInfoTest, AttachTexture) { EXPECT_TRUE(attachment->cleared()); // Check replacing an attachment - texture_manager_.CreateTextureInfo( - &feature_info, kTextureClient2Id, kTextureService2Id); - TextureManager::TextureInfo* tex_info2 = + texture_manager_.CreateTextureInfo(kTextureClient2Id, kTextureService2Id); + TextureManager::TextureInfo::Ref tex_info2 = texture_manager_.GetTextureInfo(kTextureClient2Id); ASSERT_TRUE(tex_info2 != NULL); - texture_manager_.SetInfoTarget(&feature_info, tex_info2, GL_TEXTURE_2D); + texture_manager_.SetInfoTarget(tex_info2, GL_TEXTURE_2D); texture_manager_.SetLevelInfo( - &feature_info, tex_info2, GL_TEXTURE_2D, kLevel2, + tex_info2, GL_TEXTURE_2D, kLevel2, kFormat2, kWidth2, kHeight2, kDepth, kBorder, kFormat2, kType, true); info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info2, kTarget2, kLevel2); @@ -464,7 +461,7 @@ TEST_F(FramebufferInfoTest, AttachTexture) { // Check changing attachment texture_manager_.SetLevelInfo( - &feature_info, tex_info2, GL_TEXTURE_2D, kLevel3, + tex_info2, GL_TEXTURE_2D, kLevel3, kFormat3, kWidth3, kHeight3, kDepth, kBorder, kFormat3, kType, false); attachment = info_->GetAttachment(GL_COLOR_ATTACHMENT0); ASSERT_TRUE(attachment != NULL); @@ -480,7 +477,7 @@ TEST_F(FramebufferInfoTest, AttachTexture) { // Set to size 0 texture_manager_.SetLevelInfo( - &feature_info, tex_info2, GL_TEXTURE_2D, kLevel3, + tex_info2, GL_TEXTURE_2D, kLevel3, kFormat3, 0, 0, kDepth, kBorder, kFormat3, kType, false); EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), info_->IsPossiblyComplete()); @@ -538,15 +535,12 @@ TEST_F(FramebufferInfoTest, UnbindTexture) { const GLenum kTarget1 = GL_TEXTURE_2D; const GLint kLevel1 = 0; - FeatureInfo feature_info; - texture_manager_.CreateTextureInfo( - &feature_info, kTextureClient1Id, kTextureService1Id); - TextureManager::TextureInfo* tex_info1 = + texture_manager_.CreateTextureInfo(kTextureClient1Id, kTextureService1Id); + TextureManager::TextureInfo::Ref tex_info1 = texture_manager_.GetTextureInfo(kTextureClient1Id); ASSERT_TRUE(tex_info1 != NULL); - texture_manager_.CreateTextureInfo( - &feature_info, kTextureClient2Id, kTextureService2Id); - TextureManager::TextureInfo* tex_info2 = + texture_manager_.CreateTextureInfo(kTextureClient2Id, kTextureService2Id); + TextureManager::TextureInfo::Ref tex_info2 = texture_manager_.GetTextureInfo(kTextureClient2Id); ASSERT_TRUE(tex_info2 != NULL); @@ -576,15 +570,13 @@ TEST_F(FramebufferInfoTest, IsCompleteMarkAsComplete) { 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_.CreateTextureInfo(kTextureClient2Id, kTextureService2Id); + TextureManager::TextureInfo::Ref tex_info2 = texture_manager_.GetTextureInfo(kTextureClient2Id); ASSERT_TRUE(tex_info2 != NULL); |