| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <unordered_map> | 14 #include <unordered_map> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "cc/output/buffer_to_texture_target_map.h" |
| 21 #include "cc/output/output_surface.h" | 22 #include "cc/output/output_surface.h" |
| 22 #include "cc/resources/returned_resource.h" | 23 #include "cc/resources/returned_resource.h" |
| 23 #include "cc/resources/shared_bitmap_manager.h" | 24 #include "cc/resources/shared_bitmap_manager.h" |
| 24 #include "cc/resources/single_release_callback.h" | 25 #include "cc/resources/single_release_callback.h" |
| 25 #include "cc/test/fake_output_surface.h" | 26 #include "cc/test/fake_output_surface.h" |
| 26 #include "cc/test/fake_output_surface_client.h" | 27 #include "cc/test/fake_output_surface_client.h" |
| 27 #include "cc/test/test_gpu_memory_buffer_manager.h" | 28 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 28 #include "cc/test/test_shared_bitmap_manager.h" | 29 #include "cc/test/test_shared_bitmap_manager.h" |
| 29 #include "cc/test/test_texture.h" | 30 #include "cc/test/test_texture.h" |
| 30 #include "cc/test/test_web_graphics_context_3d.h" | 31 #include "cc/test/test_web_graphics_context_3d.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 using testing::NiceMock; | 42 using testing::NiceMock; |
| 42 using testing::Return; | 43 using testing::Return; |
| 43 using testing::StrictMock; | 44 using testing::StrictMock; |
| 44 using testing::_; | 45 using testing::_; |
| 45 | 46 |
| 46 namespace cc { | 47 namespace cc { |
| 47 namespace { | 48 namespace { |
| 48 | 49 |
| 49 static const bool kUseGpuMemoryBufferResources = false; | 50 static const bool kUseGpuMemoryBufferResources = false; |
| 50 static const bool kDelegatedSyncPointsRequired = true; | 51 static const bool kDelegatedSyncPointsRequired = true; |
| 51 static const std::vector<unsigned> kUseImageTextureTargets( | |
| 52 static_cast<size_t>(gfx::BufferFormat::LAST) + 1, | |
| 53 GL_TEXTURE_2D); | |
| 54 | 52 |
| 55 MATCHER_P(MatchesSyncToken, sync_token, "") { | 53 MATCHER_P(MatchesSyncToken, sync_token, "") { |
| 56 gpu::SyncToken other; | 54 gpu::SyncToken other; |
| 57 memcpy(&other, arg, sizeof(other)); | 55 memcpy(&other, arg, sizeof(other)); |
| 58 return other == sync_token; | 56 return other == sync_token; |
| 59 } | 57 } |
| 60 | 58 |
| 61 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, | 59 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, |
| 62 bool lost_resource, | 60 bool lost_resource, |
| 63 BlockingTaskRunner* main_thread_task_runner) {} | 61 BlockingTaskRunner* main_thread_task_runner) {} |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 460 |
| 463 shared_bitmap_manager_.reset(new TestSharedBitmapManager); | 461 shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
| 464 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); | 462 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
| 465 child_gpu_memory_buffer_manager_ = | 463 child_gpu_memory_buffer_manager_ = |
| 466 gpu_memory_buffer_manager_->CreateClientGpuMemoryBufferManager(); | 464 gpu_memory_buffer_manager_->CreateClientGpuMemoryBufferManager(); |
| 467 | 465 |
| 468 resource_provider_ = base::MakeUnique<ResourceProvider>( | 466 resource_provider_ = base::MakeUnique<ResourceProvider>( |
| 469 output_surface_->context_provider(), shared_bitmap_manager_.get(), | 467 output_surface_->context_provider(), shared_bitmap_manager_.get(), |
| 470 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, | 468 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, |
| 471 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 469 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 472 kUseImageTextureTargets); | 470 DefaultBufferToTextureTargetMapForTesting()); |
| 473 child_resource_provider_ = base::MakeUnique<ResourceProvider>( | 471 child_resource_provider_ = base::MakeUnique<ResourceProvider>( |
| 474 child_output_surface_->context_provider(), shared_bitmap_manager_.get(), | 472 child_output_surface_->context_provider(), shared_bitmap_manager_.get(), |
| 475 child_gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), | 473 child_gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), |
| 476 0, 1, | 474 0, 1, |
| 477 child_output_surface_->capabilities().delegated_sync_points_required, | 475 child_output_surface_->capabilities().delegated_sync_points_required, |
| 478 kUseGpuMemoryBufferResources, kUseImageTextureTargets); | 476 kUseGpuMemoryBufferResources, |
| 477 DefaultBufferToTextureTargetMapForTesting()); |
| 479 } | 478 } |
| 480 | 479 |
| 481 ResourceProviderTest() : ResourceProviderTest(true) {} | 480 ResourceProviderTest() : ResourceProviderTest(true) {} |
| 482 | 481 |
| 483 static void CollectResources(ReturnedResourceArray* array, | 482 static void CollectResources(ReturnedResourceArray* array, |
| 484 const ReturnedResourceArray& returned, | 483 const ReturnedResourceArray& returned, |
| 485 BlockingTaskRunner* main_thread_task_runner) { | 484 BlockingTaskRunner* main_thread_task_runner) { |
| 486 array->insert(array->end(), returned.begin(), returned.end()); | 485 array->insert(array->end(), returned.begin(), returned.end()); |
| 487 } | 486 } |
| 488 | 487 |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 FakeOutputSurfaceClient child_output_surface_client; | 1448 FakeOutputSurfaceClient child_output_surface_client; |
| 1450 std::unique_ptr<OutputSurface> child_output_surface( | 1449 std::unique_ptr<OutputSurface> child_output_surface( |
| 1451 FakeOutputSurface::Create3d(std::move(child_context_owned))); | 1450 FakeOutputSurface::Create3d(std::move(child_context_owned))); |
| 1452 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1451 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
| 1453 | 1452 |
| 1454 std::unique_ptr<ResourceProvider> child_resource_provider( | 1453 std::unique_ptr<ResourceProvider> child_resource_provider( |
| 1455 base::MakeUnique<ResourceProvider>( | 1454 base::MakeUnique<ResourceProvider>( |
| 1456 child_output_surface->context_provider(), | 1455 child_output_surface->context_provider(), |
| 1457 shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), | 1456 shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), |
| 1458 nullptr, 0, 1, kDelegatedSyncPointsRequired, | 1457 nullptr, 0, 1, kDelegatedSyncPointsRequired, |
| 1459 kUseGpuMemoryBufferResources, kUseImageTextureTargets)); | 1458 kUseGpuMemoryBufferResources, |
| 1459 DefaultBufferToTextureTargetMapForTesting())); |
| 1460 | 1460 |
| 1461 gfx::Size size(1, 1); | 1461 gfx::Size size(1, 1); |
| 1462 ResourceFormat format = RGBA_8888; | 1462 ResourceFormat format = RGBA_8888; |
| 1463 size_t pixel_size = TextureSizeBytes(size, format); | 1463 size_t pixel_size = TextureSizeBytes(size, format); |
| 1464 ASSERT_EQ(4U, pixel_size); | 1464 ASSERT_EQ(4U, pixel_size); |
| 1465 | 1465 |
| 1466 ResourceId id1 = child_resource_provider->CreateResource( | 1466 ResourceId id1 = child_resource_provider->CreateResource( |
| 1467 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 1467 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 1468 uint8_t data1[4] = { 1, 2, 3, 4 }; | 1468 uint8_t data1[4] = { 1, 2, 3, 4 }; |
| 1469 child_resource_provider->CopyToResource(id1, data1, size); | 1469 child_resource_provider->CopyToResource(id1, data1, size); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 FakeOutputSurface::Create3d(std::move(child_context_owned))); | 1965 FakeOutputSurface::Create3d(std::move(child_context_owned))); |
| 1966 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1966 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
| 1967 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager( | 1967 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 1968 new TestSharedBitmapManager()); | 1968 new TestSharedBitmapManager()); |
| 1969 | 1969 |
| 1970 std::unique_ptr<ResourceProvider> child_resource_provider( | 1970 std::unique_ptr<ResourceProvider> child_resource_provider( |
| 1971 base::MakeUnique<ResourceProvider>( | 1971 base::MakeUnique<ResourceProvider>( |
| 1972 child_output_surface->context_provider(), | 1972 child_output_surface->context_provider(), |
| 1973 shared_bitmap_manager.get(), nullptr, nullptr, 0, 1, | 1973 shared_bitmap_manager.get(), nullptr, nullptr, 0, 1, |
| 1974 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 1974 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 1975 kUseImageTextureTargets)); | 1975 DefaultBufferToTextureTargetMapForTesting())); |
| 1976 | 1976 |
| 1977 std::unique_ptr<TextureStateTrackingContext> parent_context_owned( | 1977 std::unique_ptr<TextureStateTrackingContext> parent_context_owned( |
| 1978 new TextureStateTrackingContext); | 1978 new TextureStateTrackingContext); |
| 1979 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1979 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
| 1980 | 1980 |
| 1981 FakeOutputSurfaceClient parent_output_surface_client; | 1981 FakeOutputSurfaceClient parent_output_surface_client; |
| 1982 std::unique_ptr<OutputSurface> parent_output_surface( | 1982 std::unique_ptr<OutputSurface> parent_output_surface( |
| 1983 FakeOutputSurface::Create3d(std::move(parent_context_owned))); | 1983 FakeOutputSurface::Create3d(std::move(parent_context_owned))); |
| 1984 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1984 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
| 1985 | 1985 |
| 1986 std::unique_ptr<ResourceProvider> parent_resource_provider( | 1986 std::unique_ptr<ResourceProvider> parent_resource_provider( |
| 1987 base::MakeUnique<ResourceProvider>( | 1987 base::MakeUnique<ResourceProvider>( |
| 1988 parent_output_surface->context_provider(), | 1988 parent_output_surface->context_provider(), |
| 1989 shared_bitmap_manager.get(), nullptr, nullptr, 0, 1, | 1989 shared_bitmap_manager.get(), nullptr, nullptr, 0, 1, |
| 1990 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 1990 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 1991 kUseImageTextureTargets)); | 1991 DefaultBufferToTextureTargetMapForTesting())); |
| 1992 | 1992 |
| 1993 gfx::Size size(1, 1); | 1993 gfx::Size size(1, 1); |
| 1994 ResourceFormat format = RGBA_8888; | 1994 ResourceFormat format = RGBA_8888; |
| 1995 int child_texture_id = 1; | 1995 int child_texture_id = 1; |
| 1996 int parent_texture_id = 2; | 1996 int parent_texture_id = 2; |
| 1997 | 1997 |
| 1998 size_t pixel_size = TextureSizeBytes(size, format); | 1998 size_t pixel_size = TextureSizeBytes(size, format); |
| 1999 ASSERT_EQ(4U, pixel_size); | 1999 ASSERT_EQ(4U, pixel_size); |
| 2000 | 2000 |
| 2001 ResourceId id = child_resource_provider->CreateResource( | 2001 ResourceId id = child_resource_provider->CreateResource( |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2618 FakeOutputSurfaceClient output_surface_client; | 2618 FakeOutputSurfaceClient output_surface_client; |
| 2619 std::unique_ptr<OutputSurface> output_surface( | 2619 std::unique_ptr<OutputSurface> output_surface( |
| 2620 FakeOutputSurface::Create3d(std::move(context_owned))); | 2620 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2621 CHECK(output_surface->BindToClient(&output_surface_client)); | 2621 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2622 | 2622 |
| 2623 std::unique_ptr<ResourceProvider> resource_provider( | 2623 std::unique_ptr<ResourceProvider> resource_provider( |
| 2624 base::MakeUnique<ResourceProvider>( | 2624 base::MakeUnique<ResourceProvider>( |
| 2625 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2625 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2626 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 2626 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 2627 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2627 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2628 kUseImageTextureTargets)); | 2628 DefaultBufferToTextureTargetMapForTesting())); |
| 2629 | 2629 |
| 2630 gfx::Size size(1, 1); | 2630 gfx::Size size(1, 1); |
| 2631 ResourceFormat format = RGBA_8888; | 2631 ResourceFormat format = RGBA_8888; |
| 2632 int texture_id = 1; | 2632 int texture_id = 1; |
| 2633 | 2633 |
| 2634 ResourceId id = resource_provider->CreateResource( | 2634 ResourceId id = resource_provider->CreateResource( |
| 2635 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2635 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 2636 | 2636 |
| 2637 // Check that the texture gets created with the right sampler settings. | 2637 // Check that the texture gets created with the right sampler settings. |
| 2638 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) | 2638 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2699 FakeOutputSurfaceClient output_surface_client; | 2699 FakeOutputSurfaceClient output_surface_client; |
| 2700 std::unique_ptr<OutputSurface> output_surface( | 2700 std::unique_ptr<OutputSurface> output_surface( |
| 2701 FakeOutputSurface::Create3d(std::move(context_owned))); | 2701 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2702 CHECK(output_surface->BindToClient(&output_surface_client)); | 2702 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2703 | 2703 |
| 2704 std::unique_ptr<ResourceProvider> resource_provider( | 2704 std::unique_ptr<ResourceProvider> resource_provider( |
| 2705 base::MakeUnique<ResourceProvider>( | 2705 base::MakeUnique<ResourceProvider>( |
| 2706 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2706 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2707 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 2707 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 2708 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2708 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2709 kUseImageTextureTargets)); | 2709 DefaultBufferToTextureTargetMapForTesting())); |
| 2710 | 2710 |
| 2711 gfx::Size size(1, 1); | 2711 gfx::Size size(1, 1); |
| 2712 ResourceFormat format = RGBA_8888; | 2712 ResourceFormat format = RGBA_8888; |
| 2713 int texture_id = 1; | 2713 int texture_id = 1; |
| 2714 | 2714 |
| 2715 // Check that the texture gets created with the right sampler settings. | 2715 // Check that the texture gets created with the right sampler settings. |
| 2716 ResourceId id = resource_provider->CreateResource( | 2716 ResourceId id = resource_provider->CreateResource( |
| 2717 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2717 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 2718 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); | 2718 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); |
| 2719 EXPECT_CALL(*context, | 2719 EXPECT_CALL(*context, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2744 FakeOutputSurfaceClient output_surface_client; | 2744 FakeOutputSurfaceClient output_surface_client; |
| 2745 std::unique_ptr<OutputSurface> output_surface( | 2745 std::unique_ptr<OutputSurface> output_surface( |
| 2746 FakeOutputSurface::Create3d(std::move(context_owned))); | 2746 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2747 CHECK(output_surface->BindToClient(&output_surface_client)); | 2747 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2748 | 2748 |
| 2749 std::unique_ptr<ResourceProvider> resource_provider( | 2749 std::unique_ptr<ResourceProvider> resource_provider( |
| 2750 base::MakeUnique<ResourceProvider>( | 2750 base::MakeUnique<ResourceProvider>( |
| 2751 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2751 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2752 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 2752 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 2753 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2753 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2754 kUseImageTextureTargets)); | 2754 DefaultBufferToTextureTargetMapForTesting())); |
| 2755 | 2755 |
| 2756 gfx::Size size(1, 1); | 2756 gfx::Size size(1, 1); |
| 2757 ResourceFormat format = RGBA_8888; | 2757 ResourceFormat format = RGBA_8888; |
| 2758 | 2758 |
| 2759 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2759 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
| 2760 // Check that the texture gets created with the right sampler settings. | 2760 // Check that the texture gets created with the right sampler settings. |
| 2761 ResourceId id = resource_provider->CreateResource( | 2761 ResourceId id = resource_provider->CreateResource( |
| 2762 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2762 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 2763 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); | 2763 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); |
| 2764 EXPECT_CALL(*context, | 2764 EXPECT_CALL(*context, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2790 FakeOutputSurfaceClient output_surface_client; | 2790 FakeOutputSurfaceClient output_surface_client; |
| 2791 std::unique_ptr<OutputSurface> output_surface( | 2791 std::unique_ptr<OutputSurface> output_surface( |
| 2792 FakeOutputSurface::Create3d(std::move(context_owned))); | 2792 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2793 CHECK(output_surface->BindToClient(&output_surface_client)); | 2793 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2794 | 2794 |
| 2795 std::unique_ptr<ResourceProvider> resource_provider( | 2795 std::unique_ptr<ResourceProvider> resource_provider( |
| 2796 base::MakeUnique<ResourceProvider>( | 2796 base::MakeUnique<ResourceProvider>( |
| 2797 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2797 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2798 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 2798 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 2799 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2799 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2800 kUseImageTextureTargets)); | 2800 DefaultBufferToTextureTargetMapForTesting())); |
| 2801 | 2801 |
| 2802 gfx::Size size(1, 1); | 2802 gfx::Size size(1, 1); |
| 2803 ResourceFormat format = RGBA_8888; | 2803 ResourceFormat format = RGBA_8888; |
| 2804 | 2804 |
| 2805 const ResourceProvider::TextureHint hints[4] = { | 2805 const ResourceProvider::TextureHint hints[4] = { |
| 2806 ResourceProvider::TEXTURE_HINT_DEFAULT, | 2806 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 2807 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 2807 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 2808 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 2808 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 2809 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 2809 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 2810 }; | 2810 }; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2851 std::unique_ptr<OutputSurface> output_surface( | 2851 std::unique_ptr<OutputSurface> output_surface( |
| 2852 FakeOutputSurface::CreateSoftware( | 2852 FakeOutputSurface::CreateSoftware( |
| 2853 base::WrapUnique(new SoftwareOutputDevice))); | 2853 base::WrapUnique(new SoftwareOutputDevice))); |
| 2854 CHECK(output_surface->BindToClient(&output_surface_client)); | 2854 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2855 | 2855 |
| 2856 std::unique_ptr<ResourceProvider> resource_provider( | 2856 std::unique_ptr<ResourceProvider> resource_provider( |
| 2857 base::MakeUnique<ResourceProvider>( | 2857 base::MakeUnique<ResourceProvider>( |
| 2858 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2858 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2859 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, | 2859 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
| 2860 1, kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2860 1, kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2861 kUseImageTextureTargets)); | 2861 DefaultBufferToTextureTargetMapForTesting())); |
| 2862 | 2862 |
| 2863 gpu::SyncToken release_sync_token; | 2863 gpu::SyncToken release_sync_token; |
| 2864 bool lost_resource = false; | 2864 bool lost_resource = false; |
| 2865 BlockingTaskRunner* main_thread_task_runner = nullptr; | 2865 BlockingTaskRunner* main_thread_task_runner = nullptr; |
| 2866 std::unique_ptr<SingleReleaseCallbackImpl> callback = | 2866 std::unique_ptr<SingleReleaseCallbackImpl> callback = |
| 2867 SingleReleaseCallbackImpl::Create( | 2867 SingleReleaseCallbackImpl::Create( |
| 2868 base::Bind(&ReleaseCallback, &release_sync_token, &lost_resource, | 2868 base::Bind(&ReleaseCallback, &release_sync_token, &lost_resource, |
| 2869 &main_thread_task_runner)); | 2869 &main_thread_task_runner)); |
| 2870 TextureMailbox mailbox(shared_bitmap.get(), size); | 2870 TextureMailbox mailbox(shared_bitmap.get(), size); |
| 2871 | 2871 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2902 FakeOutputSurfaceClient output_surface_client; | 2902 FakeOutputSurfaceClient output_surface_client; |
| 2903 std::unique_ptr<OutputSurface> output_surface( | 2903 std::unique_ptr<OutputSurface> output_surface( |
| 2904 FakeOutputSurface::Create3d(std::move(context_owned))); | 2904 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2905 CHECK(output_surface->BindToClient(&output_surface_client)); | 2905 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2906 | 2906 |
| 2907 std::unique_ptr<ResourceProvider> resource_provider( | 2907 std::unique_ptr<ResourceProvider> resource_provider( |
| 2908 base::MakeUnique<ResourceProvider>( | 2908 base::MakeUnique<ResourceProvider>( |
| 2909 output_surface->context_provider(), shared_bitmap_manager, | 2909 output_surface->context_provider(), shared_bitmap_manager, |
| 2910 gpu_memory_buffer_manager, main_thread_task_runner, 0, 1, | 2910 gpu_memory_buffer_manager, main_thread_task_runner, 0, 1, |
| 2911 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2911 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2912 kUseImageTextureTargets)); | 2912 DefaultBufferToTextureTargetMapForTesting())); |
| 2913 | 2913 |
| 2914 unsigned texture_id = 1; | 2914 unsigned texture_id = 1; |
| 2915 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, | 2915 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 2916 gpu::CommandBufferId::FromUnsafeValue(0x12), | 2916 gpu::CommandBufferId::FromUnsafeValue(0x12), |
| 2917 0x34); | 2917 0x34); |
| 2918 unsigned target = GL_TEXTURE_2D; | 2918 unsigned target = GL_TEXTURE_2D; |
| 2919 const GLuint64 current_fence_sync = context->GetNextFenceSync(); | 2919 const GLuint64 current_fence_sync = context->GetNextFenceSync(); |
| 2920 | 2920 |
| 2921 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2921 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2922 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); | 2922 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3049 FakeOutputSurfaceClient output_surface_client; | 3049 FakeOutputSurfaceClient output_surface_client; |
| 3050 std::unique_ptr<OutputSurface> output_surface( | 3050 std::unique_ptr<OutputSurface> output_surface( |
| 3051 FakeOutputSurface::Create3d(std::move(context_owned))); | 3051 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3052 CHECK(output_surface->BindToClient(&output_surface_client)); | 3052 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3053 | 3053 |
| 3054 std::unique_ptr<ResourceProvider> resource_provider( | 3054 std::unique_ptr<ResourceProvider> resource_provider( |
| 3055 base::MakeUnique<ResourceProvider>( | 3055 base::MakeUnique<ResourceProvider>( |
| 3056 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3056 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3057 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3057 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3058 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3058 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3059 kUseImageTextureTargets)); | 3059 DefaultBufferToTextureTargetMapForTesting())); |
| 3060 | 3060 |
| 3061 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, | 3061 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 3062 gpu::CommandBufferId::FromUnsafeValue(0x12), 0x34); | 3062 gpu::CommandBufferId::FromUnsafeValue(0x12), 0x34); |
| 3063 const GLuint64 current_fence_sync = context->GetNextFenceSync(); | 3063 const GLuint64 current_fence_sync = context->GetNextFenceSync(); |
| 3064 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 3064 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
| 3065 | 3065 |
| 3066 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3066 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 3067 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); | 3067 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); |
| 3068 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3068 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 3069 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3069 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3121 FakeOutputSurfaceClient output_surface_client; | 3121 FakeOutputSurfaceClient output_surface_client; |
| 3122 std::unique_ptr<OutputSurface> output_surface( | 3122 std::unique_ptr<OutputSurface> output_surface( |
| 3123 FakeOutputSurface::Create3d(std::move(context_owned))); | 3123 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3124 CHECK(output_surface->BindToClient(&output_surface_client)); | 3124 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3125 | 3125 |
| 3126 std::unique_ptr<ResourceProvider> resource_provider( | 3126 std::unique_ptr<ResourceProvider> resource_provider( |
| 3127 base::MakeUnique<ResourceProvider>( | 3127 base::MakeUnique<ResourceProvider>( |
| 3128 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3128 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3129 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3129 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3130 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3130 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3131 kUseImageTextureTargets)); | 3131 DefaultBufferToTextureTargetMapForTesting())); |
| 3132 | 3132 |
| 3133 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, | 3133 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 3134 gpu::CommandBufferId::FromUnsafeValue(0x12), 0x34); | 3134 gpu::CommandBufferId::FromUnsafeValue(0x12), 0x34); |
| 3135 const GLuint64 current_fence_sync = context->GetNextFenceSync(); | 3135 const GLuint64 current_fence_sync = context->GetNextFenceSync(); |
| 3136 unsigned target = GL_TEXTURE_2D; | 3136 unsigned target = GL_TEXTURE_2D; |
| 3137 | 3137 |
| 3138 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3138 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 3139 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); | 3139 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); |
| 3140 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3140 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 3141 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3141 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3179 FakeOutputSurfaceClient output_surface_client; | 3179 FakeOutputSurfaceClient output_surface_client; |
| 3180 std::unique_ptr<OutputSurface> output_surface( | 3180 std::unique_ptr<OutputSurface> output_surface( |
| 3181 FakeOutputSurface::Create3d(std::move(context_owned))); | 3181 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3182 CHECK(output_surface->BindToClient(&output_surface_client)); | 3182 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3183 | 3183 |
| 3184 std::unique_ptr<ResourceProvider> resource_provider( | 3184 std::unique_ptr<ResourceProvider> resource_provider( |
| 3185 base::MakeUnique<ResourceProvider>( | 3185 base::MakeUnique<ResourceProvider>( |
| 3186 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3186 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3187 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3187 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3188 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3188 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3189 kUseImageTextureTargets)); | 3189 DefaultBufferToTextureTargetMapForTesting())); |
| 3190 | 3190 |
| 3191 gpu::SyncToken sync_token; | 3191 gpu::SyncToken sync_token; |
| 3192 const GLuint64 current_fence_sync = context->GetNextFenceSync(); | 3192 const GLuint64 current_fence_sync = context->GetNextFenceSync(); |
| 3193 unsigned target = GL_TEXTURE_2D; | 3193 unsigned target = GL_TEXTURE_2D; |
| 3194 | 3194 |
| 3195 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3195 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 3196 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); | 3196 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); |
| 3197 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3197 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 3198 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3198 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 3199 | 3199 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 FakeOutputSurfaceClient output_surface_client; | 3303 FakeOutputSurfaceClient output_surface_client; |
| 3304 std::unique_ptr<OutputSurface> output_surface( | 3304 std::unique_ptr<OutputSurface> output_surface( |
| 3305 FakeOutputSurface::Create3d(std::move(context_owned))); | 3305 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3306 CHECK(output_surface->BindToClient(&output_surface_client)); | 3306 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3307 | 3307 |
| 3308 std::unique_ptr<ResourceProvider> resource_provider( | 3308 std::unique_ptr<ResourceProvider> resource_provider( |
| 3309 base::MakeUnique<ResourceProvider>( | 3309 base::MakeUnique<ResourceProvider>( |
| 3310 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3310 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3311 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3311 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3312 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3312 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3313 kUseImageTextureTargets)); | 3313 DefaultBufferToTextureTargetMapForTesting())); |
| 3314 | 3314 |
| 3315 gfx::Size size(2, 2); | 3315 gfx::Size size(2, 2); |
| 3316 gfx::Vector2d offset(0, 0); | 3316 gfx::Vector2d offset(0, 0); |
| 3317 ResourceFormat format = RGBA_8888; | 3317 ResourceFormat format = RGBA_8888; |
| 3318 ResourceId id = 0; | 3318 ResourceId id = 0; |
| 3319 uint8_t pixels[16] = { 0 }; | 3319 uint8_t pixels[16] = { 0 }; |
| 3320 int texture_id = 123; | 3320 int texture_id = 123; |
| 3321 | 3321 |
| 3322 // Lazy allocation. Don't allocate when creating the resource. | 3322 // Lazy allocation. Don't allocate when creating the resource. |
| 3323 id = resource_provider->CreateResource( | 3323 id = resource_provider->CreateResource( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3361 FakeOutputSurfaceClient output_surface_client; | 3361 FakeOutputSurfaceClient output_surface_client; |
| 3362 std::unique_ptr<OutputSurface> output_surface( | 3362 std::unique_ptr<OutputSurface> output_surface( |
| 3363 FakeOutputSurface::Create3d(std::move(context_owned))); | 3363 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3364 CHECK(output_surface->BindToClient(&output_surface_client)); | 3364 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3365 | 3365 |
| 3366 std::unique_ptr<ResourceProvider> resource_provider( | 3366 std::unique_ptr<ResourceProvider> resource_provider( |
| 3367 base::MakeUnique<ResourceProvider>( | 3367 base::MakeUnique<ResourceProvider>( |
| 3368 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3368 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3369 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3369 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3370 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3370 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3371 kUseImageTextureTargets)); | 3371 DefaultBufferToTextureTargetMapForTesting())); |
| 3372 | 3372 |
| 3373 gfx::Size size(2, 2); | 3373 gfx::Size size(2, 2); |
| 3374 | 3374 |
| 3375 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3375 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
| 3376 const ResourceProvider::TextureHint hints[4] = { | 3376 const ResourceProvider::TextureHint hints[4] = { |
| 3377 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3377 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 3378 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3378 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 3379 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3379 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 3380 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3380 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 3381 }; | 3381 }; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3419 FakeOutputSurfaceClient output_surface_client; | 3419 FakeOutputSurfaceClient output_surface_client; |
| 3420 std::unique_ptr<OutputSurface> output_surface( | 3420 std::unique_ptr<OutputSurface> output_surface( |
| 3421 FakeOutputSurface::Create3d(std::move(context_owned))); | 3421 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3422 CHECK(output_surface->BindToClient(&output_surface_client)); | 3422 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3423 | 3423 |
| 3424 std::unique_ptr<ResourceProvider> resource_provider( | 3424 std::unique_ptr<ResourceProvider> resource_provider( |
| 3425 base::MakeUnique<ResourceProvider>( | 3425 base::MakeUnique<ResourceProvider>( |
| 3426 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3426 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3427 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3427 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3428 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3428 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3429 kUseImageTextureTargets)); | 3429 DefaultBufferToTextureTargetMapForTesting())); |
| 3430 | 3430 |
| 3431 gfx::Size size(2, 2); | 3431 gfx::Size size(2, 2); |
| 3432 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3432 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
| 3433 | 3433 |
| 3434 const ResourceProvider::TextureHint hints[4] = { | 3434 const ResourceProvider::TextureHint hints[4] = { |
| 3435 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3435 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 3436 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3436 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 3437 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3437 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 3438 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3438 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 3439 }; | 3439 }; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3480 ResourceFormat format = RGBA_8888; | 3480 ResourceFormat format = RGBA_8888; |
| 3481 ResourceId id = 0; | 3481 ResourceId id = 0; |
| 3482 const unsigned kTextureId = 123u; | 3482 const unsigned kTextureId = 123u; |
| 3483 const unsigned kImageId = 234u; | 3483 const unsigned kImageId = 234u; |
| 3484 | 3484 |
| 3485 std::unique_ptr<ResourceProvider> resource_provider( | 3485 std::unique_ptr<ResourceProvider> resource_provider( |
| 3486 base::MakeUnique<ResourceProvider>( | 3486 base::MakeUnique<ResourceProvider>( |
| 3487 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3487 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3488 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3488 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3489 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3489 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3490 kUseImageTextureTargets)); | 3490 DefaultBufferToTextureTargetMapForTesting())); |
| 3491 | 3491 |
| 3492 id = resource_provider->CreateResource( | 3492 id = resource_provider->CreateResource( |
| 3493 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3493 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 3494 | 3494 |
| 3495 EXPECT_CALL(*context, NextTextureId()) | 3495 EXPECT_CALL(*context, NextTextureId()) |
| 3496 .WillOnce(Return(kTextureId)) | 3496 .WillOnce(Return(kTextureId)) |
| 3497 .RetiresOnSaturation(); | 3497 .RetiresOnSaturation(); |
| 3498 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) | 3498 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) |
| 3499 .Times(3) | 3499 .Times(3) |
| 3500 .RetiresOnSaturation(); | 3500 .RetiresOnSaturation(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3560 std::unique_ptr<OutputSurface> output_surface( | 3560 std::unique_ptr<OutputSurface> output_surface( |
| 3561 FakeOutputSurface::Create3d(std::move(context_owned))); | 3561 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3562 CHECK(output_surface->BindToClient(&output_surface_client)); | 3562 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3563 | 3563 |
| 3564 gfx::Size size(4, 4); | 3564 gfx::Size size(4, 4); |
| 3565 std::unique_ptr<ResourceProvider> resource_provider( | 3565 std::unique_ptr<ResourceProvider> resource_provider( |
| 3566 base::MakeUnique<ResourceProvider>( | 3566 base::MakeUnique<ResourceProvider>( |
| 3567 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3567 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3568 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3568 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3569 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3569 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3570 kUseImageTextureTargets)); | 3570 DefaultBufferToTextureTargetMapForTesting())); |
| 3571 int texture_id = 123; | 3571 int texture_id = 123; |
| 3572 | 3572 |
| 3573 ResourceId id = resource_provider->CreateResource( | 3573 ResourceId id = resource_provider->CreateResource( |
| 3574 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3574 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
| 3575 EXPECT_NE(0u, id); | 3575 EXPECT_NE(0u, id); |
| 3576 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3576 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3577 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3577 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3578 resource_provider->AllocateForTesting(id); | 3578 resource_provider->AllocateForTesting(id); |
| 3579 | 3579 |
| 3580 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3580 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3594 std::unique_ptr<OutputSurface> output_surface( | 3594 std::unique_ptr<OutputSurface> output_surface( |
| 3595 FakeOutputSurface::Create3d(std::move(context_owned))); | 3595 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3596 CHECK(output_surface->BindToClient(&output_surface_client)); | 3596 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3597 | 3597 |
| 3598 gfx::Size size(4, 4); | 3598 gfx::Size size(4, 4); |
| 3599 std::unique_ptr<ResourceProvider> resource_provider( | 3599 std::unique_ptr<ResourceProvider> resource_provider( |
| 3600 base::MakeUnique<ResourceProvider>( | 3600 base::MakeUnique<ResourceProvider>( |
| 3601 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3601 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3602 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3602 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3603 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3603 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3604 kUseImageTextureTargets)); | 3604 DefaultBufferToTextureTargetMapForTesting())); |
| 3605 int texture_id = 123; | 3605 int texture_id = 123; |
| 3606 uint8_t pixels[8]; | 3606 uint8_t pixels[8]; |
| 3607 | 3607 |
| 3608 ResourceId id = resource_provider->CreateResource( | 3608 ResourceId id = resource_provider->CreateResource( |
| 3609 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3609 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
| 3610 EXPECT_NE(0u, id); | 3610 EXPECT_NE(0u, id); |
| 3611 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3611 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3612 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); | 3612 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); |
| 3613 EXPECT_CALL(*context, | 3613 EXPECT_CALL(*context, |
| 3614 compressedTexImage2D( | 3614 compressedTexImage2D( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3653 gfx::Size size(1, 1); | 3653 gfx::Size size(1, 1); |
| 3654 ResourceFormat format = RGBA_8888; | 3654 ResourceFormat format = RGBA_8888; |
| 3655 | 3655 |
| 3656 { | 3656 { |
| 3657 size_t kTextureAllocationChunkSize = 1; | 3657 size_t kTextureAllocationChunkSize = 1; |
| 3658 std::unique_ptr<ResourceProvider> resource_provider( | 3658 std::unique_ptr<ResourceProvider> resource_provider( |
| 3659 base::MakeUnique<ResourceProvider>( | 3659 base::MakeUnique<ResourceProvider>( |
| 3660 output_surface->context_provider(), shared_bitmap_manager.get(), | 3660 output_surface->context_provider(), shared_bitmap_manager.get(), |
| 3661 nullptr, nullptr, 0, kTextureAllocationChunkSize, | 3661 nullptr, nullptr, 0, kTextureAllocationChunkSize, |
| 3662 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3662 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3663 kUseImageTextureTargets)); | 3663 DefaultBufferToTextureTargetMapForTesting())); |
| 3664 | 3664 |
| 3665 ResourceId id = resource_provider->CreateResource( | 3665 ResourceId id = resource_provider->CreateResource( |
| 3666 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3666 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 3667 resource_provider->AllocateForTesting(id); | 3667 resource_provider->AllocateForTesting(id); |
| 3668 Mock::VerifyAndClearExpectations(context); | 3668 Mock::VerifyAndClearExpectations(context); |
| 3669 | 3669 |
| 3670 DCHECK_EQ(2u, context->PeekTextureId()); | 3670 DCHECK_EQ(2u, context->PeekTextureId()); |
| 3671 resource_provider->DeleteResource(id); | 3671 resource_provider->DeleteResource(id); |
| 3672 } | 3672 } |
| 3673 | 3673 |
| 3674 { | 3674 { |
| 3675 size_t kTextureAllocationChunkSize = 8; | 3675 size_t kTextureAllocationChunkSize = 8; |
| 3676 std::unique_ptr<ResourceProvider> resource_provider( | 3676 std::unique_ptr<ResourceProvider> resource_provider( |
| 3677 base::MakeUnique<ResourceProvider>( | 3677 base::MakeUnique<ResourceProvider>( |
| 3678 output_surface->context_provider(), shared_bitmap_manager.get(), | 3678 output_surface->context_provider(), shared_bitmap_manager.get(), |
| 3679 nullptr, nullptr, 0, kTextureAllocationChunkSize, | 3679 nullptr, nullptr, 0, kTextureAllocationChunkSize, |
| 3680 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3680 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3681 kUseImageTextureTargets)); | 3681 DefaultBufferToTextureTargetMapForTesting())); |
| 3682 | 3682 |
| 3683 ResourceId id = resource_provider->CreateResource( | 3683 ResourceId id = resource_provider->CreateResource( |
| 3684 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3684 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 3685 resource_provider->AllocateForTesting(id); | 3685 resource_provider->AllocateForTesting(id); |
| 3686 Mock::VerifyAndClearExpectations(context); | 3686 Mock::VerifyAndClearExpectations(context); |
| 3687 | 3687 |
| 3688 DCHECK_EQ(10u, context->PeekTextureId()); | 3688 DCHECK_EQ(10u, context->PeekTextureId()); |
| 3689 resource_provider->DeleteResource(id); | 3689 resource_provider->DeleteResource(id); |
| 3690 } | 3690 } |
| 3691 } | 3691 } |
| 3692 | 3692 |
| 3693 } // namespace | 3693 } // namespace |
| 3694 } // namespace cc | 3694 } // namespace cc |
| OLD | NEW |