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

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

Issue 14844004: gpu: Refactor to support cross-channel shared textures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix accidentally reverted behavior Created 7 years, 7 months 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) 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/error_state_mock.h" 5 #include "gpu/command_buffer/service/error_state_mock.h"
6 #include "gpu/command_buffer/service/framebuffer_manager.h" 6 #include "gpu/command_buffer/service/framebuffer_manager.h"
7 #include "gpu/command_buffer/service/feature_info.h" 7 #include "gpu/command_buffer/service/feature_info.h"
8 #include "gpu/command_buffer/service/renderbuffer_manager.h" 8 #include "gpu/command_buffer/service/renderbuffer_manager.h"
9 #include "gpu/command_buffer/service/test_helper.h" 9 #include "gpu/command_buffer/service/test_helper.h"
10 #include "gpu/command_buffer/service/texture_manager.h" 10 #include "gpu/command_buffer/service/texture_manager.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 const GLsizei kSamples3 = 0; 422 const GLsizei kSamples3 = 0;
423 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); 423 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0));
424 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); 424 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT));
425 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); 425 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT));
426 EXPECT_FALSE( 426 EXPECT_FALSE(
427 framebuffer_->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)); 427 framebuffer_->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT));
428 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), 428 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT),
429 framebuffer_->IsPossiblyComplete()); 429 framebuffer_->IsPossiblyComplete());
430 430
431 texture_manager_.CreateTexture(kTextureClient1Id, kTextureService1Id); 431 texture_manager_.CreateTexture(kTextureClient1Id, kTextureService1Id);
432 scoped_refptr<Texture> texture1( 432 scoped_refptr<TextureRef> texture1(
433 texture_manager_.GetTexture(kTextureClient1Id)); 433 texture_manager_.GetTexture(kTextureClient1Id));
434 ASSERT_TRUE(texture1 != NULL); 434 ASSERT_TRUE(texture1 != NULL);
435 435
436 // check adding one attachment 436 // check adding one attachment
437 framebuffer_->AttachTexture( 437 framebuffer_->AttachTexture(
438 GL_COLOR_ATTACHMENT0, texture1, kTarget1, kLevel1); 438 GL_COLOR_ATTACHMENT0, texture1, kTarget1, kLevel1);
439 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); 439 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0));
440 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), 440 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT),
441 framebuffer_->IsPossiblyComplete()); 441 framebuffer_->IsPossiblyComplete());
442 EXPECT_TRUE(framebuffer_->IsCleared()); 442 EXPECT_TRUE(framebuffer_->IsCleared());
(...skipping 28 matching lines...) Expand all
471 framebuffer_->GetAttachment(GL_COLOR_ATTACHMENT0); 471 framebuffer_->GetAttachment(GL_COLOR_ATTACHMENT0);
472 ASSERT_TRUE(attachment != NULL); 472 ASSERT_TRUE(attachment != NULL);
473 EXPECT_EQ(kWidth1, attachment->width()); 473 EXPECT_EQ(kWidth1, attachment->width());
474 EXPECT_EQ(kHeight1, attachment->height()); 474 EXPECT_EQ(kHeight1, attachment->height());
475 EXPECT_EQ(kSamples1, attachment->samples()); 475 EXPECT_EQ(kSamples1, attachment->samples());
476 EXPECT_EQ(kFormat1, attachment->internal_format()); 476 EXPECT_EQ(kFormat1, attachment->internal_format());
477 EXPECT_TRUE(attachment->cleared()); 477 EXPECT_TRUE(attachment->cleared());
478 478
479 // Check replacing an attachment 479 // Check replacing an attachment
480 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id); 480 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id);
481 scoped_refptr<Texture> texture2( 481 scoped_refptr<TextureRef> texture2(
482 texture_manager_.GetTexture(kTextureClient2Id)); 482 texture_manager_.GetTexture(kTextureClient2Id));
483 ASSERT_TRUE(texture2 != NULL); 483 ASSERT_TRUE(texture2 != NULL);
484 texture_manager_.SetTarget(texture2, GL_TEXTURE_2D); 484 texture_manager_.SetTarget(texture2, GL_TEXTURE_2D);
485 texture_manager_.SetLevelInfo( 485 texture_manager_.SetLevelInfo(
486 texture2, GL_TEXTURE_2D, kLevel2, 486 texture2, GL_TEXTURE_2D, kLevel2,
487 kFormat2, kWidth2, kHeight2, kDepth, kBorder, kFormat2, kType, true); 487 kFormat2, kWidth2, kHeight2, kDepth, kBorder, kFormat2, kType, true);
488 488
489 framebuffer_->AttachTexture( 489 framebuffer_->AttachTexture(
490 GL_COLOR_ATTACHMENT0, texture2, kTarget2, kLevel2); 490 GL_COLOR_ATTACHMENT0, texture2, kTarget2, kLevel2);
491 EXPECT_EQ(static_cast<GLenum>(kFormat2), 491 EXPECT_EQ(static_cast<GLenum>(kFormat2),
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 573
574 TEST_F(FramebufferInfoTest, UnbindTexture) { 574 TEST_F(FramebufferInfoTest, UnbindTexture) {
575 const GLuint kTextureClient1Id = 33; 575 const GLuint kTextureClient1Id = 33;
576 const GLuint kTextureService1Id = 333; 576 const GLuint kTextureService1Id = 333;
577 const GLuint kTextureClient2Id = 34; 577 const GLuint kTextureClient2Id = 34;
578 const GLuint kTextureService2Id = 334; 578 const GLuint kTextureService2Id = 334;
579 const GLenum kTarget1 = GL_TEXTURE_2D; 579 const GLenum kTarget1 = GL_TEXTURE_2D;
580 const GLint kLevel1 = 0; 580 const GLint kLevel1 = 0;
581 581
582 texture_manager_.CreateTexture(kTextureClient1Id, kTextureService1Id); 582 texture_manager_.CreateTexture(kTextureClient1Id, kTextureService1Id);
583 scoped_refptr<Texture> texture1( 583 scoped_refptr<TextureRef> texture1(
584 texture_manager_.GetTexture(kTextureClient1Id)); 584 texture_manager_.GetTexture(kTextureClient1Id));
585 ASSERT_TRUE(texture1 != NULL); 585 ASSERT_TRUE(texture1 != NULL);
586 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id); 586 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id);
587 scoped_refptr<Texture> texture2( 587 scoped_refptr<TextureRef> texture2(
588 texture_manager_.GetTexture(kTextureClient2Id)); 588 texture_manager_.GetTexture(kTextureClient2Id));
589 ASSERT_TRUE(texture2 != NULL); 589 ASSERT_TRUE(texture2 != NULL);
590 590
591 // Attach to 2 attachment points. 591 // Attach to 2 attachment points.
592 framebuffer_->AttachTexture( 592 framebuffer_->AttachTexture(
593 GL_COLOR_ATTACHMENT0, texture1, kTarget1, kLevel1); 593 GL_COLOR_ATTACHMENT0, texture1, kTarget1, kLevel1);
594 framebuffer_->AttachTexture( 594 framebuffer_->AttachTexture(
595 GL_DEPTH_ATTACHMENT, texture1, kTarget1, kLevel1); 595 GL_DEPTH_ATTACHMENT, texture1, kTarget1, kLevel1);
596 // Check they were attached. 596 // Check they were attached.
597 EXPECT_TRUE(framebuffer_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL); 597 EXPECT_TRUE(framebuffer_->GetAttachment(GL_COLOR_ATTACHMENT0) != NULL);
(...skipping 17 matching lines...) Expand all
615 const GLuint kTextureService2Id = 334; 615 const GLuint kTextureService2Id = 334;
616 const GLenum kTarget1 = GL_TEXTURE_2D; 616 const GLenum kTarget1 = GL_TEXTURE_2D;
617 const GLint kLevel1 = 0; 617 const GLint kLevel1 = 0;
618 618
619 renderbuffer_manager_.CreateRenderbuffer( 619 renderbuffer_manager_.CreateRenderbuffer(
620 kRenderbufferClient1Id, kRenderbufferService1Id); 620 kRenderbufferClient1Id, kRenderbufferService1Id);
621 Renderbuffer* renderbuffer1 = 621 Renderbuffer* renderbuffer1 =
622 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient1Id); 622 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient1Id);
623 ASSERT_TRUE(renderbuffer1 != NULL); 623 ASSERT_TRUE(renderbuffer1 != NULL);
624 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id); 624 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id);
625 scoped_refptr<Texture> texture2( 625 scoped_refptr<TextureRef> texture2(
626 texture_manager_.GetTexture(kTextureClient2Id)); 626 texture_manager_.GetTexture(kTextureClient2Id));
627 ASSERT_TRUE(texture2 != NULL); 627 ASSERT_TRUE(texture2 != NULL);
628 628
629 // Check MarkAsComlete marks as complete. 629 // Check MarkAsComlete marks as complete.
630 manager_.MarkAsComplete(framebuffer_); 630 manager_.MarkAsComplete(framebuffer_);
631 EXPECT_TRUE(manager_.IsComplete(framebuffer_)); 631 EXPECT_TRUE(manager_.IsComplete(framebuffer_));
632 632
633 // Check at attaching marks as not complete. 633 // Check at attaching marks as not complete.
634 framebuffer_->AttachTexture( 634 framebuffer_->AttachTexture(
635 GL_COLOR_ATTACHMENT0, texture2, kTarget1, kLevel1); 635 GL_COLOR_ATTACHMENT0, texture2, kTarget1, kLevel1);
(...skipping 24 matching lines...) Expand all
660 const GLuint kTextureService2Id = 334; 660 const GLuint kTextureService2Id = 334;
661 const GLenum kTarget1 = GL_TEXTURE_2D; 661 const GLenum kTarget1 = GL_TEXTURE_2D;
662 const GLint kLevel1 = 0; 662 const GLint kLevel1 = 0;
663 663
664 renderbuffer_manager_.CreateRenderbuffer( 664 renderbuffer_manager_.CreateRenderbuffer(
665 kRenderbufferClient1Id, kRenderbufferService1Id); 665 kRenderbufferClient1Id, kRenderbufferService1Id);
666 Renderbuffer* renderbuffer1 = 666 Renderbuffer* renderbuffer1 =
667 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient1Id); 667 renderbuffer_manager_.GetRenderbuffer(kRenderbufferClient1Id);
668 ASSERT_TRUE(renderbuffer1 != NULL); 668 ASSERT_TRUE(renderbuffer1 != NULL);
669 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id); 669 texture_manager_.CreateTexture(kTextureClient2Id, kTextureService2Id);
670 scoped_refptr<Texture> texture2( 670 scoped_refptr<TextureRef> texture2(
671 texture_manager_.GetTexture(kTextureClient2Id)); 671 texture_manager_.GetTexture(kTextureClient2Id));
672 ASSERT_TRUE(texture2 != NULL); 672 ASSERT_TRUE(texture2 != NULL);
673 texture_manager_.SetTarget(texture2, GL_TEXTURE_2D); 673 texture_manager_.SetTarget(texture2, GL_TEXTURE_2D);
674 674
675 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) 675 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
676 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 676 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
677 .RetiresOnSaturation(); 677 .RetiresOnSaturation();
678 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); 678 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER);
679 679
680 // Check a second call for the same type does not call anything 680 // Check a second call for the same type does not call anything
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 763 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
764 .RetiresOnSaturation(); 764 .RetiresOnSaturation();
765 } 765 }
766 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 766 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
767 } 767 }
768 768
769 } // namespace gles2 769 } // namespace gles2
770 } // namespace gpu 770 } // namespace gpu
771 771
772 772
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