Index: gpu/command_buffer/service/framebuffer_manager_unittest.cc |
diff --git a/gpu/command_buffer/service/framebuffer_manager_unittest.cc b/gpu/command_buffer/service/framebuffer_manager_unittest.cc |
index c5304f1e6c0b0d55f1f42214744d5e45e6235a55..e496760405d1e0105c380db7ef49eda6e9a9af9f 100644 |
--- a/gpu/command_buffer/service/framebuffer_manager_unittest.cc |
+++ b/gpu/command_buffer/service/framebuffer_manager_unittest.cc |
@@ -556,6 +556,62 @@ TEST_F(FramebufferInfoTest, AttachTexture) { |
EXPECT_TRUE(framebuffer_->IsCleared()); |
} |
+TEST_F(FramebufferInfoTest, AttachTextureLayer) { |
+ const GLuint kTextureClientId = 33; |
+ const GLuint kTextureServiceId = 333; |
+ const GLint kBorder = 0; |
+ const GLenum kType = GL_UNSIGNED_BYTE; |
+ const GLsizei kWidth = 16; |
+ const GLsizei kHeight = 32; |
+ const GLint kDepth = 2; |
+ const GLint kLevel = 0; |
+ const GLenum kFormat = GL_RGBA; |
+ const GLenum kTarget = GL_TEXTURE_2D_ARRAY; |
+ const GLsizei kLayer = 0; |
+ const GLint kWrongLayer = kDepth; |
+ |
+ EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), |
+ framebuffer_->IsPossiblyComplete(feature_info_.get())); |
+ |
+ texture_manager_->CreateTexture(kTextureClientId, kTextureServiceId); |
+ scoped_refptr<TextureRef> texture( |
+ texture_manager_->GetTexture(kTextureClientId)); |
+ ASSERT_TRUE(texture.get()); |
+ |
+ framebuffer_->AttachTextureLayer( |
+ GL_COLOR_ATTACHMENT0, texture.get(), kTarget, kLevel, kWrongLayer); |
+ EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
+ EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), |
+ framebuffer_->IsPossiblyComplete(feature_info_.get())); |
+ EXPECT_TRUE(framebuffer_->IsCleared()); |
+ EXPECT_EQ(static_cast<GLenum>(0), |
+ framebuffer_->GetReadBufferInternalFormat()); |
+ |
+ texture_manager_->SetTarget(texture.get(), kTarget); |
+ texture_manager_->SetLevelInfo(texture.get(), kTarget, kLevel, |
+ kFormat, kWidth, kHeight, kDepth, kBorder, |
+ kFormat, kType, gfx::Rect()); |
+ EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), |
+ framebuffer_->IsPossiblyComplete(feature_info_.get())); |
+ |
+ framebuffer_->AttachTextureLayer( |
+ GL_COLOR_ATTACHMENT0, texture.get(), kTarget, kLevel, kLayer); |
+ EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
+ EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
+ framebuffer_->IsPossiblyComplete(feature_info_.get())); |
+ EXPECT_FALSE(framebuffer_->IsCleared()); |
+ EXPECT_EQ(static_cast<GLenum>(kFormat), |
+ framebuffer_->GetReadBufferInternalFormat()); |
+ |
+ const Framebuffer::Attachment* attachment = |
+ framebuffer_->GetAttachment(GL_COLOR_ATTACHMENT0); |
+ ASSERT_TRUE(attachment); |
+ EXPECT_EQ(kWidth, attachment->width()); |
+ EXPECT_EQ(kHeight, attachment->height()); |
+ EXPECT_EQ(kFormat, attachment->internal_format()); |
+ EXPECT_FALSE(attachment->cleared()); |
+} |
+ |
TEST_F(FramebufferInfoTest, ClearPartiallyClearedAttachments) { |
const GLuint kTextureClientId = 33; |
const GLuint kTextureServiceId = 333; |