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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 635543002: cc: Make ResourceProvider use bindless Produce/ConsumeTextureCHROMIUM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove redundant func. Created 5 years, 10 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 1430
1431 switch (impl->active_tree()->source_frame_number()) { 1431 switch (impl->active_tree()->source_frame_number()) {
1432 case 0: 1432 case 0:
1433 // Number of textures should be one for each layer 1433 // Number of textures should be one for each layer
1434 ASSERT_EQ(2u, context->NumTextures()); 1434 ASSERT_EQ(2u, context->NumTextures());
1435 // Number of textures used for commit should be one for each layer. 1435 // Number of textures used for commit should be one for each layer.
1436 EXPECT_EQ(2u, context->NumUsedTextures()); 1436 EXPECT_EQ(2u, context->NumUsedTextures());
1437 // Verify that used texture is correct. 1437 // Verify that used texture is correct.
1438 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); 1438 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0)));
1439 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); 1439 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1)));
1440 context->ResetUsedTextures();
1441 break; 1440 break;
1442 case 1: 1441 case 1:
1443 // Number of textures should be doubled as the first context layer 1442 // Number of textures should be doubled as the first context layer
1444 // texture is being used by the impl-thread and cannot be used for 1443 // texture is being used by the impl-thread and cannot be used for
1445 // update. The scrollbar behavior is different direct renderer because 1444 // update. The scrollbar behavior is different direct renderer because
1446 // UI resource deletion with delegating renderer occurs after tree 1445 // UI resource deletion with delegating renderer occurs after tree
1447 // activation. 1446 // activation.
1448 ASSERT_EQ(4u, context->NumTextures()); 1447 ASSERT_EQ(4u, context->NumTextures());
1449 // Number of textures used for commit should still be 1448 // Number of textures used for commit should still be
1450 // one for each layer. 1449 // one for each layer.
1451 EXPECT_EQ(2u, context->NumUsedTextures()); 1450 EXPECT_EQ(2u, context->NumUsedTextures());
1452 // First textures should not have been used. 1451 // First textures should not have been used.
1453 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); 1452 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0)));
1454 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); 1453 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1)));
1455 // New textures should have been used. 1454 // New textures should have been used.
1456 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); 1455 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2)));
1457 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); 1456 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3)));
1458 context->ResetUsedTextures();
1459 break; 1457 break;
1460 case 2: 1458 case 2:
1461 EndTest(); 1459 EndTest();
1462 break; 1460 break;
1463 default: 1461 default:
1464 NOTREACHED(); 1462 NOTREACHED();
1465 break; 1463 break;
1466 } 1464 }
1467 } 1465 }
1468 }; 1466 };
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target, 2684 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target,
2687 GLint width, 2685 GLint width,
2688 GLint height, 2686 GLint height,
2689 GLuint ioSurfaceId, 2687 GLuint ioSurfaceId,
2690 GLuint plane)); 2688 GLuint plane));
2691 MOCK_METHOD4(drawElements, void(GLenum mode, 2689 MOCK_METHOD4(drawElements, void(GLenum mode,
2692 GLsizei count, 2690 GLsizei count,
2693 GLenum type, 2691 GLenum type,
2694 GLintptr offset)); 2692 GLintptr offset));
2695 MOCK_METHOD1(deleteTexture, void(GLenum texture)); 2693 MOCK_METHOD1(deleteTexture, void(GLenum texture));
2696 MOCK_METHOD2(produceTextureCHROMIUM, 2694 MOCK_METHOD3(produceTextureDirectCHROMIUM,
2697 void(GLenum target, const GLbyte* mailbox)); 2695 void(GLuint texture, GLenum target, const GLbyte* mailbox));
2698 }; 2696 };
2699 2697
2700 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { 2698 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
2701 protected: 2699 protected:
2702 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { 2700 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override {
2703 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned( 2701 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned(
2704 new MockIOSurfaceWebGraphicsContext3D); 2702 new MockIOSurfaceWebGraphicsContext3D);
2705 mock_context_ = mock_context_owned.get(); 2703 mock_context_ = mock_context_owned.get();
2706 2704
2707 if (delegating_renderer()) 2705 if (delegating_renderer())
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 const DrawQuad* quad = frame->render_passes[0]->quad_list.front(); 2775 const DrawQuad* quad = frame->render_passes[0]->quad_list.front();
2778 CHECK_EQ(DrawQuad::IO_SURFACE_CONTENT, quad->material); 2776 CHECK_EQ(DrawQuad::IO_SURFACE_CONTENT, quad->material);
2779 const IOSurfaceDrawQuad* io_surface_draw_quad = 2777 const IOSurfaceDrawQuad* io_surface_draw_quad =
2780 IOSurfaceDrawQuad::MaterialCast(quad); 2778 IOSurfaceDrawQuad::MaterialCast(quad);
2781 EXPECT_EQ(io_surface_size_, io_surface_draw_quad->io_surface_size); 2779 EXPECT_EQ(io_surface_size_, io_surface_draw_quad->io_surface_size);
2782 EXPECT_NE(0u, io_surface_draw_quad->io_surface_resource_id); 2780 EXPECT_NE(0u, io_surface_draw_quad->io_surface_resource_id);
2783 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_RECTANGLE_ARB), 2781 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_RECTANGLE_ARB),
2784 resource_provider->TargetForTesting( 2782 resource_provider->TargetForTesting(
2785 io_surface_draw_quad->io_surface_resource_id)); 2783 io_surface_draw_quad->io_surface_resource_id));
2786 2784
2787 EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1))
2788 .Times(1);
2789 if (delegating_renderer()) { 2785 if (delegating_renderer()) {
2790 // The io surface layer's resource should be sent to the parent. 2786 // The io surface layer's resource should be sent to the parent.
2791 EXPECT_CALL(*mock_context_, 2787 EXPECT_CALL(*mock_context_, produceTextureDirectCHROMIUM(
2792 produceTextureCHROMIUM(GL_TEXTURE_RECTANGLE_ARB, _)).Times(1); 2788 _, GL_TEXTURE_RECTANGLE_ARB, _)).Times(1);
2793 } else { 2789 } else {
2794 // The io surface layer's texture is drawn. 2790 // The io surface layer's texture is drawn.
2795 EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1)); 2791 EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1));
2796 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _)) 2792 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _))
2797 .Times(AtLeast(1)); 2793 .Times(AtLeast(1));
2798 } 2794 }
2799 2795
2800 return draw_result; 2796 return draw_result;
2801 } 2797 }
2802 2798
(...skipping 3392 matching lines...) Expand 10 before | Expand all | Expand 10 after
6195 6191
6196 void AfterTest() override { EXPECT_TRUE(did_commit_); } 6192 void AfterTest() override { EXPECT_TRUE(did_commit_); }
6197 6193
6198 private: 6194 private:
6199 bool did_commit_; 6195 bool did_commit_;
6200 }; 6196 };
6201 6197
6202 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); 6198 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
6203 6199
6204 } // namespace cc 6200 } // namespace cc
OLDNEW
« cc/resources/resource_provider_unittest.cc ('K') | « cc/test/test_web_graphics_context_3d.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698