| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/framebuffer_manager.h" | 5 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 6 #include "gpu/command_buffer/service/feature_info.h" | 6 #include "gpu/command_buffer/service/feature_info.h" |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gl/gl_mock.h" | 9 #include "ui/gl/gl_mock.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const GLint FramebufferManagerTest::kMaxTextureSize; | 55 const GLint FramebufferManagerTest::kMaxTextureSize; |
| 56 const GLint FramebufferManagerTest::kMaxCubemapSize; | 56 const GLint FramebufferManagerTest::kMaxCubemapSize; |
| 57 const GLint FramebufferManagerTest::kMaxRenderbufferSize; | 57 const GLint FramebufferManagerTest::kMaxRenderbufferSize; |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 TEST_F(FramebufferManagerTest, Basic) { | 60 TEST_F(FramebufferManagerTest, Basic) { |
| 61 const GLuint kClient1Id = 1; | 61 const GLuint kClient1Id = 1; |
| 62 const GLuint kService1Id = 11; | 62 const GLuint kService1Id = 11; |
| 63 const GLuint kClient2Id = 2; | 63 const GLuint kClient2Id = 2; |
| 64 // Check we can create framebuffer. | 64 // Check we can create framebuffer. |
| 65 manager_.CreateFramebufferInfo(kClient1Id, kService1Id); | 65 manager_.CreateFramebuffer(kClient1Id, kService1Id); |
| 66 // Check framebuffer got created. | 66 // Check framebuffer got created. |
| 67 FramebufferManager::FramebufferInfo* info1 = | 67 Framebuffer* info1 = |
| 68 manager_.GetFramebufferInfo(kClient1Id); | 68 manager_.GetFramebuffer(kClient1Id); |
| 69 ASSERT_TRUE(info1 != NULL); | 69 ASSERT_TRUE(info1 != NULL); |
| 70 EXPECT_FALSE(info1->IsDeleted()); | 70 EXPECT_FALSE(info1->IsDeleted()); |
| 71 EXPECT_EQ(kService1Id, info1->service_id()); | 71 EXPECT_EQ(kService1Id, info1->service_id()); |
| 72 GLuint client_id = 0; | 72 GLuint client_id = 0; |
| 73 EXPECT_TRUE(manager_.GetClientId(info1->service_id(), &client_id)); | 73 EXPECT_TRUE(manager_.GetClientId(info1->service_id(), &client_id)); |
| 74 EXPECT_EQ(kClient1Id, client_id); | 74 EXPECT_EQ(kClient1Id, client_id); |
| 75 // Check we get nothing for a non-existent framebuffer. | 75 // Check we get nothing for a non-existent framebuffer. |
| 76 EXPECT_TRUE(manager_.GetFramebufferInfo(kClient2Id) == NULL); | 76 EXPECT_TRUE(manager_.GetFramebuffer(kClient2Id) == NULL); |
| 77 // Check trying to a remove non-existent framebuffers does not crash. | 77 // Check trying to a remove non-existent framebuffers does not crash. |
| 78 manager_.RemoveFramebufferInfo(kClient2Id); | 78 manager_.RemoveFramebuffer(kClient2Id); |
| 79 // Check framebuffer gets deleted when last reference is released. | 79 // Check framebuffer gets deleted when last reference is released. |
| 80 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, ::testing::Pointee(kService1Id))) | 80 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, ::testing::Pointee(kService1Id))) |
| 81 .Times(1) | 81 .Times(1) |
| 82 .RetiresOnSaturation(); | 82 .RetiresOnSaturation(); |
| 83 // Check we can't get the framebuffer after we remove it. | 83 // Check we can't get the framebuffer after we remove it. |
| 84 manager_.RemoveFramebufferInfo(kClient1Id); | 84 manager_.RemoveFramebuffer(kClient1Id); |
| 85 EXPECT_TRUE(manager_.GetFramebufferInfo(kClient1Id) == NULL); | 85 EXPECT_TRUE(manager_.GetFramebuffer(kClient1Id) == NULL); |
| 86 } | 86 } |
| 87 | 87 |
| 88 TEST_F(FramebufferManagerTest, Destroy) { | 88 TEST_F(FramebufferManagerTest, Destroy) { |
| 89 const GLuint kClient1Id = 1; | 89 const GLuint kClient1Id = 1; |
| 90 const GLuint kService1Id = 11; | 90 const GLuint kService1Id = 11; |
| 91 // Check we can create framebuffer. | 91 // Check we can create framebuffer. |
| 92 manager_.CreateFramebufferInfo(kClient1Id, kService1Id); | 92 manager_.CreateFramebuffer(kClient1Id, kService1Id); |
| 93 // Check framebuffer got created. | 93 // Check framebuffer got created. |
| 94 FramebufferManager::FramebufferInfo* info1 = | 94 Framebuffer* info1 = |
| 95 manager_.GetFramebufferInfo(kClient1Id); | 95 manager_.GetFramebuffer(kClient1Id); |
| 96 ASSERT_TRUE(info1 != NULL); | 96 ASSERT_TRUE(info1 != NULL); |
| 97 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, ::testing::Pointee(kService1Id))) | 97 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, ::testing::Pointee(kService1Id))) |
| 98 .Times(1) | 98 .Times(1) |
| 99 .RetiresOnSaturation(); | 99 .RetiresOnSaturation(); |
| 100 manager_.Destroy(true); | 100 manager_.Destroy(true); |
| 101 // Check the resources were released. | 101 // Check the resources were released. |
| 102 info1 = manager_.GetFramebufferInfo(kClient1Id); | 102 info1 = manager_.GetFramebuffer(kClient1Id); |
| 103 ASSERT_TRUE(info1 == NULL); | 103 ASSERT_TRUE(info1 == NULL); |
| 104 } | 104 } |
| 105 | 105 |
| 106 class FramebufferInfoTest : public testing::Test { | 106 class FramebufferInfoTest : public testing::Test { |
| 107 public: | 107 public: |
| 108 static const GLuint kClient1Id = 1; | 108 static const GLuint kClient1Id = 1; |
| 109 static const GLuint kService1Id = 11; | 109 static const GLuint kService1Id = 11; |
| 110 | 110 |
| 111 static const GLint kMaxTextureSize = 64; | 111 static const GLint kMaxTextureSize = 64; |
| 112 static const GLint kMaxCubemapSize = 64; | 112 static const GLint kMaxCubemapSize = 64; |
| 113 static const GLint kMaxRenderbufferSize = 64; | 113 static const GLint kMaxRenderbufferSize = 64; |
| 114 static const GLint kMaxSamples = 4; | 114 static const GLint kMaxSamples = 4; |
| 115 | 115 |
| 116 FramebufferInfoTest() | 116 FramebufferInfoTest() |
| 117 : manager_(), | 117 : manager_(), |
| 118 texture_manager_( | 118 texture_manager_( |
| 119 NULL, new FeatureInfo(), kMaxTextureSize, kMaxCubemapSize), | 119 NULL, new FeatureInfo(), kMaxTextureSize, kMaxCubemapSize), |
| 120 renderbuffer_manager_(NULL, kMaxRenderbufferSize, kMaxSamples) { | 120 renderbuffer_manager_(NULL, kMaxRenderbufferSize, kMaxSamples) { |
| 121 } | 121 } |
| 122 virtual ~FramebufferInfoTest() { | 122 virtual ~FramebufferInfoTest() { |
| 123 manager_.Destroy(false); | 123 manager_.Destroy(false); |
| 124 texture_manager_.Destroy(false); | 124 texture_manager_.Destroy(false); |
| 125 renderbuffer_manager_.Destroy(false); | 125 renderbuffer_manager_.Destroy(false); |
| 126 } | 126 } |
| 127 | 127 |
| 128 protected: | 128 protected: |
| 129 virtual void SetUp() { | 129 virtual void SetUp() { |
| 130 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); | 130 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); |
| 131 ::gfx::GLInterface::SetGLInterface(gl_.get()); | 131 ::gfx::GLInterface::SetGLInterface(gl_.get()); |
| 132 manager_.CreateFramebufferInfo(kClient1Id, kService1Id); | 132 manager_.CreateFramebuffer(kClient1Id, kService1Id); |
| 133 info_ = manager_.GetFramebufferInfo(kClient1Id); | 133 info_ = manager_.GetFramebuffer(kClient1Id); |
| 134 ASSERT_TRUE(info_ != NULL); | 134 ASSERT_TRUE(info_ != NULL); |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual void TearDown() { | 137 virtual void TearDown() { |
| 138 ::gfx::GLInterface::SetGLInterface(NULL); | 138 ::gfx::GLInterface::SetGLInterface(NULL); |
| 139 gl_.reset(); | 139 gl_.reset(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Use StrictMock to make 100% sure we know how GL will be called. | 142 // Use StrictMock to make 100% sure we know how GL will be called. |
| 143 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 143 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; |
| 144 FramebufferManager manager_; | 144 FramebufferManager manager_; |
| 145 FramebufferManager::FramebufferInfo* info_; | 145 Framebuffer* info_; |
| 146 TextureManager texture_manager_; | 146 TextureManager texture_manager_; |
| 147 RenderbufferManager renderbuffer_manager_; | 147 RenderbufferManager renderbuffer_manager_; |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 // GCC requires these declarations, but MSVC requires they not be present | 150 // GCC requires these declarations, but MSVC requires they not be present |
| 151 #ifndef COMPILER_MSVC | 151 #ifndef COMPILER_MSVC |
| 152 const GLuint FramebufferInfoTest::kClient1Id; | 152 const GLuint FramebufferInfoTest::kClient1Id; |
| 153 const GLuint FramebufferInfoTest::kService1Id; | 153 const GLuint FramebufferInfoTest::kService1Id; |
| 154 const GLint FramebufferInfoTest::kMaxTextureSize; | 154 const GLint FramebufferInfoTest::kMaxTextureSize; |
| 155 const GLint FramebufferInfoTest::kMaxCubemapSize; | 155 const GLint FramebufferInfoTest::kMaxCubemapSize; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const GLsizei kWidth4 = 16; | 197 const GLsizei kWidth4 = 16; |
| 198 const GLsizei kHeight4 = 32; | 198 const GLsizei kHeight4 = 32; |
| 199 const GLenum kFormat4 = GL_STENCIL_INDEX8; | 199 const GLenum kFormat4 = GL_STENCIL_INDEX8; |
| 200 const GLsizei kSamples4 = 0; | 200 const GLsizei kSamples4 = 0; |
| 201 | 201 |
| 202 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 202 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 203 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | 203 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); |
| 204 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); | 204 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); |
| 205 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); | 205 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); |
| 206 | 206 |
| 207 renderbuffer_manager_.CreateRenderbufferInfo( | 207 renderbuffer_manager_.CreateRenderbuffer( |
| 208 kRenderbufferClient1Id, kRenderbufferService1Id); | 208 kRenderbufferClient1Id, kRenderbufferService1Id); |
| 209 RenderbufferManager::RenderbufferInfo* rb_info1 = | 209 Renderbuffer* rb_info1 = |
| 210 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient1Id); | 210 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient1Id); |
| 211 ASSERT_TRUE(rb_info1 != NULL); | 211 ASSERT_TRUE(rb_info1 != NULL); |
| 212 | 212 |
| 213 // check adding one attachment | 213 // check adding one attachment |
| 214 info_->AttachRenderbuffer(GL_COLOR_ATTACHMENT0, rb_info1); | 214 info_->AttachRenderbuffer(GL_COLOR_ATTACHMENT0, rb_info1); |
| 215 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 215 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 216 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | 216 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); |
| 217 EXPECT_EQ(static_cast<GLenum>(GL_RGBA4), info_->GetColorAttachmentFormat()); | 217 EXPECT_EQ(static_cast<GLenum>(GL_RGBA4), info_->GetColorAttachmentFormat()); |
| 218 EXPECT_FALSE(info_->HasDepthAttachment()); | 218 EXPECT_FALSE(info_->HasDepthAttachment()); |
| 219 EXPECT_FALSE(info_->HasStencilAttachment()); | 219 EXPECT_FALSE(info_->HasStencilAttachment()); |
| 220 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), | 220 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 231 renderbuffer_manager_.SetInfo( | 231 renderbuffer_manager_.SetInfo( |
| 232 rb_info1, kSamples1, kFormat1, kWidth1, kHeight1); | 232 rb_info1, kSamples1, kFormat1, kWidth1, kHeight1); |
| 233 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); | 233 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); |
| 234 EXPECT_FALSE(info_->HasDepthAttachment()); | 234 EXPECT_FALSE(info_->HasDepthAttachment()); |
| 235 EXPECT_FALSE(info_->HasStencilAttachment()); | 235 EXPECT_FALSE(info_->HasStencilAttachment()); |
| 236 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 236 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 237 info_->IsPossiblyComplete()); | 237 info_->IsPossiblyComplete()); |
| 238 EXPECT_FALSE(info_->IsCleared()); | 238 EXPECT_FALSE(info_->IsCleared()); |
| 239 | 239 |
| 240 // check adding another | 240 // check adding another |
| 241 renderbuffer_manager_.CreateRenderbufferInfo( | 241 renderbuffer_manager_.CreateRenderbuffer( |
| 242 kRenderbufferClient2Id, kRenderbufferService2Id); | 242 kRenderbufferClient2Id, kRenderbufferService2Id); |
| 243 RenderbufferManager::RenderbufferInfo* rb_info2 = | 243 Renderbuffer* rb_info2 = |
| 244 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient2Id); | 244 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient2Id); |
| 245 ASSERT_TRUE(rb_info2 != NULL); | 245 ASSERT_TRUE(rb_info2 != NULL); |
| 246 info_->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, rb_info2); | 246 info_->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, rb_info2); |
| 247 EXPECT_TRUE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 247 EXPECT_TRUE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 248 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | 248 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); |
| 249 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); | 249 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); |
| 250 EXPECT_TRUE(info_->HasDepthAttachment()); | 250 EXPECT_TRUE(info_->HasDepthAttachment()); |
| 251 EXPECT_FALSE(info_->HasStencilAttachment()); | 251 EXPECT_FALSE(info_->HasStencilAttachment()); |
| 252 // The attachment has a size of 0,0 so depending on the order of the map | 252 // The attachment has a size of 0,0 so depending on the order of the map |
| 253 // of attachments it could either get INCOMPLETE_ATTACHMENT because it's 0,0 | 253 // of attachments it could either get INCOMPLETE_ATTACHMENT because it's 0,0 |
| 254 // or INCOMPLETE_DIMENSIONS because it's not the same size as the other | 254 // or INCOMPLETE_DIMENSIONS because it's not the same size as the other |
| (...skipping 14 matching lines...) Expand all Loading... |
| 269 // check marking them as cleared. | 269 // check marking them as cleared. |
| 270 manager_.MarkAttachmentsAsCleared( | 270 manager_.MarkAttachmentsAsCleared( |
| 271 info_, &renderbuffer_manager_, &texture_manager_); | 271 info_, &renderbuffer_manager_, &texture_manager_); |
| 272 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 272 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 273 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | 273 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); |
| 274 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 274 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 275 info_->IsPossiblyComplete()); | 275 info_->IsPossiblyComplete()); |
| 276 EXPECT_TRUE(info_->IsCleared()); | 276 EXPECT_TRUE(info_->IsCleared()); |
| 277 | 277 |
| 278 // Check adding one that is already cleared. | 278 // Check adding one that is already cleared. |
| 279 renderbuffer_manager_.CreateRenderbufferInfo( | 279 renderbuffer_manager_.CreateRenderbuffer( |
| 280 kRenderbufferClient3Id, kRenderbufferService3Id); | 280 kRenderbufferClient3Id, kRenderbufferService3Id); |
| 281 RenderbufferManager::RenderbufferInfo* rb_info3 = | 281 Renderbuffer* rb_info3 = |
| 282 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient3Id); | 282 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient3Id); |
| 283 ASSERT_TRUE(rb_info3 != NULL); | 283 ASSERT_TRUE(rb_info3 != NULL); |
| 284 renderbuffer_manager_.SetInfo( | 284 renderbuffer_manager_.SetInfo( |
| 285 rb_info3, kSamples3, kFormat3, kWidth3, kHeight3); | 285 rb_info3, kSamples3, kFormat3, kWidth3, kHeight3); |
| 286 renderbuffer_manager_.SetCleared(rb_info3, true); | 286 renderbuffer_manager_.SetCleared(rb_info3, true); |
| 287 | 287 |
| 288 info_->AttachRenderbuffer(GL_STENCIL_ATTACHMENT, rb_info3); | 288 info_->AttachRenderbuffer(GL_STENCIL_ATTACHMENT, rb_info3); |
| 289 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); | 289 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); |
| 290 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); | 290 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); |
| 291 EXPECT_TRUE(info_->HasDepthAttachment()); | 291 EXPECT_TRUE(info_->HasDepthAttachment()); |
| 292 EXPECT_TRUE(info_->HasStencilAttachment()); | 292 EXPECT_TRUE(info_->HasStencilAttachment()); |
| 293 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 293 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 294 info_->IsPossiblyComplete()); | 294 info_->IsPossiblyComplete()); |
| 295 EXPECT_TRUE(info_->IsCleared()); | 295 EXPECT_TRUE(info_->IsCleared()); |
| 296 | 296 |
| 297 // Check marking the renderbuffer as unclared. | 297 // Check marking the renderbuffer as unclared. |
| 298 renderbuffer_manager_.SetInfo( | 298 renderbuffer_manager_.SetInfo( |
| 299 rb_info1, kSamples1, kFormat1, kWidth1, kHeight1); | 299 rb_info1, kSamples1, kFormat1, kWidth1, kHeight1); |
| 300 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); | 300 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); |
| 301 EXPECT_TRUE(info_->HasDepthAttachment()); | 301 EXPECT_TRUE(info_->HasDepthAttachment()); |
| 302 EXPECT_TRUE(info_->HasStencilAttachment()); | 302 EXPECT_TRUE(info_->HasStencilAttachment()); |
| 303 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 303 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 304 info_->IsPossiblyComplete()); | 304 info_->IsPossiblyComplete()); |
| 305 EXPECT_FALSE(info_->IsCleared()); | 305 EXPECT_FALSE(info_->IsCleared()); |
| 306 | 306 |
| 307 const FramebufferManager::FramebufferInfo::Attachment* attachment = | 307 const Framebuffer::Attachment* attachment = |
| 308 info_->GetAttachment(GL_COLOR_ATTACHMENT0); | 308 info_->GetAttachment(GL_COLOR_ATTACHMENT0); |
| 309 ASSERT_TRUE(attachment != NULL); | 309 ASSERT_TRUE(attachment != NULL); |
| 310 EXPECT_EQ(kWidth1, attachment->width()); | 310 EXPECT_EQ(kWidth1, attachment->width()); |
| 311 EXPECT_EQ(kHeight1, attachment->height()); | 311 EXPECT_EQ(kHeight1, attachment->height()); |
| 312 EXPECT_EQ(kSamples1, attachment->samples()); | 312 EXPECT_EQ(kSamples1, attachment->samples()); |
| 313 EXPECT_EQ(kFormat1, attachment->internal_format()); | 313 EXPECT_EQ(kFormat1, attachment->internal_format()); |
| 314 EXPECT_FALSE(attachment->cleared()); | 314 EXPECT_FALSE(attachment->cleared()); |
| 315 | 315 |
| 316 EXPECT_TRUE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 316 EXPECT_TRUE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 317 | 317 |
| 318 // Clear it. | 318 // Clear it. |
| 319 manager_.MarkAttachmentsAsCleared( | 319 manager_.MarkAttachmentsAsCleared( |
| 320 info_, &renderbuffer_manager_, &texture_manager_); | 320 info_, &renderbuffer_manager_, &texture_manager_); |
| 321 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 321 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 322 EXPECT_TRUE(info_->IsCleared()); | 322 EXPECT_TRUE(info_->IsCleared()); |
| 323 | 323 |
| 324 // Check replacing an attachment | 324 // Check replacing an attachment |
| 325 renderbuffer_manager_.CreateRenderbufferInfo( | 325 renderbuffer_manager_.CreateRenderbuffer( |
| 326 kRenderbufferClient4Id, kRenderbufferService4Id); | 326 kRenderbufferClient4Id, kRenderbufferService4Id); |
| 327 RenderbufferManager::RenderbufferInfo* rb_info4 = | 327 Renderbuffer* rb_info4 = |
| 328 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient4Id); | 328 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient4Id); |
| 329 ASSERT_TRUE(rb_info4 != NULL); | 329 ASSERT_TRUE(rb_info4 != NULL); |
| 330 renderbuffer_manager_.SetInfo( | 330 renderbuffer_manager_.SetInfo( |
| 331 rb_info4, kSamples4, kFormat4, kWidth4, kHeight4); | 331 rb_info4, kSamples4, kFormat4, kWidth4, kHeight4); |
| 332 | 332 |
| 333 info_->AttachRenderbuffer(GL_STENCIL_ATTACHMENT, rb_info4); | 333 info_->AttachRenderbuffer(GL_STENCIL_ATTACHMENT, rb_info4); |
| 334 EXPECT_TRUE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); | 334 EXPECT_TRUE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); |
| 335 EXPECT_FALSE(info_->IsCleared()); | 335 EXPECT_FALSE(info_->IsCleared()); |
| 336 | 336 |
| 337 attachment = info_->GetAttachment(GL_STENCIL_ATTACHMENT); | 337 attachment = info_->GetAttachment(GL_STENCIL_ATTACHMENT); |
| 338 ASSERT_TRUE(attachment != NULL); | 338 ASSERT_TRUE(attachment != NULL); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 const GLint kLevel3 = 0; | 408 const GLint kLevel3 = 0; |
| 409 const GLenum kFormat3 = GL_RGB565; | 409 const GLenum kFormat3 = GL_RGB565; |
| 410 const GLsizei kSamples3 = 0; | 410 const GLsizei kSamples3 = 0; |
| 411 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 411 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 412 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | 412 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); |
| 413 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); | 413 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); |
| 414 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); | 414 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); |
| 415 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), | 415 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), |
| 416 info_->IsPossiblyComplete()); | 416 info_->IsPossiblyComplete()); |
| 417 | 417 |
| 418 texture_manager_.CreateTextureInfo(kTextureClient1Id, kTextureService1Id); | 418 texture_manager_.CreateTexture(kTextureClient1Id, kTextureService1Id); |
| 419 TextureManager::TextureInfo::Ref tex_info1 = | 419 scoped_refptr<Texture> tex_info1( |
| 420 texture_manager_.GetTextureInfo(kTextureClient1Id); | 420 texture_manager_.GetTexture(kTextureClient1Id)); |
| 421 ASSERT_TRUE(tex_info1 != NULL); | 421 ASSERT_TRUE(tex_info1 != NULL); |
| 422 | 422 |
| 423 // check adding one attachment | 423 // check adding one attachment |
| 424 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info1, kTarget1, kLevel1); | 424 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info1, kTarget1, kLevel1); |
| 425 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 425 EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 426 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), | 426 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), |
| 427 info_->IsPossiblyComplete()); | 427 info_->IsPossiblyComplete()); |
| 428 EXPECT_TRUE(info_->IsCleared()); | 428 EXPECT_TRUE(info_->IsCleared()); |
| 429 EXPECT_EQ(static_cast<GLenum>(0), info_->GetColorAttachmentFormat()); | 429 EXPECT_EQ(static_cast<GLenum>(0), info_->GetColorAttachmentFormat()); |
| 430 | 430 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 445 info_->IsPossiblyComplete()); | 445 info_->IsPossiblyComplete()); |
| 446 EXPECT_FALSE(info_->IsCleared()); | 446 EXPECT_FALSE(info_->IsCleared()); |
| 447 texture_manager_.SetLevelInfo( | 447 texture_manager_.SetLevelInfo( |
| 448 tex_info1, GL_TEXTURE_2D, kLevel1, | 448 tex_info1, GL_TEXTURE_2D, kLevel1, |
| 449 kFormat1, kWidth1, kHeight1, kDepth, kBorder, kFormat1, kType, true); | 449 kFormat1, kWidth1, kHeight1, kDepth, kBorder, kFormat1, kType, true); |
| 450 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 450 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 451 info_->IsPossiblyComplete()); | 451 info_->IsPossiblyComplete()); |
| 452 EXPECT_TRUE(info_->IsCleared()); | 452 EXPECT_TRUE(info_->IsCleared()); |
| 453 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); | 453 EXPECT_EQ(static_cast<GLenum>(kFormat1), info_->GetColorAttachmentFormat()); |
| 454 | 454 |
| 455 const FramebufferManager::FramebufferInfo::Attachment* attachment = | 455 const Framebuffer::Attachment* attachment = |
| 456 info_->GetAttachment(GL_COLOR_ATTACHMENT0); | 456 info_->GetAttachment(GL_COLOR_ATTACHMENT0); |
| 457 ASSERT_TRUE(attachment != NULL); | 457 ASSERT_TRUE(attachment != NULL); |
| 458 EXPECT_EQ(kWidth1, attachment->width()); | 458 EXPECT_EQ(kWidth1, attachment->width()); |
| 459 EXPECT_EQ(kHeight1, attachment->height()); | 459 EXPECT_EQ(kHeight1, attachment->height()); |
| 460 EXPECT_EQ(kSamples1, attachment->samples()); | 460 EXPECT_EQ(kSamples1, attachment->samples()); |
| 461 EXPECT_EQ(kFormat1, attachment->internal_format()); | 461 EXPECT_EQ(kFormat1, attachment->internal_format()); |
| 462 EXPECT_TRUE(attachment->cleared()); | 462 EXPECT_TRUE(attachment->cleared()); |
| 463 | 463 |
| 464 // Check replacing an attachment | 464 // Check replacing an attachment |
| 465 texture_manager_.CreateTextureInfo(kTextureClient2Id, kTextureService2Id); | 465 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id); |
| 466 TextureManager::TextureInfo::Ref tex_info2 = | 466 scoped_refptr<Texture> tex_info2( |
| 467 texture_manager_.GetTextureInfo(kTextureClient2Id); | 467 texture_manager_.GetTexture(kTextureClient2Id)); |
| 468 ASSERT_TRUE(tex_info2 != NULL); | 468 ASSERT_TRUE(tex_info2 != NULL); |
| 469 texture_manager_.SetInfoTarget(tex_info2, GL_TEXTURE_2D); | 469 texture_manager_.SetInfoTarget(tex_info2, GL_TEXTURE_2D); |
| 470 texture_manager_.SetLevelInfo( | 470 texture_manager_.SetLevelInfo( |
| 471 tex_info2, GL_TEXTURE_2D, kLevel2, | 471 tex_info2, GL_TEXTURE_2D, kLevel2, |
| 472 kFormat2, kWidth2, kHeight2, kDepth, kBorder, kFormat2, kType, true); | 472 kFormat2, kWidth2, kHeight2, kDepth, kBorder, kFormat2, kType, true); |
| 473 | 473 |
| 474 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info2, kTarget2, kLevel2); | 474 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info2, kTarget2, kLevel2); |
| 475 EXPECT_EQ(static_cast<GLenum>(kFormat2), info_->GetColorAttachmentFormat()); | 475 EXPECT_EQ(static_cast<GLenum>(kFormat2), info_->GetColorAttachmentFormat()); |
| 476 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 476 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 477 info_->IsPossiblyComplete()); | 477 info_->IsPossiblyComplete()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 info_->IsPossiblyComplete()); | 517 info_->IsPossiblyComplete()); |
| 518 EXPECT_TRUE(info_->IsCleared()); | 518 EXPECT_TRUE(info_->IsCleared()); |
| 519 } | 519 } |
| 520 | 520 |
| 521 TEST_F(FramebufferInfoTest, UnbindRenderbuffer) { | 521 TEST_F(FramebufferInfoTest, UnbindRenderbuffer) { |
| 522 const GLuint kRenderbufferClient1Id = 33; | 522 const GLuint kRenderbufferClient1Id = 33; |
| 523 const GLuint kRenderbufferService1Id = 333; | 523 const GLuint kRenderbufferService1Id = 333; |
| 524 const GLuint kRenderbufferClient2Id = 34; | 524 const GLuint kRenderbufferClient2Id = 34; |
| 525 const GLuint kRenderbufferService2Id = 334; | 525 const GLuint kRenderbufferService2Id = 334; |
| 526 | 526 |
| 527 renderbuffer_manager_.CreateRenderbufferInfo( | 527 renderbuffer_manager_.CreateRenderbuffer( |
| 528 kRenderbufferClient1Id, kRenderbufferService1Id); | 528 kRenderbufferClient1Id, kRenderbufferService1Id); |
| 529 RenderbufferManager::RenderbufferInfo* rb_info1 = | 529 Renderbuffer* rb_info1 = |
| 530 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient1Id); | 530 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient1Id); |
| 531 ASSERT_TRUE(rb_info1 != NULL); | 531 ASSERT_TRUE(rb_info1 != NULL); |
| 532 renderbuffer_manager_.CreateRenderbufferInfo( | 532 renderbuffer_manager_.CreateRenderbuffer( |
| 533 kRenderbufferClient2Id, kRenderbufferService2Id); | 533 kRenderbufferClient2Id, kRenderbufferService2Id); |
| 534 RenderbufferManager::RenderbufferInfo* rb_info2 = | 534 Renderbuffer* rb_info2 = |
| 535 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient2Id); | 535 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient2Id); |
| 536 ASSERT_TRUE(rb_info2 != NULL); | 536 ASSERT_TRUE(rb_info2 != NULL); |
| 537 | 537 |
| 538 // Attach to 2 attachment points. | 538 // Attach to 2 attachment points. |
| 539 info_->AttachRenderbuffer(GL_COLOR_ATTACHMENT0, rb_info1); | 539 info_->AttachRenderbuffer(GL_COLOR_ATTACHMENT0, rb_info1); |
| 540 info_->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, rb_info1); | 540 info_->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, rb_info1); |
| 541 // Check they were attached. | 541 // Check they were attached. |
| 542 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); | 542 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); |
| 543 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL); | 543 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL); |
| 544 // Unbind unattached renderbuffer. | 544 // Unbind unattached renderbuffer. |
| 545 info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info2); | 545 info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info2); |
| 546 // Should be no-op. | 546 // Should be no-op. |
| 547 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); | 547 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); |
| 548 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL); | 548 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL); |
| 549 // Unbind renderbuffer. | 549 // Unbind renderbuffer. |
| 550 info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info1); | 550 info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info1); |
| 551 // Check they were detached | 551 // Check they were detached |
| 552 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL); | 552 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL); |
| 553 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) == NULL); | 553 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) == NULL); |
| 554 } | 554 } |
| 555 | 555 |
| 556 TEST_F(FramebufferInfoTest, UnbindTexture) { | 556 TEST_F(FramebufferInfoTest, UnbindTexture) { |
| 557 const GLuint kTextureClient1Id = 33; | 557 const GLuint kTextureClient1Id = 33; |
| 558 const GLuint kTextureService1Id = 333; | 558 const GLuint kTextureService1Id = 333; |
| 559 const GLuint kTextureClient2Id = 34; | 559 const GLuint kTextureClient2Id = 34; |
| 560 const GLuint kTextureService2Id = 334; | 560 const GLuint kTextureService2Id = 334; |
| 561 const GLenum kTarget1 = GL_TEXTURE_2D; | 561 const GLenum kTarget1 = GL_TEXTURE_2D; |
| 562 const GLint kLevel1 = 0; | 562 const GLint kLevel1 = 0; |
| 563 | 563 |
| 564 texture_manager_.CreateTextureInfo(kTextureClient1Id, kTextureService1Id); | 564 texture_manager_.CreateTexture(kTextureClient1Id, kTextureService1Id); |
| 565 TextureManager::TextureInfo::Ref tex_info1 = | 565 scoped_refptr<Texture> tex_info1( |
| 566 texture_manager_.GetTextureInfo(kTextureClient1Id); | 566 texture_manager_.GetTexture(kTextureClient1Id)); |
| 567 ASSERT_TRUE(tex_info1 != NULL); | 567 ASSERT_TRUE(tex_info1 != NULL); |
| 568 texture_manager_.CreateTextureInfo(kTextureClient2Id, kTextureService2Id); | 568 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id); |
| 569 TextureManager::TextureInfo::Ref tex_info2 = | 569 scoped_refptr<Texture> tex_info2( |
| 570 texture_manager_.GetTextureInfo(kTextureClient2Id); | 570 texture_manager_.GetTexture(kTextureClient2Id)); |
| 571 ASSERT_TRUE(tex_info2 != NULL); | 571 ASSERT_TRUE(tex_info2 != NULL); |
| 572 | 572 |
| 573 // Attach to 2 attachment points. | 573 // Attach to 2 attachment points. |
| 574 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info1, kTarget1, kLevel1); | 574 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info1, kTarget1, kLevel1); |
| 575 info_->AttachTexture(GL_DEPTH_ATTACHMENT, tex_info1, kTarget1, kLevel1); | 575 info_->AttachTexture(GL_DEPTH_ATTACHMENT, tex_info1, kTarget1, kLevel1); |
| 576 // Check they were attached. | 576 // Check they were attached. |
| 577 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); | 577 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); |
| 578 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL); | 578 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL); |
| 579 // Unbind unattached texture. | 579 // Unbind unattached texture. |
| 580 info_->UnbindTexture(kTarget1, tex_info2); | 580 info_->UnbindTexture(kTarget1, tex_info2); |
| 581 // Should be no-op. | 581 // Should be no-op. |
| 582 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); | 582 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); |
| 583 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL); | 583 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL); |
| 584 // Unbind texture. | 584 // Unbind texture. |
| 585 info_->UnbindTexture(kTarget1, tex_info1); | 585 info_->UnbindTexture(kTarget1, tex_info1); |
| 586 // Check they were detached | 586 // Check they were detached |
| 587 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL); | 587 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL); |
| 588 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) == NULL); | 588 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) == NULL); |
| 589 } | 589 } |
| 590 | 590 |
| 591 TEST_F(FramebufferInfoTest, IsCompleteMarkAsComplete) { | 591 TEST_F(FramebufferInfoTest, IsCompleteMarkAsComplete) { |
| 592 const GLuint kRenderbufferClient1Id = 33; | 592 const GLuint kRenderbufferClient1Id = 33; |
| 593 const GLuint kRenderbufferService1Id = 333; | 593 const GLuint kRenderbufferService1Id = 333; |
| 594 const GLuint kTextureClient2Id = 34; | 594 const GLuint kTextureClient2Id = 34; |
| 595 const GLuint kTextureService2Id = 334; | 595 const GLuint kTextureService2Id = 334; |
| 596 const GLenum kTarget1 = GL_TEXTURE_2D; | 596 const GLenum kTarget1 = GL_TEXTURE_2D; |
| 597 const GLint kLevel1 = 0; | 597 const GLint kLevel1 = 0; |
| 598 | 598 |
| 599 renderbuffer_manager_.CreateRenderbufferInfo( | 599 renderbuffer_manager_.CreateRenderbuffer( |
| 600 kRenderbufferClient1Id, kRenderbufferService1Id); | 600 kRenderbufferClient1Id, kRenderbufferService1Id); |
| 601 RenderbufferManager::RenderbufferInfo* rb_info1 = | 601 Renderbuffer* rb_info1 = |
| 602 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient1Id); | 602 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient1Id); |
| 603 ASSERT_TRUE(rb_info1 != NULL); | 603 ASSERT_TRUE(rb_info1 != NULL); |
| 604 texture_manager_.CreateTextureInfo(kTextureClient2Id, kTextureService2Id); | 604 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id); |
| 605 TextureManager::TextureInfo::Ref tex_info2 = | 605 scoped_refptr<Texture> tex_info2( |
| 606 texture_manager_.GetTextureInfo(kTextureClient2Id); | 606 texture_manager_.GetTexture(kTextureClient2Id)); |
| 607 ASSERT_TRUE(tex_info2 != NULL); | 607 ASSERT_TRUE(tex_info2 != NULL); |
| 608 | 608 |
| 609 // Check MarkAsComlete marks as complete. | 609 // Check MarkAsComlete marks as complete. |
| 610 manager_.MarkAsComplete(info_); | 610 manager_.MarkAsComplete(info_); |
| 611 EXPECT_TRUE(manager_.IsComplete(info_)); | 611 EXPECT_TRUE(manager_.IsComplete(info_)); |
| 612 | 612 |
| 613 // Check at attaching marks as not complete. | 613 // Check at attaching marks as not complete. |
| 614 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info2, kTarget1, kLevel1); | 614 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info2, kTarget1, kLevel1); |
| 615 EXPECT_FALSE(manager_.IsComplete(info_)); | 615 EXPECT_FALSE(manager_.IsComplete(info_)); |
| 616 manager_.MarkAsComplete(info_); | 616 manager_.MarkAsComplete(info_); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 633 } | 633 } |
| 634 | 634 |
| 635 TEST_F(FramebufferInfoTest, Gettatus) { | 635 TEST_F(FramebufferInfoTest, Gettatus) { |
| 636 const GLuint kRenderbufferClient1Id = 33; | 636 const GLuint kRenderbufferClient1Id = 33; |
| 637 const GLuint kRenderbufferService1Id = 333; | 637 const GLuint kRenderbufferService1Id = 333; |
| 638 const GLuint kTextureClient2Id = 34; | 638 const GLuint kTextureClient2Id = 34; |
| 639 const GLuint kTextureService2Id = 334; | 639 const GLuint kTextureService2Id = 334; |
| 640 const GLenum kTarget1 = GL_TEXTURE_2D; | 640 const GLenum kTarget1 = GL_TEXTURE_2D; |
| 641 const GLint kLevel1 = 0; | 641 const GLint kLevel1 = 0; |
| 642 | 642 |
| 643 renderbuffer_manager_.CreateRenderbufferInfo( | 643 renderbuffer_manager_.CreateRenderbuffer( |
| 644 kRenderbufferClient1Id, kRenderbufferService1Id); | 644 kRenderbufferClient1Id, kRenderbufferService1Id); |
| 645 RenderbufferManager::RenderbufferInfo* rb_info1 = | 645 Renderbuffer* rb_info1 = |
| 646 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient1Id); | 646 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient1Id); |
| 647 ASSERT_TRUE(rb_info1 != NULL); | 647 ASSERT_TRUE(rb_info1 != NULL); |
| 648 texture_manager_.CreateTextureInfo(kTextureClient2Id, kTextureService2Id); | 648 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id); |
| 649 TextureManager::TextureInfo::Ref tex_info2 = | 649 scoped_refptr<Texture> tex_info2( |
| 650 texture_manager_.GetTextureInfo(kTextureClient2Id); | 650 texture_manager_.GetTexture(kTextureClient2Id)); |
| 651 ASSERT_TRUE(tex_info2 != NULL); | 651 ASSERT_TRUE(tex_info2 != NULL); |
| 652 texture_manager_.SetInfoTarget(tex_info2, GL_TEXTURE_2D); | 652 texture_manager_.SetInfoTarget(tex_info2, GL_TEXTURE_2D); |
| 653 | 653 |
| 654 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) | 654 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
| 655 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 655 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 656 .RetiresOnSaturation(); | 656 .RetiresOnSaturation(); |
| 657 info_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); | 657 info_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); |
| 658 | 658 |
| 659 // Check a second call for the same type does not call anything | 659 // Check a second call for the same type does not call anything |
| 660 info_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); | 660 info_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 // Check Unbinding does not call CheckFramebufferStatus | 708 // Check Unbinding does not call CheckFramebufferStatus |
| 709 info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info1); | 709 info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info1); |
| 710 info_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); | 710 info_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); |
| 711 } | 711 } |
| 712 | 712 |
| 713 } // namespace gles2 | 713 } // namespace gles2 |
| 714 } // namespace gpu | 714 } // namespace gpu |
| 715 | 715 |
| 716 | 716 |
| OLD | NEW |