OLD | NEW |
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 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 | 1433 |
1434 switch (impl->active_tree()->source_frame_number()) { | 1434 switch (impl->active_tree()->source_frame_number()) { |
1435 case 0: | 1435 case 0: |
1436 // Number of textures should be one for each layer | 1436 // Number of textures should be one for each layer |
1437 ASSERT_EQ(2u, context->NumTextures()); | 1437 ASSERT_EQ(2u, context->NumTextures()); |
1438 // Number of textures used for commit should be one for each layer. | 1438 // Number of textures used for commit should be one for each layer. |
1439 EXPECT_EQ(2u, context->NumUsedTextures()); | 1439 EXPECT_EQ(2u, context->NumUsedTextures()); |
1440 // Verify that used texture is correct. | 1440 // Verify that used texture is correct. |
1441 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 1441 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
1442 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 1442 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
1443 context->ResetUsedTextures(); | |
1444 break; | 1443 break; |
1445 case 1: | 1444 case 1: |
1446 // Number of textures should be doubled as the first context layer | 1445 // Number of textures should be doubled as the first context layer |
1447 // texture is being used by the impl-thread and cannot be used for | 1446 // texture is being used by the impl-thread and cannot be used for |
1448 // update. The scrollbar behavior is different direct renderer because | 1447 // update. The scrollbar behavior is different direct renderer because |
1449 // UI resource deletion with delegating renderer occurs after tree | 1448 // UI resource deletion with delegating renderer occurs after tree |
1450 // activation. | 1449 // activation. |
1451 ASSERT_EQ(4u, context->NumTextures()); | 1450 ASSERT_EQ(4u, context->NumTextures()); |
1452 // Number of textures used for commit should still be | 1451 // Number of textures used for commit should still be |
1453 // one for each layer. | 1452 // one for each layer. |
1454 EXPECT_EQ(2u, context->NumUsedTextures()); | 1453 EXPECT_EQ(2u, context->NumUsedTextures()); |
1455 // First textures should not have been used. | 1454 // First textures should not have been used. |
1456 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); | 1455 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
1457 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); | 1456 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
1458 // New textures should have been used. | 1457 // New textures should have been used. |
1459 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); | 1458 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
1460 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 1459 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
1461 context->ResetUsedTextures(); | |
1462 break; | 1460 break; |
1463 case 2: | 1461 case 2: |
1464 EndTest(); | 1462 EndTest(); |
1465 break; | 1463 break; |
1466 default: | 1464 default: |
1467 NOTREACHED(); | 1465 NOTREACHED(); |
1468 break; | 1466 break; |
1469 } | 1467 } |
1470 } | 1468 } |
1471 }; | 1469 }; |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target, | 2649 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target, |
2652 GLint width, | 2650 GLint width, |
2653 GLint height, | 2651 GLint height, |
2654 GLuint ioSurfaceId, | 2652 GLuint ioSurfaceId, |
2655 GLuint plane)); | 2653 GLuint plane)); |
2656 MOCK_METHOD4(drawElements, void(GLenum mode, | 2654 MOCK_METHOD4(drawElements, void(GLenum mode, |
2657 GLsizei count, | 2655 GLsizei count, |
2658 GLenum type, | 2656 GLenum type, |
2659 GLintptr offset)); | 2657 GLintptr offset)); |
2660 MOCK_METHOD1(deleteTexture, void(GLenum texture)); | 2658 MOCK_METHOD1(deleteTexture, void(GLenum texture)); |
2661 MOCK_METHOD2(produceTextureCHROMIUM, | 2659 MOCK_METHOD3(produceTextureDirectCHROMIUM, |
2662 void(GLenum target, const GLbyte* mailbox)); | 2660 void(GLuint texture, GLenum target, const GLbyte* mailbox)); |
2663 }; | 2661 }; |
2664 | 2662 |
2665 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { | 2663 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { |
2666 protected: | 2664 protected: |
2667 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 2665 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
2668 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned( | 2666 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned( |
2669 new MockIOSurfaceWebGraphicsContext3D); | 2667 new MockIOSurfaceWebGraphicsContext3D); |
2670 mock_context_ = mock_context_owned.get(); | 2668 mock_context_ = mock_context_owned.get(); |
2671 | 2669 |
2672 if (delegating_renderer()) | 2670 if (delegating_renderer()) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2742 const DrawQuad* quad = frame->render_passes[0]->quad_list.front(); | 2740 const DrawQuad* quad = frame->render_passes[0]->quad_list.front(); |
2743 CHECK_EQ(DrawQuad::IO_SURFACE_CONTENT, quad->material); | 2741 CHECK_EQ(DrawQuad::IO_SURFACE_CONTENT, quad->material); |
2744 const IOSurfaceDrawQuad* io_surface_draw_quad = | 2742 const IOSurfaceDrawQuad* io_surface_draw_quad = |
2745 IOSurfaceDrawQuad::MaterialCast(quad); | 2743 IOSurfaceDrawQuad::MaterialCast(quad); |
2746 EXPECT_EQ(io_surface_size_, io_surface_draw_quad->io_surface_size); | 2744 EXPECT_EQ(io_surface_size_, io_surface_draw_quad->io_surface_size); |
2747 EXPECT_NE(0u, io_surface_draw_quad->io_surface_resource_id); | 2745 EXPECT_NE(0u, io_surface_draw_quad->io_surface_resource_id); |
2748 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_RECTANGLE_ARB), | 2746 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_RECTANGLE_ARB), |
2749 resource_provider->TargetForTesting( | 2747 resource_provider->TargetForTesting( |
2750 io_surface_draw_quad->io_surface_resource_id)); | 2748 io_surface_draw_quad->io_surface_resource_id)); |
2751 | 2749 |
2752 EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1)) | |
2753 .Times(1); | |
2754 if (delegating_renderer()) { | 2750 if (delegating_renderer()) { |
2755 // The io surface layer's resource should be sent to the parent. | 2751 // The io surface layer's resource should be sent to the parent. |
2756 EXPECT_CALL(*mock_context_, | 2752 EXPECT_CALL(*mock_context_, produceTextureDirectCHROMIUM( |
2757 produceTextureCHROMIUM(GL_TEXTURE_RECTANGLE_ARB, _)).Times(1); | 2753 _, GL_TEXTURE_RECTANGLE_ARB, _)).Times(1); |
2758 } else { | 2754 } else { |
2759 // The io surface layer's texture is drawn. | 2755 // The io surface layer's texture is drawn. |
2760 EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1)); | 2756 EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1)); |
2761 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _)) | 2757 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _)) |
2762 .Times(AtLeast(1)); | 2758 .Times(AtLeast(1)); |
2763 } | 2759 } |
2764 | 2760 |
2765 return draw_result; | 2761 return draw_result; |
2766 } | 2762 } |
2767 | 2763 |
(...skipping 3590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6358 | 6354 |
6359 void AfterTest() override {} | 6355 void AfterTest() override {} |
6360 | 6356 |
6361 private: | 6357 private: |
6362 scoped_refptr<Layer> child_; | 6358 scoped_refptr<Layer> child_; |
6363 }; | 6359 }; |
6364 | 6360 |
6365 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); | 6361 SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); |
6366 | 6362 |
6367 } // namespace cc | 6363 } // namespace cc |
OLD | NEW |