Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | |
| 10 | 11 |
| 11 #include "base/bind.h" | 12 #include "base/bind.h" |
| 12 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "cc/base/scoped_ptr_deque.h" | 16 #include "cc/base/scoped_ptr_deque.h" |
| 16 #include "cc/output/output_surface.h" | 17 #include "cc/output/output_surface.h" |
| 17 #include "cc/resources/returned_resource.h" | 18 #include "cc/resources/returned_resource.h" |
| 18 #include "cc/resources/shared_bitmap_manager.h" | 19 #include "cc/resources/shared_bitmap_manager.h" |
| 19 #include "cc/resources/single_release_callback.h" | 20 #include "cc/resources/single_release_callback.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 35 using testing::Mock; | 36 using testing::Mock; |
| 36 using testing::NiceMock; | 37 using testing::NiceMock; |
| 37 using testing::Return; | 38 using testing::Return; |
| 38 using testing::SetArgPointee; | 39 using testing::SetArgPointee; |
| 39 using testing::StrictMock; | 40 using testing::StrictMock; |
| 40 using testing::_; | 41 using testing::_; |
| 41 | 42 |
| 42 namespace cc { | 43 namespace cc { |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 46 const std::vector<unsigned> g_imaget_targets(gfx::GpuMemoryBuffer::FORMAT_LAST + | |
|
reveman
2015/07/31 16:05:43
nit: s/g_imaget_targets/g_image_texture_targets/
| |
| 47 1, | |
| 48 GL_TEXTURE_2D); | |
| 49 | |
| 45 static void EmptyReleaseCallback(uint32 sync_point, | 50 static void EmptyReleaseCallback(uint32 sync_point, |
| 46 bool lost_resource, | 51 bool lost_resource, |
| 47 BlockingTaskRunner* main_thread_task_runner) { | 52 BlockingTaskRunner* main_thread_task_runner) { |
| 48 } | 53 } |
| 49 | 54 |
| 50 static void ReleaseCallback( | 55 static void ReleaseCallback( |
| 51 uint32* release_sync_point, | 56 uint32* release_sync_point, |
| 52 bool* release_lost_resource, | 57 bool* release_lost_resource, |
| 53 BlockingTaskRunner** release_main_thread_task_runner, | 58 BlockingTaskRunner** release_main_thread_task_runner, |
| 54 uint32 sync_point, | 59 uint32 sync_point, |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 } | 419 } |
| 415 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 420 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 416 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); | 421 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); |
| 417 | 422 |
| 418 shared_bitmap_manager_.reset(new TestSharedBitmapManager); | 423 shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
| 419 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); | 424 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
| 420 | 425 |
| 421 resource_provider_ = ResourceProvider::Create( | 426 resource_provider_ = ResourceProvider::Create( |
| 422 output_surface_.get(), shared_bitmap_manager_.get(), | 427 output_surface_.get(), shared_bitmap_manager_.get(), |
| 423 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, | 428 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
| 424 false, 1, false); | 429 false, 1, false, g_imaget_targets); |
| 425 child_resource_provider_ = ResourceProvider::Create( | 430 child_resource_provider_ = ResourceProvider::Create( |
| 426 child_output_surface_.get(), shared_bitmap_manager_.get(), | 431 child_output_surface_.get(), shared_bitmap_manager_.get(), |
| 427 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, | 432 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
| 428 false, 1, false); | 433 false, 1, false, g_imaget_targets); |
| 429 } | 434 } |
| 430 | 435 |
| 431 ResourceProviderTest() : ResourceProviderTest(true) {} | 436 ResourceProviderTest() : ResourceProviderTest(true) {} |
| 432 | 437 |
| 433 static void CollectResources(ReturnedResourceArray* array, | 438 static void CollectResources(ReturnedResourceArray* array, |
| 434 const ReturnedResourceArray& returned, | 439 const ReturnedResourceArray& returned, |
| 435 BlockingTaskRunner* main_thread_task_runner) { | 440 BlockingTaskRunner* main_thread_task_runner) { |
| 436 array->insert(array->end(), returned.begin(), returned.end()); | 441 array->insert(array->end(), returned.begin(), returned.end()); |
| 437 } | 442 } |
| 438 | 443 |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1360 scoped_ptr<ResourceProviderContext> child_context_owned( | 1365 scoped_ptr<ResourceProviderContext> child_context_owned( |
| 1361 ResourceProviderContext::Create(shared_data_.get())); | 1366 ResourceProviderContext::Create(shared_data_.get())); |
| 1362 | 1367 |
| 1363 FakeOutputSurfaceClient child_output_surface_client; | 1368 FakeOutputSurfaceClient child_output_surface_client; |
| 1364 scoped_ptr<OutputSurface> child_output_surface( | 1369 scoped_ptr<OutputSurface> child_output_surface( |
| 1365 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1370 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
| 1366 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1371 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
| 1367 | 1372 |
| 1368 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( | 1373 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( |
| 1369 child_output_surface.get(), shared_bitmap_manager_.get(), | 1374 child_output_surface.get(), shared_bitmap_manager_.get(), |
| 1370 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 1375 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 1376 g_imaget_targets)); | |
| 1371 | 1377 |
| 1372 gfx::Size size(1, 1); | 1378 gfx::Size size(1, 1); |
| 1373 ResourceFormat format = RGBA_8888; | 1379 ResourceFormat format = RGBA_8888; |
| 1374 size_t pixel_size = TextureSizeBytes(size, format); | 1380 size_t pixel_size = TextureSizeBytes(size, format); |
| 1375 ASSERT_EQ(4U, pixel_size); | 1381 ASSERT_EQ(4U, pixel_size); |
| 1376 | 1382 |
| 1377 ResourceId id1 = child_resource_provider->CreateResource( | 1383 ResourceId id1 = child_resource_provider->CreateResource( |
| 1378 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 1384 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 1379 uint8_t data1[4] = { 1, 2, 3, 4 }; | 1385 uint8_t data1[4] = { 1, 2, 3, 4 }; |
| 1380 child_resource_provider->CopyToResource(id1, data1, size); | 1386 child_resource_provider->CopyToResource(id1, data1, size); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1844 FakeOutputSurfaceClient child_output_surface_client; | 1850 FakeOutputSurfaceClient child_output_surface_client; |
| 1845 scoped_ptr<OutputSurface> child_output_surface( | 1851 scoped_ptr<OutputSurface> child_output_surface( |
| 1846 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1852 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
| 1847 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1853 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
| 1848 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1854 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 1849 new TestSharedBitmapManager()); | 1855 new TestSharedBitmapManager()); |
| 1850 | 1856 |
| 1851 scoped_ptr<ResourceProvider> child_resource_provider( | 1857 scoped_ptr<ResourceProvider> child_resource_provider( |
| 1852 ResourceProvider::Create(child_output_surface.get(), | 1858 ResourceProvider::Create(child_output_surface.get(), |
| 1853 shared_bitmap_manager.get(), NULL, NULL, 0, | 1859 shared_bitmap_manager.get(), NULL, NULL, 0, |
| 1854 false, 1, false)); | 1860 false, 1, false, g_imaget_targets)); |
| 1855 | 1861 |
| 1856 scoped_ptr<TextureStateTrackingContext> parent_context_owned( | 1862 scoped_ptr<TextureStateTrackingContext> parent_context_owned( |
| 1857 new TextureStateTrackingContext); | 1863 new TextureStateTrackingContext); |
| 1858 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1864 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
| 1859 | 1865 |
| 1860 FakeOutputSurfaceClient parent_output_surface_client; | 1866 FakeOutputSurfaceClient parent_output_surface_client; |
| 1861 scoped_ptr<OutputSurface> parent_output_surface( | 1867 scoped_ptr<OutputSurface> parent_output_surface( |
| 1862 FakeOutputSurface::Create3d(parent_context_owned.Pass())); | 1868 FakeOutputSurface::Create3d(parent_context_owned.Pass())); |
| 1863 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1869 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
| 1864 | 1870 |
| 1865 scoped_ptr<ResourceProvider> parent_resource_provider( | 1871 scoped_ptr<ResourceProvider> parent_resource_provider( |
| 1866 ResourceProvider::Create(parent_output_surface.get(), | 1872 ResourceProvider::Create(parent_output_surface.get(), |
| 1867 shared_bitmap_manager.get(), NULL, NULL, 0, | 1873 shared_bitmap_manager.get(), NULL, NULL, 0, |
| 1868 false, 1, false)); | 1874 false, 1, false, g_imaget_targets)); |
| 1869 | 1875 |
| 1870 gfx::Size size(1, 1); | 1876 gfx::Size size(1, 1); |
| 1871 ResourceFormat format = RGBA_8888; | 1877 ResourceFormat format = RGBA_8888; |
| 1872 int child_texture_id = 1; | 1878 int child_texture_id = 1; |
| 1873 int parent_texture_id = 2; | 1879 int parent_texture_id = 2; |
| 1874 | 1880 |
| 1875 size_t pixel_size = TextureSizeBytes(size, format); | 1881 size_t pixel_size = TextureSizeBytes(size, format); |
| 1876 ASSERT_EQ(4U, pixel_size); | 1882 ASSERT_EQ(4U, pixel_size); |
| 1877 | 1883 |
| 1878 ResourceId id = child_resource_provider->CreateResource( | 1884 ResourceId id = child_resource_provider->CreateResource( |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2490 new TextureStateTrackingContext); | 2496 new TextureStateTrackingContext); |
| 2491 TextureStateTrackingContext* context = context_owned.get(); | 2497 TextureStateTrackingContext* context = context_owned.get(); |
| 2492 | 2498 |
| 2493 FakeOutputSurfaceClient output_surface_client; | 2499 FakeOutputSurfaceClient output_surface_client; |
| 2494 scoped_ptr<OutputSurface> output_surface( | 2500 scoped_ptr<OutputSurface> output_surface( |
| 2495 FakeOutputSurface::Create3d(context_owned.Pass())); | 2501 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2496 CHECK(output_surface->BindToClient(&output_surface_client)); | 2502 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2497 | 2503 |
| 2498 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2504 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 2499 output_surface.get(), shared_bitmap_manager_.get(), | 2505 output_surface.get(), shared_bitmap_manager_.get(), |
| 2500 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 2506 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 2507 g_imaget_targets)); | |
| 2501 | 2508 |
| 2502 gfx::Size size(1, 1); | 2509 gfx::Size size(1, 1); |
| 2503 ResourceFormat format = RGBA_8888; | 2510 ResourceFormat format = RGBA_8888; |
| 2504 int texture_id = 1; | 2511 int texture_id = 1; |
| 2505 | 2512 |
| 2506 ResourceId id = resource_provider->CreateResource( | 2513 ResourceId id = resource_provider->CreateResource( |
| 2507 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2514 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 2508 | 2515 |
| 2509 // Check that the texture gets created with the right sampler settings. | 2516 // Check that the texture gets created with the right sampler settings. |
| 2510 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) | 2517 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2572 new TextureStateTrackingContext); | 2579 new TextureStateTrackingContext); |
| 2573 TextureStateTrackingContext* context = context_owned.get(); | 2580 TextureStateTrackingContext* context = context_owned.get(); |
| 2574 | 2581 |
| 2575 FakeOutputSurfaceClient output_surface_client; | 2582 FakeOutputSurfaceClient output_surface_client; |
| 2576 scoped_ptr<OutputSurface> output_surface( | 2583 scoped_ptr<OutputSurface> output_surface( |
| 2577 FakeOutputSurface::Create3d(context_owned.Pass())); | 2584 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2578 CHECK(output_surface->BindToClient(&output_surface_client)); | 2585 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2579 | 2586 |
| 2580 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2587 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 2581 output_surface.get(), shared_bitmap_manager_.get(), | 2588 output_surface.get(), shared_bitmap_manager_.get(), |
| 2582 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 2589 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 2590 g_imaget_targets)); | |
| 2583 | 2591 |
| 2584 gfx::Size size(1, 1); | 2592 gfx::Size size(1, 1); |
| 2585 ResourceFormat format = RGBA_8888; | 2593 ResourceFormat format = RGBA_8888; |
| 2586 int texture_id = 1; | 2594 int texture_id = 1; |
| 2587 | 2595 |
| 2588 // Check that the texture gets created with the right sampler settings. | 2596 // Check that the texture gets created with the right sampler settings. |
| 2589 ResourceId id = resource_provider->CreateManagedResource( | 2597 ResourceId id = resource_provider->CreateManagedResource( |
| 2590 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, | 2598 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, |
| 2591 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2599 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 2592 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); | 2600 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 2619 new TextureStateTrackingContext); | 2627 new TextureStateTrackingContext); |
| 2620 TextureStateTrackingContext* context = context_owned.get(); | 2628 TextureStateTrackingContext* context = context_owned.get(); |
| 2621 | 2629 |
| 2622 FakeOutputSurfaceClient output_surface_client; | 2630 FakeOutputSurfaceClient output_surface_client; |
| 2623 scoped_ptr<OutputSurface> output_surface( | 2631 scoped_ptr<OutputSurface> output_surface( |
| 2624 FakeOutputSurface::Create3d(context_owned.Pass())); | 2632 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2625 CHECK(output_surface->BindToClient(&output_surface_client)); | 2633 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2626 | 2634 |
| 2627 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2635 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 2628 output_surface.get(), shared_bitmap_manager_.get(), | 2636 output_surface.get(), shared_bitmap_manager_.get(), |
| 2629 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 2637 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 2638 g_imaget_targets)); | |
| 2630 | 2639 |
| 2631 gfx::Size size(1, 1); | 2640 gfx::Size size(1, 1); |
| 2632 ResourceFormat format = RGBA_8888; | 2641 ResourceFormat format = RGBA_8888; |
| 2633 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2642 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
| 2634 | 2643 |
| 2635 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2644 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
| 2636 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; | 2645 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; |
| 2637 // Check that the texture gets created with the right sampler settings. | 2646 // Check that the texture gets created with the right sampler settings. |
| 2638 ResourceId id = resource_provider->CreateGLTexture( | 2647 ResourceId id = resource_provider->CreateGLTexture( |
| 2639 size, GL_TEXTURE_2D, texture_pool, wrap_mode, | 2648 size, GL_TEXTURE_2D, texture_pool, wrap_mode, |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 2669 context->set_support_texture_storage(true); | 2678 context->set_support_texture_storage(true); |
| 2670 context->set_support_texture_usage(true); | 2679 context->set_support_texture_usage(true); |
| 2671 | 2680 |
| 2672 FakeOutputSurfaceClient output_surface_client; | 2681 FakeOutputSurfaceClient output_surface_client; |
| 2673 scoped_ptr<OutputSurface> output_surface( | 2682 scoped_ptr<OutputSurface> output_surface( |
| 2674 FakeOutputSurface::Create3d(context_owned.Pass())); | 2683 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2675 CHECK(output_surface->BindToClient(&output_surface_client)); | 2684 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2676 | 2685 |
| 2677 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2686 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 2678 output_surface.get(), shared_bitmap_manager_.get(), | 2687 output_surface.get(), shared_bitmap_manager_.get(), |
| 2679 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 2688 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 2689 g_imaget_targets)); | |
| 2680 | 2690 |
| 2681 gfx::Size size(1, 1); | 2691 gfx::Size size(1, 1); |
| 2682 ResourceFormat format = RGBA_8888; | 2692 ResourceFormat format = RGBA_8888; |
| 2683 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2693 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
| 2684 | 2694 |
| 2685 const ResourceProvider::TextureHint hints[4] = { | 2695 const ResourceProvider::TextureHint hints[4] = { |
| 2686 ResourceProvider::TEXTURE_HINT_DEFAULT, | 2696 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 2687 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 2697 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 2688 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 2698 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 2689 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 2699 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2734 | 2744 |
| 2735 FakeOutputSurfaceClient output_surface_client; | 2745 FakeOutputSurfaceClient output_surface_client; |
| 2736 scoped_ptr<OutputSurface> output_surface( | 2746 scoped_ptr<OutputSurface> output_surface( |
| 2737 FakeOutputSurface::CreateSoftware(make_scoped_ptr( | 2747 FakeOutputSurface::CreateSoftware(make_scoped_ptr( |
| 2738 new SoftwareOutputDevice))); | 2748 new SoftwareOutputDevice))); |
| 2739 CHECK(output_surface->BindToClient(&output_surface_client)); | 2749 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2740 | 2750 |
| 2741 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2751 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 2742 output_surface.get(), shared_bitmap_manager_.get(), | 2752 output_surface.get(), shared_bitmap_manager_.get(), |
| 2743 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, | 2753 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
| 2744 false, 1, false)); | 2754 false, 1, false, g_imaget_targets)); |
| 2745 | 2755 |
| 2746 uint32 release_sync_point = 0; | 2756 uint32 release_sync_point = 0; |
| 2747 bool lost_resource = false; | 2757 bool lost_resource = false; |
| 2748 BlockingTaskRunner* main_thread_task_runner = NULL; | 2758 BlockingTaskRunner* main_thread_task_runner = NULL; |
| 2749 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2759 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2750 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2760 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
| 2751 &release_sync_point, | 2761 &release_sync_point, |
| 2752 &lost_resource, | 2762 &lost_resource, |
| 2753 &main_thread_task_runner)); | 2763 &main_thread_task_runner)); |
| 2754 TextureMailbox mailbox(shared_bitmap.get(), size); | 2764 TextureMailbox mailbox(shared_bitmap.get(), size); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2783 new TextureStateTrackingContext); | 2793 new TextureStateTrackingContext); |
| 2784 TextureStateTrackingContext* context = context_owned.get(); | 2794 TextureStateTrackingContext* context = context_owned.get(); |
| 2785 | 2795 |
| 2786 FakeOutputSurfaceClient output_surface_client; | 2796 FakeOutputSurfaceClient output_surface_client; |
| 2787 scoped_ptr<OutputSurface> output_surface( | 2797 scoped_ptr<OutputSurface> output_surface( |
| 2788 FakeOutputSurface::Create3d(context_owned.Pass())); | 2798 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2789 CHECK(output_surface->BindToClient(&output_surface_client)); | 2799 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2790 | 2800 |
| 2791 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2801 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 2792 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, | 2802 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, |
| 2793 main_thread_task_runner, 0, false, 1, false)); | 2803 main_thread_task_runner, 0, false, 1, false, g_imaget_targets)); |
| 2794 | 2804 |
| 2795 unsigned texture_id = 1; | 2805 unsigned texture_id = 1; |
| 2796 uint32 sync_point = 30; | 2806 uint32 sync_point = 30; |
| 2797 unsigned target = GL_TEXTURE_2D; | 2807 unsigned target = GL_TEXTURE_2D; |
| 2798 | 2808 |
| 2799 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2809 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2800 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2810 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2801 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2811 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2802 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2812 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2803 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2813 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2926 new TextureStateTrackingContext); | 2936 new TextureStateTrackingContext); |
| 2927 TextureStateTrackingContext* context = context_owned.get(); | 2937 TextureStateTrackingContext* context = context_owned.get(); |
| 2928 | 2938 |
| 2929 FakeOutputSurfaceClient output_surface_client; | 2939 FakeOutputSurfaceClient output_surface_client; |
| 2930 scoped_ptr<OutputSurface> output_surface( | 2940 scoped_ptr<OutputSurface> output_surface( |
| 2931 FakeOutputSurface::Create3d(context_owned.Pass())); | 2941 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 2932 CHECK(output_surface->BindToClient(&output_surface_client)); | 2942 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2933 | 2943 |
| 2934 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2944 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 2935 output_surface.get(), shared_bitmap_manager_.get(), | 2945 output_surface.get(), shared_bitmap_manager_.get(), |
| 2936 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 2946 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 2947 g_imaget_targets)); | |
| 2937 | 2948 |
| 2938 uint32 sync_point = 30; | 2949 uint32 sync_point = 30; |
| 2939 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2950 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
| 2940 | 2951 |
| 2941 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2952 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2942 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2953 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2943 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2954 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2944 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2955 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2945 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2956 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 2946 | 2957 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2995 new TextureStateTrackingContext); | 3006 new TextureStateTrackingContext); |
| 2996 TextureStateTrackingContext* context = context_owned.get(); | 3007 TextureStateTrackingContext* context = context_owned.get(); |
| 2997 | 3008 |
| 2998 FakeOutputSurfaceClient output_surface_client; | 3009 FakeOutputSurfaceClient output_surface_client; |
| 2999 scoped_ptr<OutputSurface> output_surface( | 3010 scoped_ptr<OutputSurface> output_surface( |
| 3000 FakeOutputSurface::Create3d(context_owned.Pass())); | 3011 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3001 CHECK(output_surface->BindToClient(&output_surface_client)); | 3012 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3002 | 3013 |
| 3003 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3014 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3004 output_surface.get(), shared_bitmap_manager_.get(), | 3015 output_surface.get(), shared_bitmap_manager_.get(), |
| 3005 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3016 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3017 g_imaget_targets)); | |
| 3006 | 3018 |
| 3007 uint32 sync_point = 30; | 3019 uint32 sync_point = 30; |
| 3008 unsigned target = GL_TEXTURE_2D; | 3020 unsigned target = GL_TEXTURE_2D; |
| 3009 | 3021 |
| 3010 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3022 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 3011 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 3023 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 3012 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 3024 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 3013 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3025 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 3014 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3026 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 3015 | 3027 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3048 new TextureStateTrackingContext); | 3060 new TextureStateTrackingContext); |
| 3049 TextureStateTrackingContext* context = context_owned.get(); | 3061 TextureStateTrackingContext* context = context_owned.get(); |
| 3050 | 3062 |
| 3051 FakeOutputSurfaceClient output_surface_client; | 3063 FakeOutputSurfaceClient output_surface_client; |
| 3052 scoped_ptr<OutputSurface> output_surface( | 3064 scoped_ptr<OutputSurface> output_surface( |
| 3053 FakeOutputSurface::Create3d(context_owned.Pass())); | 3065 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3054 CHECK(output_surface->BindToClient(&output_surface_client)); | 3066 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3055 | 3067 |
| 3056 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3068 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3057 output_surface.get(), shared_bitmap_manager_.get(), | 3069 output_surface.get(), shared_bitmap_manager_.get(), |
| 3058 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3070 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3071 g_imaget_targets)); | |
| 3059 | 3072 |
| 3060 uint32 sync_point = 0; | 3073 uint32 sync_point = 0; |
| 3061 unsigned target = GL_TEXTURE_2D; | 3074 unsigned target = GL_TEXTURE_2D; |
| 3062 | 3075 |
| 3063 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3076 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 3064 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 3077 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 3065 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 3078 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 3066 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3079 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 3067 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3080 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 3068 | 3081 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3168 new StrictMock<AllocationTrackingContext3D>); | 3181 new StrictMock<AllocationTrackingContext3D>); |
| 3169 AllocationTrackingContext3D* context = context_owned.get(); | 3182 AllocationTrackingContext3D* context = context_owned.get(); |
| 3170 | 3183 |
| 3171 FakeOutputSurfaceClient output_surface_client; | 3184 FakeOutputSurfaceClient output_surface_client; |
| 3172 scoped_ptr<OutputSurface> output_surface( | 3185 scoped_ptr<OutputSurface> output_surface( |
| 3173 FakeOutputSurface::Create3d(context_owned.Pass())); | 3186 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3174 CHECK(output_surface->BindToClient(&output_surface_client)); | 3187 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3175 | 3188 |
| 3176 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3189 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3177 output_surface.get(), shared_bitmap_manager_.get(), | 3190 output_surface.get(), shared_bitmap_manager_.get(), |
| 3178 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3191 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3192 g_imaget_targets)); | |
| 3179 | 3193 |
| 3180 gfx::Size size(2, 2); | 3194 gfx::Size size(2, 2); |
| 3181 gfx::Vector2d offset(0, 0); | 3195 gfx::Vector2d offset(0, 0); |
| 3182 ResourceFormat format = RGBA_8888; | 3196 ResourceFormat format = RGBA_8888; |
| 3183 ResourceId id = 0; | 3197 ResourceId id = 0; |
| 3184 uint8_t pixels[16] = { 0 }; | 3198 uint8_t pixels[16] = { 0 }; |
| 3185 int texture_id = 123; | 3199 int texture_id = 123; |
| 3186 | 3200 |
| 3187 // Lazy allocation. Don't allocate when creating the resource. | 3201 // Lazy allocation. Don't allocate when creating the resource. |
| 3188 id = resource_provider->CreateResource( | 3202 id = resource_provider->CreateResource( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3242 context->set_support_texture_storage(true); | 3256 context->set_support_texture_storage(true); |
| 3243 context->set_support_texture_usage(true); | 3257 context->set_support_texture_usage(true); |
| 3244 | 3258 |
| 3245 FakeOutputSurfaceClient output_surface_client; | 3259 FakeOutputSurfaceClient output_surface_client; |
| 3246 scoped_ptr<OutputSurface> output_surface( | 3260 scoped_ptr<OutputSurface> output_surface( |
| 3247 FakeOutputSurface::Create3d(context_owned.Pass())); | 3261 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3248 CHECK(output_surface->BindToClient(&output_surface_client)); | 3262 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3249 | 3263 |
| 3250 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3264 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3251 output_surface.get(), shared_bitmap_manager_.get(), | 3265 output_surface.get(), shared_bitmap_manager_.get(), |
| 3252 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3266 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3267 g_imaget_targets)); | |
| 3253 | 3268 |
| 3254 gfx::Size size(2, 2); | 3269 gfx::Size size(2, 2); |
| 3255 | 3270 |
| 3256 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3271 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
| 3257 const ResourceProvider::TextureHint hints[4] = { | 3272 const ResourceProvider::TextureHint hints[4] = { |
| 3258 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3273 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 3259 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3274 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 3260 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3275 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 3261 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3276 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 3262 }; | 3277 }; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3297 context->set_support_texture_storage(true); | 3312 context->set_support_texture_storage(true); |
| 3298 context->set_support_texture_usage(true); | 3313 context->set_support_texture_usage(true); |
| 3299 | 3314 |
| 3300 FakeOutputSurfaceClient output_surface_client; | 3315 FakeOutputSurfaceClient output_surface_client; |
| 3301 scoped_ptr<OutputSurface> output_surface( | 3316 scoped_ptr<OutputSurface> output_surface( |
| 3302 FakeOutputSurface::Create3d(context_owned.Pass())); | 3317 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3303 CHECK(output_surface->BindToClient(&output_surface_client)); | 3318 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3304 | 3319 |
| 3305 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3320 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3306 output_surface.get(), shared_bitmap_manager_.get(), | 3321 output_surface.get(), shared_bitmap_manager_.get(), |
| 3307 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3322 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3323 g_imaget_targets)); | |
| 3308 | 3324 |
| 3309 gfx::Size size(2, 2); | 3325 gfx::Size size(2, 2); |
| 3310 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3326 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
| 3311 | 3327 |
| 3312 const ResourceProvider::TextureHint hints[4] = { | 3328 const ResourceProvider::TextureHint hints[4] = { |
| 3313 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3329 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 3314 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3330 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 3315 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3331 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 3316 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3332 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 3317 }; | 3333 }; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3351 FakeOutputSurface::Create3d(context_owned.Pass())); | 3367 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3352 CHECK(output_surface->BindToClient(&output_surface_client)); | 3368 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3353 | 3369 |
| 3354 gfx::Size size(2, 2); | 3370 gfx::Size size(2, 2); |
| 3355 ResourceFormat format = RGBA_8888; | 3371 ResourceFormat format = RGBA_8888; |
| 3356 ResourceId id = 0; | 3372 ResourceId id = 0; |
| 3357 int texture_id = 123; | 3373 int texture_id = 123; |
| 3358 | 3374 |
| 3359 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3375 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3360 output_surface.get(), shared_bitmap_manager_.get(), | 3376 output_surface.get(), shared_bitmap_manager_.get(), |
| 3361 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3377 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3378 g_imaget_targets)); | |
| 3362 | 3379 |
| 3363 id = resource_provider->CreateResource( | 3380 id = resource_provider->CreateResource( |
| 3364 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3381 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 3365 resource_provider->AcquirePixelBuffer(id); | 3382 resource_provider->AcquirePixelBuffer(id); |
| 3366 | 3383 |
| 3367 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3384 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3368 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3385 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3369 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) | 3386 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) |
| 3370 .Times(1); | 3387 .Times(1); |
| 3371 resource_provider->BeginSetPixels(id); | 3388 resource_provider->BeginSetPixels(id); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 3393 FakeOutputSurface::Create3d(context_owned.Pass())); | 3410 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3394 CHECK(output_surface->BindToClient(&output_surface_client)); | 3411 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3395 | 3412 |
| 3396 gfx::Size size(2, 2); | 3413 gfx::Size size(2, 2); |
| 3397 ResourceFormat format = RGBA_8888; | 3414 ResourceFormat format = RGBA_8888; |
| 3398 ResourceId id = 0; | 3415 ResourceId id = 0; |
| 3399 int texture_id = 123; | 3416 int texture_id = 123; |
| 3400 | 3417 |
| 3401 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3418 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3402 output_surface.get(), shared_bitmap_manager_.get(), | 3419 output_surface.get(), shared_bitmap_manager_.get(), |
| 3403 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3420 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3421 g_imaget_targets)); | |
| 3404 | 3422 |
| 3405 id = resource_provider->CreateResource( | 3423 id = resource_provider->CreateResource( |
| 3406 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3424 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 3407 resource_provider->AcquirePixelBuffer(id); | 3425 resource_provider->AcquirePixelBuffer(id); |
| 3408 | 3426 |
| 3409 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3427 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3410 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3428 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3411 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) | 3429 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) |
| 3412 .Times(1); | 3430 .Times(1); |
| 3413 resource_provider->BeginSetPixels(id); | 3431 resource_provider->BeginSetPixels(id); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 3435 FakeOutputSurface::Create3d(context_owned.Pass())); | 3453 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3436 CHECK(output_surface->BindToClient(&output_surface_client)); | 3454 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3437 | 3455 |
| 3438 gfx::Size size(2, 2); | 3456 gfx::Size size(2, 2); |
| 3439 ResourceFormat format = RGBA_8888; | 3457 ResourceFormat format = RGBA_8888; |
| 3440 ResourceId id = 0; | 3458 ResourceId id = 0; |
| 3441 int texture_id = 123; | 3459 int texture_id = 123; |
| 3442 | 3460 |
| 3443 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3461 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3444 output_surface.get(), shared_bitmap_manager_.get(), | 3462 output_surface.get(), shared_bitmap_manager_.get(), |
| 3445 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3463 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3464 g_imaget_targets)); | |
| 3446 | 3465 |
| 3447 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); | 3466 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); |
| 3448 | 3467 |
| 3449 id = resource_provider->CreateResource( | 3468 id = resource_provider->CreateResource( |
| 3450 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3469 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 3451 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 3470 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 3452 GL_INNOCENT_CONTEXT_RESET_ARB); | 3471 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 3453 | 3472 |
| 3454 resource_provider->AcquirePixelBuffer(id); | 3473 resource_provider->AcquirePixelBuffer(id); |
| 3455 int stride; | 3474 int stride; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 3475 const int kWidth = 2; | 3494 const int kWidth = 2; |
| 3476 const int kHeight = 2; | 3495 const int kHeight = 2; |
| 3477 gfx::Size size(kWidth, kHeight); | 3496 gfx::Size size(kWidth, kHeight); |
| 3478 ResourceFormat format = RGBA_8888; | 3497 ResourceFormat format = RGBA_8888; |
| 3479 ResourceId id = 0; | 3498 ResourceId id = 0; |
| 3480 const unsigned kTextureId = 123u; | 3499 const unsigned kTextureId = 123u; |
| 3481 const unsigned kImageId = 234u; | 3500 const unsigned kImageId = 234u; |
| 3482 | 3501 |
| 3483 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3502 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3484 output_surface.get(), shared_bitmap_manager_.get(), | 3503 output_surface.get(), shared_bitmap_manager_.get(), |
| 3485 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3504 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3505 g_imaget_targets)); | |
| 3486 | 3506 |
| 3487 id = resource_provider->CreateResource( | 3507 id = resource_provider->CreateResource( |
| 3488 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3508 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 3489 | 3509 |
| 3490 EXPECT_CALL(*context, NextTextureId()) | 3510 EXPECT_CALL(*context, NextTextureId()) |
| 3491 .WillOnce(Return(kTextureId)) | 3511 .WillOnce(Return(kTextureId)) |
| 3492 .RetiresOnSaturation(); | 3512 .RetiresOnSaturation(); |
| 3493 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) | 3513 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) |
| 3494 .Times(1) | 3514 .Times(1) |
| 3495 .RetiresOnSaturation(); | 3515 .RetiresOnSaturation(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3560 gfx::Size size(kWidth, kHeight); | 3580 gfx::Size size(kWidth, kHeight); |
| 3561 ResourceFormat format = RGBA_8888; | 3581 ResourceFormat format = RGBA_8888; |
| 3562 ResourceId source_id = 0; | 3582 ResourceId source_id = 0; |
| 3563 ResourceId dest_id = 0; | 3583 ResourceId dest_id = 0; |
| 3564 const unsigned kSourceTextureId = 123u; | 3584 const unsigned kSourceTextureId = 123u; |
| 3565 const unsigned kDestTextureId = 321u; | 3585 const unsigned kDestTextureId = 321u; |
| 3566 const unsigned kImageId = 234u; | 3586 const unsigned kImageId = 234u; |
| 3567 | 3587 |
| 3568 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3588 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3569 output_surface.get(), shared_bitmap_manager_.get(), | 3589 output_surface.get(), shared_bitmap_manager_.get(), |
| 3570 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3590 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3591 g_imaget_targets)); | |
| 3571 | 3592 |
| 3572 source_id = resource_provider->CreateResource( | 3593 source_id = resource_provider->CreateResource( |
| 3573 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3594 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 3574 | 3595 |
| 3575 EXPECT_CALL(*context, NextTextureId()) | 3596 EXPECT_CALL(*context, NextTextureId()) |
| 3576 .WillOnce(Return(kSourceTextureId)) | 3597 .WillOnce(Return(kSourceTextureId)) |
| 3577 .RetiresOnSaturation(); | 3598 .RetiresOnSaturation(); |
| 3578 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kSourceTextureId)) | 3599 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kSourceTextureId)) |
| 3579 .Times(1) | 3600 .Times(1) |
| 3580 .RetiresOnSaturation(); | 3601 .RetiresOnSaturation(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3633 context_owned->set_support_compressed_texture_etc1(true); | 3654 context_owned->set_support_compressed_texture_etc1(true); |
| 3634 | 3655 |
| 3635 FakeOutputSurfaceClient output_surface_client; | 3656 FakeOutputSurfaceClient output_surface_client; |
| 3636 scoped_ptr<OutputSurface> output_surface( | 3657 scoped_ptr<OutputSurface> output_surface( |
| 3637 FakeOutputSurface::Create3d(context_owned.Pass())); | 3658 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3638 CHECK(output_surface->BindToClient(&output_surface_client)); | 3659 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3639 | 3660 |
| 3640 gfx::Size size(4, 4); | 3661 gfx::Size size(4, 4); |
| 3641 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3662 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3642 output_surface.get(), shared_bitmap_manager_.get(), | 3663 output_surface.get(), shared_bitmap_manager_.get(), |
| 3643 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3664 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3665 g_imaget_targets)); | |
| 3644 int texture_id = 123; | 3666 int texture_id = 123; |
| 3645 | 3667 |
| 3646 ResourceId id = resource_provider->CreateResource( | 3668 ResourceId id = resource_provider->CreateResource( |
| 3647 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3669 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
| 3648 EXPECT_NE(0u, id); | 3670 EXPECT_NE(0u, id); |
| 3649 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3671 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3650 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3672 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3651 resource_provider->AllocateForTesting(id); | 3673 resource_provider->AllocateForTesting(id); |
| 3652 | 3674 |
| 3653 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3675 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 3664 context_owned->set_support_compressed_texture_etc1(true); | 3686 context_owned->set_support_compressed_texture_etc1(true); |
| 3665 | 3687 |
| 3666 FakeOutputSurfaceClient output_surface_client; | 3688 FakeOutputSurfaceClient output_surface_client; |
| 3667 scoped_ptr<OutputSurface> output_surface( | 3689 scoped_ptr<OutputSurface> output_surface( |
| 3668 FakeOutputSurface::Create3d(context_owned.Pass())); | 3690 FakeOutputSurface::Create3d(context_owned.Pass())); |
| 3669 CHECK(output_surface->BindToClient(&output_surface_client)); | 3691 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3670 | 3692 |
| 3671 gfx::Size size(4, 4); | 3693 gfx::Size size(4, 4); |
| 3672 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3694 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3673 output_surface.get(), shared_bitmap_manager_.get(), | 3695 output_surface.get(), shared_bitmap_manager_.get(), |
| 3674 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); | 3696 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false, |
| 3697 g_imaget_targets)); | |
| 3675 int texture_id = 123; | 3698 int texture_id = 123; |
| 3676 uint8_t pixels[8]; | 3699 uint8_t pixels[8]; |
| 3677 | 3700 |
| 3678 ResourceId id = resource_provider->CreateResource( | 3701 ResourceId id = resource_provider->CreateResource( |
| 3679 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3702 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
| 3680 EXPECT_NE(0u, id); | 3703 EXPECT_NE(0u, id); |
| 3681 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3704 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3682 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); | 3705 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); |
| 3683 EXPECT_CALL(*context, | 3706 EXPECT_CALL(*context, |
| 3684 compressedTexImage2D( | 3707 compressedTexImage2D( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3720 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 3743 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 3721 new TestSharedBitmapManager()); | 3744 new TestSharedBitmapManager()); |
| 3722 | 3745 |
| 3723 gfx::Size size(1, 1); | 3746 gfx::Size size(1, 1); |
| 3724 ResourceFormat format = RGBA_8888; | 3747 ResourceFormat format = RGBA_8888; |
| 3725 | 3748 |
| 3726 { | 3749 { |
| 3727 size_t kTextureAllocationChunkSize = 1; | 3750 size_t kTextureAllocationChunkSize = 1; |
| 3728 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3751 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3729 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, | 3752 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, |
| 3730 kTextureAllocationChunkSize, false)); | 3753 kTextureAllocationChunkSize, false, g_imaget_targets)); |
| 3731 | 3754 |
| 3732 ResourceId id = resource_provider->CreateResource( | 3755 ResourceId id = resource_provider->CreateResource( |
| 3733 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3756 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 3734 format); | 3757 format); |
| 3735 resource_provider->AllocateForTesting(id); | 3758 resource_provider->AllocateForTesting(id); |
| 3736 Mock::VerifyAndClearExpectations(context); | 3759 Mock::VerifyAndClearExpectations(context); |
| 3737 | 3760 |
| 3738 DCHECK_EQ(2u, context->PeekTextureId()); | 3761 DCHECK_EQ(2u, context->PeekTextureId()); |
| 3739 resource_provider->DeleteResource(id); | 3762 resource_provider->DeleteResource(id); |
| 3740 } | 3763 } |
| 3741 | 3764 |
| 3742 { | 3765 { |
| 3743 size_t kTextureAllocationChunkSize = 8; | 3766 size_t kTextureAllocationChunkSize = 8; |
| 3744 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3767 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
| 3745 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, | 3768 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, |
| 3746 kTextureAllocationChunkSize, false)); | 3769 kTextureAllocationChunkSize, false, g_imaget_targets)); |
| 3747 | 3770 |
| 3748 ResourceId id = resource_provider->CreateResource( | 3771 ResourceId id = resource_provider->CreateResource( |
| 3749 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3772 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 3750 format); | 3773 format); |
| 3751 resource_provider->AllocateForTesting(id); | 3774 resource_provider->AllocateForTesting(id); |
| 3752 Mock::VerifyAndClearExpectations(context); | 3775 Mock::VerifyAndClearExpectations(context); |
| 3753 | 3776 |
| 3754 DCHECK_EQ(10u, context->PeekTextureId()); | 3777 DCHECK_EQ(10u, context->PeekTextureId()); |
| 3755 resource_provider->DeleteResource(id); | 3778 resource_provider->DeleteResource(id); |
| 3756 } | 3779 } |
| 3757 } | 3780 } |
| 3758 | 3781 |
| 3759 } // namespace | 3782 } // namespace |
| 3760 } // namespace cc | 3783 } // namespace cc |
| OLD | NEW |