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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1258 | 1258 |
1259 switch (impl->active_tree()->source_frame_number()) { | 1259 switch (impl->active_tree()->source_frame_number()) { |
1260 case 0: | 1260 case 0: |
1261 // Number of textures should be one for each layer | 1261 // Number of textures should be one for each layer |
1262 ASSERT_EQ(2u, context->NumTextures()); | 1262 ASSERT_EQ(2u, context->NumTextures()); |
1263 // Number of textures used for commit should be one for each layer. | 1263 // Number of textures used for commit should be one for each layer. |
1264 EXPECT_EQ(2u, context->NumUsedTextures()); | 1264 EXPECT_EQ(2u, context->NumUsedTextures()); |
1265 // Verify that used texture is correct. | 1265 // Verify that used texture is correct. |
1266 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 1266 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
1267 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 1267 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
1268 context->ResetUsedTextures(); | |
sohanjg
2014/11/05 12:46:43
This reset needs to be avoided as used texture is
| |
1269 break; | 1268 break; |
1270 case 1: | 1269 case 1: |
1271 // Number of textures should be doubled as the first context layer | 1270 // Number of textures should be doubled as the first context layer |
1272 // texture is being used by the impl-thread and cannot be used for | 1271 // texture is being used by the impl-thread and cannot be used for |
1273 // update. The scrollbar behavior is different direct renderer because | 1272 // update. The scrollbar behavior is different direct renderer because |
1274 // UI resource deletion with delegating renderer occurs after tree | 1273 // UI resource deletion with delegating renderer occurs after tree |
1275 // activation. | 1274 // activation. |
1276 ASSERT_EQ(4u, context->NumTextures()); | 1275 ASSERT_EQ(4u, context->NumTextures()); |
1277 // Number of textures used for commit should still be | 1276 // Number of textures used for commit should still be |
1278 // one for each layer. | 1277 // one for each layer. |
1279 EXPECT_EQ(2u, context->NumUsedTextures()); | 1278 EXPECT_EQ(2u, context->NumUsedTextures()); |
1280 // First textures should not have been used. | 1279 // First textures should not have been used. |
1281 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); | 1280 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
1282 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); | 1281 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
1283 // New textures should have been used. | 1282 // New textures should have been used. |
1284 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); | 1283 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
1285 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 1284 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
1286 context->ResetUsedTextures(); | |
1287 break; | 1285 break; |
1288 case 2: | 1286 case 2: |
1289 EndTest(); | 1287 EndTest(); |
1290 break; | 1288 break; |
1291 default: | 1289 default: |
1292 NOTREACHED(); | 1290 NOTREACHED(); |
1293 break; | 1291 break; |
1294 } | 1292 } |
1295 } | 1293 } |
1296 }; | 1294 }; |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2461 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target, | 2459 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target, |
2462 GLint width, | 2460 GLint width, |
2463 GLint height, | 2461 GLint height, |
2464 GLuint ioSurfaceId, | 2462 GLuint ioSurfaceId, |
2465 GLuint plane)); | 2463 GLuint plane)); |
2466 MOCK_METHOD4(drawElements, void(GLenum mode, | 2464 MOCK_METHOD4(drawElements, void(GLenum mode, |
2467 GLsizei count, | 2465 GLsizei count, |
2468 GLenum type, | 2466 GLenum type, |
2469 GLintptr offset)); | 2467 GLintptr offset)); |
2470 MOCK_METHOD1(deleteTexture, void(GLenum texture)); | 2468 MOCK_METHOD1(deleteTexture, void(GLenum texture)); |
2471 MOCK_METHOD2(produceTextureCHROMIUM, | 2469 MOCK_METHOD3(produceTextureDirectCHROMIUM, |
2472 void(GLenum target, const GLbyte* mailbox)); | 2470 void(GLuint texture, GLenum target, const GLbyte* mailbox)); |
2473 }; | 2471 }; |
2474 | 2472 |
2475 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { | 2473 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { |
2476 protected: | 2474 protected: |
2477 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface( | 2475 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface( |
2478 bool fallback) override { | 2476 bool fallback) override { |
2479 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned( | 2477 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned( |
2480 new MockIOSurfaceWebGraphicsContext3D); | 2478 new MockIOSurfaceWebGraphicsContext3D); |
2481 mock_context_ = mock_context_owned.get(); | 2479 mock_context_ = mock_context_owned.get(); |
2482 | 2480 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2553 const DrawQuad* quad = frame->render_passes[0]->quad_list.front(); | 2551 const DrawQuad* quad = frame->render_passes[0]->quad_list.front(); |
2554 CHECK_EQ(DrawQuad::IO_SURFACE_CONTENT, quad->material); | 2552 CHECK_EQ(DrawQuad::IO_SURFACE_CONTENT, quad->material); |
2555 const IOSurfaceDrawQuad* io_surface_draw_quad = | 2553 const IOSurfaceDrawQuad* io_surface_draw_quad = |
2556 IOSurfaceDrawQuad::MaterialCast(quad); | 2554 IOSurfaceDrawQuad::MaterialCast(quad); |
2557 EXPECT_SIZE_EQ(io_surface_size_, io_surface_draw_quad->io_surface_size); | 2555 EXPECT_SIZE_EQ(io_surface_size_, io_surface_draw_quad->io_surface_size); |
2558 EXPECT_NE(0u, io_surface_draw_quad->io_surface_resource_id); | 2556 EXPECT_NE(0u, io_surface_draw_quad->io_surface_resource_id); |
2559 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_RECTANGLE_ARB), | 2557 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_RECTANGLE_ARB), |
2560 resource_provider->TargetForTesting( | 2558 resource_provider->TargetForTesting( |
2561 io_surface_draw_quad->io_surface_resource_id)); | 2559 io_surface_draw_quad->io_surface_resource_id)); |
2562 | 2560 |
2563 EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1)) | |
2564 .Times(1); | |
2565 if (delegating_renderer()) { | 2561 if (delegating_renderer()) { |
2566 // The io surface layer's resource should be sent to the parent. | 2562 // The io surface layer's resource should be sent to the parent. |
2567 EXPECT_CALL(*mock_context_, | 2563 EXPECT_CALL(*mock_context_, |
2568 produceTextureCHROMIUM(GL_TEXTURE_RECTANGLE_ARB, _)).Times(1); | 2564 produceTextureDirectCHROMIUM(_, GL_TEXTURE_RECTANGLE_ARB, _)) |
2565 .Times(1); | |
2569 } else { | 2566 } else { |
2570 // The io surface layer's texture is drawn. | 2567 // The io surface layer's texture is drawn. |
2571 EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1)); | 2568 EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1)); |
2572 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _)) | 2569 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _)) |
2573 .Times(AtLeast(1)); | 2570 .Times(AtLeast(1)); |
2574 } | 2571 } |
2575 | 2572 |
2576 return draw_result; | 2573 return draw_result; |
2577 } | 2574 } |
2578 | 2575 |
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5148 } | 5145 } |
5149 | 5146 |
5150 int commit_count_; | 5147 int commit_count_; |
5151 TestSwapPromiseResult swap_promise_result_[3]; | 5148 TestSwapPromiseResult swap_promise_result_[3]; |
5152 }; | 5149 }; |
5153 | 5150 |
5154 // Impl-side painting is not supported for synchronous compositing. | 5151 // Impl-side painting is not supported for synchronous compositing. |
5155 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise); | 5152 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise); |
5156 | 5153 |
5157 } // namespace cc | 5154 } // namespace cc |
OLD | NEW |