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

Side by Side Diff: gpu/command_buffer/service/framebuffer_manager_unittest.cc

Issue 8515023: Allow deleted resources to be used (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "gpu/command_buffer/common/gl_mock.h" 8 #include "gpu/command_buffer/common/gl_mock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // Check removing it. 485 // Check removing it.
486 info_->AttachTexture(GL_COLOR_ATTACHMENT0, NULL, 0, 0); 486 info_->AttachTexture(GL_COLOR_ATTACHMENT0, NULL, 0, 0);
487 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL); 487 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL);
488 EXPECT_EQ(static_cast<GLenum>(0), info_->GetColorAttachmentFormat()); 488 EXPECT_EQ(static_cast<GLenum>(0), info_->GetColorAttachmentFormat());
489 489
490 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), 490 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT),
491 info_->IsPossiblyComplete()); 491 info_->IsPossiblyComplete());
492 EXPECT_TRUE(info_->IsCleared()); 492 EXPECT_TRUE(info_->IsCleared());
493 } 493 }
494 494
495 TEST_F(FramebufferInfoTest, UnbindRenderbuffer) {
496 const GLuint kRenderbufferClient1Id = 33;
497 const GLuint kRenderbufferService1Id = 333;
498 const GLuint kRenderbufferClient2Id = 34;
499 const GLuint kRenderbufferService2Id = 334;
500
501 renderbuffer_manager_.CreateRenderbufferInfo(
502 kRenderbufferClient1Id, kRenderbufferService1Id);
503 RenderbufferManager::RenderbufferInfo* rb_info1 =
504 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient1Id);
505 ASSERT_TRUE(rb_info1 != NULL);
506 renderbuffer_manager_.CreateRenderbufferInfo(
507 kRenderbufferClient2Id, kRenderbufferService2Id);
508 RenderbufferManager::RenderbufferInfo* rb_info2 =
509 renderbuffer_manager_.GetRenderbufferInfo(kRenderbufferClient2Id);
510 ASSERT_TRUE(rb_info2 != NULL);
511
512 // Attach to 2 attachment points.
513 info_->AttachRenderbuffer(GL_COLOR_ATTACHMENT0, rb_info1);
514 info_->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, rb_info1);
515 // Check they were attached.
516 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL);
517 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL);
518 // Unbind unattached renderbuffer.
519 info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info2);
520 // Should be no-op.
521 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL);
522 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL);
523 // Unbind renderbuffer.
524 info_->UnbindRenderbuffer(GL_RENDERBUFFER, rb_info1);
525 // Check they were detached
526 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL);
527 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) == NULL);
528 }
529
530 TEST_F(FramebufferInfoTest, UnbindTexture) {
531 const GLuint kTextureClient1Id = 33;
532 const GLuint kTextureService1Id = 333;
533 const GLuint kTextureClient2Id = 34;
534 const GLuint kTextureService2Id = 334;
535 const GLenum kTarget1 = GL_TEXTURE_2D;
536 const GLint kLevel1 = 0;
537
538 FeatureInfo feature_info;
539 texture_manager_.CreateTextureInfo(
540 &feature_info, kTextureClient1Id, kTextureService1Id);
541 TextureManager::TextureInfo* tex_info1 =
542 texture_manager_.GetTextureInfo(kTextureClient1Id);
543 ASSERT_TRUE(tex_info1 != NULL);
544 texture_manager_.CreateTextureInfo(
545 &feature_info, kTextureClient2Id, kTextureService2Id);
546 TextureManager::TextureInfo* tex_info2 =
547 texture_manager_.GetTextureInfo(kTextureClient2Id);
548 ASSERT_TRUE(tex_info2 != NULL);
549
550 // Attach to 2 attachment points.
551 info_->AttachTexture(GL_COLOR_ATTACHMENT0, tex_info1, kTarget1, kLevel1);
552 info_->AttachTexture(GL_DEPTH_ATTACHMENT, tex_info1, kTarget1, kLevel1);
553 // Check they were attached.
554 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL);
555 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL);
556 // Unbind unattached texture.
557 info_->UnbindTexture(kTarget1, tex_info2);
558 // Should be no-op.
559 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL);
560 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) != NULL);
561 // Unbind texture.
562 info_->UnbindTexture(kTarget1, tex_info1);
563 // Check they were detached
564 EXPECT_TRUE(info_->GetAttachment(GL_COLOR_ATTACHMENT0) == NULL);
565 EXPECT_TRUE(info_->GetAttachment(GL_DEPTH_ATTACHMENT) == NULL);
566 }
567
495 } // namespace gles2 568 } // namespace gles2
496 } // namespace gpu 569 } // namespace gpu
497 570
498 571
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698