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 | 10 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 child_output_surface_ = FakeOutputSurface::CreateSoftware( | 411 child_output_surface_ = FakeOutputSurface::CreateSoftware( |
412 make_scoped_ptr(new SoftwareOutputDevice)); | 412 make_scoped_ptr(new SoftwareOutputDevice)); |
413 break; | 413 break; |
414 } | 414 } |
415 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 415 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
416 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); | 416 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); |
417 | 417 |
418 shared_bitmap_manager_.reset(new TestSharedBitmapManager); | 418 shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
419 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); | 419 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
420 | 420 |
421 resource_provider_ = | 421 resource_provider_ = ResourceProvider::Create( |
422 ResourceProvider::Create(output_surface_.get(), | 422 output_surface_.get(), shared_bitmap_manager_.get(), |
423 shared_bitmap_manager_.get(), | 423 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
424 gpu_memory_buffer_manager_.get(), | 424 false, 1, false); |
425 main_thread_task_runner_.get(), | 425 child_resource_provider_ = ResourceProvider::Create( |
426 0, | 426 child_output_surface_.get(), shared_bitmap_manager_.get(), |
427 false, | 427 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
428 1); | 428 false, 1, false); |
429 child_resource_provider_ = | |
430 ResourceProvider::Create(child_output_surface_.get(), | |
431 shared_bitmap_manager_.get(), | |
432 gpu_memory_buffer_manager_.get(), | |
433 main_thread_task_runner_.get(), | |
434 0, | |
435 false, | |
436 1); | |
437 } | 429 } |
438 | 430 |
439 ResourceProviderTest() : ResourceProviderTest(true) {} | 431 ResourceProviderTest() : ResourceProviderTest(true) {} |
440 | 432 |
441 static void CollectResources(ReturnedResourceArray* array, | 433 static void CollectResources(ReturnedResourceArray* array, |
442 const ReturnedResourceArray& returned, | 434 const ReturnedResourceArray& returned, |
443 BlockingTaskRunner* main_thread_task_runner) { | 435 BlockingTaskRunner* main_thread_task_runner) { |
444 array->insert(array->end(), returned.begin(), returned.end()); | 436 array->insert(array->end(), returned.begin(), returned.end()); |
445 } | 437 } |
446 | 438 |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 return; | 1290 return; |
1299 | 1291 |
1300 scoped_ptr<ResourceProviderContext> child_context_owned( | 1292 scoped_ptr<ResourceProviderContext> child_context_owned( |
1301 ResourceProviderContext::Create(shared_data_.get())); | 1293 ResourceProviderContext::Create(shared_data_.get())); |
1302 | 1294 |
1303 FakeOutputSurfaceClient child_output_surface_client; | 1295 FakeOutputSurfaceClient child_output_surface_client; |
1304 scoped_ptr<OutputSurface> child_output_surface( | 1296 scoped_ptr<OutputSurface> child_output_surface( |
1305 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1297 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1306 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1298 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1307 | 1299 |
1308 scoped_ptr<ResourceProvider> child_resource_provider( | 1300 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( |
1309 ResourceProvider::Create(child_output_surface.get(), | 1301 child_output_surface.get(), shared_bitmap_manager_.get(), |
1310 shared_bitmap_manager_.get(), | 1302 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
1311 gpu_memory_buffer_manager_.get(), | |
1312 NULL, | |
1313 0, | |
1314 false, | |
1315 1)); | |
1316 | 1303 |
1317 gfx::Size size(1, 1); | 1304 gfx::Size size(1, 1); |
1318 ResourceFormat format = RGBA_8888; | 1305 ResourceFormat format = RGBA_8888; |
1319 size_t pixel_size = TextureSizeBytes(size, format); | 1306 size_t pixel_size = TextureSizeBytes(size, format); |
1320 ASSERT_EQ(4U, pixel_size); | 1307 ASSERT_EQ(4U, pixel_size); |
1321 | 1308 |
1322 ResourceId id1 = child_resource_provider->CreateResource( | 1309 ResourceId id1 = child_resource_provider->CreateResource( |
1323 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 1310 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
1324 uint8_t data1[4] = { 1, 2, 3, 4 }; | 1311 uint8_t data1[4] = { 1, 2, 3, 4 }; |
1325 child_resource_provider->CopyToResource(id1, data1, size); | 1312 child_resource_provider->CopyToResource(id1, data1, size); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 | 1775 |
1789 FakeOutputSurfaceClient child_output_surface_client; | 1776 FakeOutputSurfaceClient child_output_surface_client; |
1790 scoped_ptr<OutputSurface> child_output_surface( | 1777 scoped_ptr<OutputSurface> child_output_surface( |
1791 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1778 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1792 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1779 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1793 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1780 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1794 new TestSharedBitmapManager()); | 1781 new TestSharedBitmapManager()); |
1795 | 1782 |
1796 scoped_ptr<ResourceProvider> child_resource_provider( | 1783 scoped_ptr<ResourceProvider> child_resource_provider( |
1797 ResourceProvider::Create(child_output_surface.get(), | 1784 ResourceProvider::Create(child_output_surface.get(), |
1798 shared_bitmap_manager.get(), | 1785 shared_bitmap_manager.get(), NULL, NULL, 0, |
1799 NULL, | 1786 false, 1, false)); |
1800 NULL, | |
1801 0, | |
1802 false, | |
1803 1)); | |
1804 | 1787 |
1805 scoped_ptr<TextureStateTrackingContext> parent_context_owned( | 1788 scoped_ptr<TextureStateTrackingContext> parent_context_owned( |
1806 new TextureStateTrackingContext); | 1789 new TextureStateTrackingContext); |
1807 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1790 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
1808 | 1791 |
1809 FakeOutputSurfaceClient parent_output_surface_client; | 1792 FakeOutputSurfaceClient parent_output_surface_client; |
1810 scoped_ptr<OutputSurface> parent_output_surface( | 1793 scoped_ptr<OutputSurface> parent_output_surface( |
1811 FakeOutputSurface::Create3d(parent_context_owned.Pass())); | 1794 FakeOutputSurface::Create3d(parent_context_owned.Pass())); |
1812 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1795 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
1813 | 1796 |
1814 scoped_ptr<ResourceProvider> parent_resource_provider( | 1797 scoped_ptr<ResourceProvider> parent_resource_provider( |
1815 ResourceProvider::Create(parent_output_surface.get(), | 1798 ResourceProvider::Create(parent_output_surface.get(), |
1816 shared_bitmap_manager.get(), | 1799 shared_bitmap_manager.get(), NULL, NULL, 0, |
1817 NULL, | 1800 false, 1, false)); |
1818 NULL, | |
1819 0, | |
1820 false, | |
1821 1)); | |
1822 | 1801 |
1823 gfx::Size size(1, 1); | 1802 gfx::Size size(1, 1); |
1824 ResourceFormat format = RGBA_8888; | 1803 ResourceFormat format = RGBA_8888; |
1825 int child_texture_id = 1; | 1804 int child_texture_id = 1; |
1826 int parent_texture_id = 2; | 1805 int parent_texture_id = 2; |
1827 | 1806 |
1828 size_t pixel_size = TextureSizeBytes(size, format); | 1807 size_t pixel_size = TextureSizeBytes(size, format); |
1829 ASSERT_EQ(4U, pixel_size); | 1808 ASSERT_EQ(4U, pixel_size); |
1830 | 1809 |
1831 ResourceId id = child_resource_provider->CreateResource( | 1810 ResourceId id = child_resource_provider->CreateResource( |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 | 2420 |
2442 scoped_ptr<TextureStateTrackingContext> context_owned( | 2421 scoped_ptr<TextureStateTrackingContext> context_owned( |
2443 new TextureStateTrackingContext); | 2422 new TextureStateTrackingContext); |
2444 TextureStateTrackingContext* context = context_owned.get(); | 2423 TextureStateTrackingContext* context = context_owned.get(); |
2445 | 2424 |
2446 FakeOutputSurfaceClient output_surface_client; | 2425 FakeOutputSurfaceClient output_surface_client; |
2447 scoped_ptr<OutputSurface> output_surface( | 2426 scoped_ptr<OutputSurface> output_surface( |
2448 FakeOutputSurface::Create3d(context_owned.Pass())); | 2427 FakeOutputSurface::Create3d(context_owned.Pass())); |
2449 CHECK(output_surface->BindToClient(&output_surface_client)); | 2428 CHECK(output_surface->BindToClient(&output_surface_client)); |
2450 | 2429 |
2451 scoped_ptr<ResourceProvider> resource_provider( | 2430 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2452 ResourceProvider::Create(output_surface.get(), | 2431 output_surface.get(), shared_bitmap_manager_.get(), |
2453 shared_bitmap_manager_.get(), | 2432 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
2454 gpu_memory_buffer_manager_.get(), | |
2455 NULL, | |
2456 0, | |
2457 false, | |
2458 1)); | |
2459 | 2433 |
2460 gfx::Size size(1, 1); | 2434 gfx::Size size(1, 1); |
2461 ResourceFormat format = RGBA_8888; | 2435 ResourceFormat format = RGBA_8888; |
2462 int texture_id = 1; | 2436 int texture_id = 1; |
2463 | 2437 |
2464 ResourceId id = resource_provider->CreateResource( | 2438 ResourceId id = resource_provider->CreateResource( |
2465 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2439 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
2466 | 2440 |
2467 // Check that the texture gets created with the right sampler settings. | 2441 // Check that the texture gets created with the right sampler settings. |
2468 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) | 2442 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 | 2502 |
2529 scoped_ptr<TextureStateTrackingContext> context_owned( | 2503 scoped_ptr<TextureStateTrackingContext> context_owned( |
2530 new TextureStateTrackingContext); | 2504 new TextureStateTrackingContext); |
2531 TextureStateTrackingContext* context = context_owned.get(); | 2505 TextureStateTrackingContext* context = context_owned.get(); |
2532 | 2506 |
2533 FakeOutputSurfaceClient output_surface_client; | 2507 FakeOutputSurfaceClient output_surface_client; |
2534 scoped_ptr<OutputSurface> output_surface( | 2508 scoped_ptr<OutputSurface> output_surface( |
2535 FakeOutputSurface::Create3d(context_owned.Pass())); | 2509 FakeOutputSurface::Create3d(context_owned.Pass())); |
2536 CHECK(output_surface->BindToClient(&output_surface_client)); | 2510 CHECK(output_surface->BindToClient(&output_surface_client)); |
2537 | 2511 |
2538 scoped_ptr<ResourceProvider> resource_provider( | 2512 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2539 ResourceProvider::Create(output_surface.get(), | 2513 output_surface.get(), shared_bitmap_manager_.get(), |
2540 shared_bitmap_manager_.get(), | 2514 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
2541 gpu_memory_buffer_manager_.get(), | |
2542 NULL, | |
2543 0, | |
2544 false, | |
2545 1)); | |
2546 | 2515 |
2547 gfx::Size size(1, 1); | 2516 gfx::Size size(1, 1); |
2548 ResourceFormat format = RGBA_8888; | 2517 ResourceFormat format = RGBA_8888; |
2549 int texture_id = 1; | 2518 int texture_id = 1; |
2550 | 2519 |
2551 // Check that the texture gets created with the right sampler settings. | 2520 // Check that the texture gets created with the right sampler settings. |
2552 ResourceId id = resource_provider->CreateManagedResource( | 2521 ResourceId id = resource_provider->CreateManagedResource( |
2553 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, | 2522 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, |
2554 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2523 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
2555 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); | 2524 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); |
(...skipping 24 matching lines...) Expand all Loading... |
2580 | 2549 |
2581 scoped_ptr<TextureStateTrackingContext> context_owned( | 2550 scoped_ptr<TextureStateTrackingContext> context_owned( |
2582 new TextureStateTrackingContext); | 2551 new TextureStateTrackingContext); |
2583 TextureStateTrackingContext* context = context_owned.get(); | 2552 TextureStateTrackingContext* context = context_owned.get(); |
2584 | 2553 |
2585 FakeOutputSurfaceClient output_surface_client; | 2554 FakeOutputSurfaceClient output_surface_client; |
2586 scoped_ptr<OutputSurface> output_surface( | 2555 scoped_ptr<OutputSurface> output_surface( |
2587 FakeOutputSurface::Create3d(context_owned.Pass())); | 2556 FakeOutputSurface::Create3d(context_owned.Pass())); |
2588 CHECK(output_surface->BindToClient(&output_surface_client)); | 2557 CHECK(output_surface->BindToClient(&output_surface_client)); |
2589 | 2558 |
2590 scoped_ptr<ResourceProvider> resource_provider( | 2559 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2591 ResourceProvider::Create(output_surface.get(), | 2560 output_surface.get(), shared_bitmap_manager_.get(), |
2592 shared_bitmap_manager_.get(), | 2561 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
2593 gpu_memory_buffer_manager_.get(), | |
2594 NULL, | |
2595 0, | |
2596 false, | |
2597 1)); | |
2598 | 2562 |
2599 gfx::Size size(1, 1); | 2563 gfx::Size size(1, 1); |
2600 ResourceFormat format = RGBA_8888; | 2564 ResourceFormat format = RGBA_8888; |
2601 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2565 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2602 | 2566 |
2603 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2567 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
2604 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; | 2568 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; |
2605 // Check that the texture gets created with the right sampler settings. | 2569 // Check that the texture gets created with the right sampler settings. |
2606 ResourceId id = resource_provider->CreateGLTexture( | 2570 ResourceId id = resource_provider->CreateGLTexture( |
2607 size, GL_TEXTURE_2D, texture_pool, wrap_mode, | 2571 size, GL_TEXTURE_2D, texture_pool, wrap_mode, |
(...skipping 27 matching lines...) Expand all Loading... |
2635 new TextureStateTrackingContext); | 2599 new TextureStateTrackingContext); |
2636 TextureStateTrackingContext* context = context_owned.get(); | 2600 TextureStateTrackingContext* context = context_owned.get(); |
2637 context->set_support_texture_storage(true); | 2601 context->set_support_texture_storage(true); |
2638 context->set_support_texture_usage(true); | 2602 context->set_support_texture_usage(true); |
2639 | 2603 |
2640 FakeOutputSurfaceClient output_surface_client; | 2604 FakeOutputSurfaceClient output_surface_client; |
2641 scoped_ptr<OutputSurface> output_surface( | 2605 scoped_ptr<OutputSurface> output_surface( |
2642 FakeOutputSurface::Create3d(context_owned.Pass())); | 2606 FakeOutputSurface::Create3d(context_owned.Pass())); |
2643 CHECK(output_surface->BindToClient(&output_surface_client)); | 2607 CHECK(output_surface->BindToClient(&output_surface_client)); |
2644 | 2608 |
2645 scoped_ptr<ResourceProvider> resource_provider( | 2609 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2646 ResourceProvider::Create(output_surface.get(), | 2610 output_surface.get(), shared_bitmap_manager_.get(), |
2647 shared_bitmap_manager_.get(), | 2611 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
2648 gpu_memory_buffer_manager_.get(), | |
2649 NULL, | |
2650 0, | |
2651 false, | |
2652 1)); | |
2653 | 2612 |
2654 gfx::Size size(1, 1); | 2613 gfx::Size size(1, 1); |
2655 ResourceFormat format = RGBA_8888; | 2614 ResourceFormat format = RGBA_8888; |
2656 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2615 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2657 | 2616 |
2658 const ResourceProvider::TextureHint hints[4] = { | 2617 const ResourceProvider::TextureHint hints[4] = { |
2659 ResourceProvider::TEXTURE_HINT_DEFAULT, | 2618 ResourceProvider::TEXTURE_HINT_DEFAULT, |
2660 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 2619 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
2661 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 2620 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
2662 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 2621 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 const uint32_t kBadBeef = 0xbadbeef; | 2663 const uint32_t kBadBeef = 0xbadbeef; |
2705 scoped_ptr<SharedBitmap> shared_bitmap( | 2664 scoped_ptr<SharedBitmap> shared_bitmap( |
2706 CreateAndFillSharedBitmap(shared_bitmap_manager_.get(), size, kBadBeef)); | 2665 CreateAndFillSharedBitmap(shared_bitmap_manager_.get(), size, kBadBeef)); |
2707 | 2666 |
2708 FakeOutputSurfaceClient output_surface_client; | 2667 FakeOutputSurfaceClient output_surface_client; |
2709 scoped_ptr<OutputSurface> output_surface( | 2668 scoped_ptr<OutputSurface> output_surface( |
2710 FakeOutputSurface::CreateSoftware(make_scoped_ptr( | 2669 FakeOutputSurface::CreateSoftware(make_scoped_ptr( |
2711 new SoftwareOutputDevice))); | 2670 new SoftwareOutputDevice))); |
2712 CHECK(output_surface->BindToClient(&output_surface_client)); | 2671 CHECK(output_surface->BindToClient(&output_surface_client)); |
2713 | 2672 |
2714 scoped_ptr<ResourceProvider> resource_provider( | 2673 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2715 ResourceProvider::Create(output_surface.get(), | 2674 output_surface.get(), shared_bitmap_manager_.get(), |
2716 shared_bitmap_manager_.get(), | 2675 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
2717 gpu_memory_buffer_manager_.get(), | 2676 false, 1, false)); |
2718 main_thread_task_runner_.get(), | |
2719 0, | |
2720 false, | |
2721 1)); | |
2722 | 2677 |
2723 uint32 release_sync_point = 0; | 2678 uint32 release_sync_point = 0; |
2724 bool lost_resource = false; | 2679 bool lost_resource = false; |
2725 BlockingTaskRunner* main_thread_task_runner = NULL; | 2680 BlockingTaskRunner* main_thread_task_runner = NULL; |
2726 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2681 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2727 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2682 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
2728 &release_sync_point, | 2683 &release_sync_point, |
2729 &lost_resource, | 2684 &lost_resource, |
2730 &main_thread_task_runner)); | 2685 &main_thread_task_runner)); |
2731 TextureMailbox mailbox(shared_bitmap.get(), size); | 2686 TextureMailbox mailbox(shared_bitmap.get(), size); |
(...skipping 26 matching lines...) Expand all Loading... |
2758 GLenum sampler_filter) { | 2713 GLenum sampler_filter) { |
2759 scoped_ptr<TextureStateTrackingContext> context_owned( | 2714 scoped_ptr<TextureStateTrackingContext> context_owned( |
2760 new TextureStateTrackingContext); | 2715 new TextureStateTrackingContext); |
2761 TextureStateTrackingContext* context = context_owned.get(); | 2716 TextureStateTrackingContext* context = context_owned.get(); |
2762 | 2717 |
2763 FakeOutputSurfaceClient output_surface_client; | 2718 FakeOutputSurfaceClient output_surface_client; |
2764 scoped_ptr<OutputSurface> output_surface( | 2719 scoped_ptr<OutputSurface> output_surface( |
2765 FakeOutputSurface::Create3d(context_owned.Pass())); | 2720 FakeOutputSurface::Create3d(context_owned.Pass())); |
2766 CHECK(output_surface->BindToClient(&output_surface_client)); | 2721 CHECK(output_surface->BindToClient(&output_surface_client)); |
2767 | 2722 |
2768 scoped_ptr<ResourceProvider> resource_provider( | 2723 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2769 ResourceProvider::Create(output_surface.get(), | 2724 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, |
2770 shared_bitmap_manager, | 2725 main_thread_task_runner, 0, false, 1, false)); |
2771 gpu_memory_buffer_manager, | |
2772 main_thread_task_runner, | |
2773 0, | |
2774 false, | |
2775 1)); | |
2776 | 2726 |
2777 unsigned texture_id = 1; | 2727 unsigned texture_id = 1; |
2778 uint32 sync_point = 30; | 2728 uint32 sync_point = 30; |
2779 unsigned target = GL_TEXTURE_2D; | 2729 unsigned target = GL_TEXTURE_2D; |
2780 | 2730 |
2781 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2731 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2782 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2732 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2783 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2733 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2784 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2734 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2785 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2735 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2906 | 2856 |
2907 scoped_ptr<TextureStateTrackingContext> context_owned( | 2857 scoped_ptr<TextureStateTrackingContext> context_owned( |
2908 new TextureStateTrackingContext); | 2858 new TextureStateTrackingContext); |
2909 TextureStateTrackingContext* context = context_owned.get(); | 2859 TextureStateTrackingContext* context = context_owned.get(); |
2910 | 2860 |
2911 FakeOutputSurfaceClient output_surface_client; | 2861 FakeOutputSurfaceClient output_surface_client; |
2912 scoped_ptr<OutputSurface> output_surface( | 2862 scoped_ptr<OutputSurface> output_surface( |
2913 FakeOutputSurface::Create3d(context_owned.Pass())); | 2863 FakeOutputSurface::Create3d(context_owned.Pass())); |
2914 CHECK(output_surface->BindToClient(&output_surface_client)); | 2864 CHECK(output_surface->BindToClient(&output_surface_client)); |
2915 | 2865 |
2916 scoped_ptr<ResourceProvider> resource_provider( | 2866 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2917 ResourceProvider::Create(output_surface.get(), | 2867 output_surface.get(), shared_bitmap_manager_.get(), |
2918 shared_bitmap_manager_.get(), | 2868 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
2919 gpu_memory_buffer_manager_.get(), | |
2920 NULL, | |
2921 0, | |
2922 false, | |
2923 1)); | |
2924 | 2869 |
2925 uint32 sync_point = 30; | 2870 uint32 sync_point = 30; |
2926 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2871 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
2927 | 2872 |
2928 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2873 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2929 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2874 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2930 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2875 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2931 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2876 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2932 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2877 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
2933 | 2878 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 | 2925 |
2981 scoped_ptr<TextureStateTrackingContext> context_owned( | 2926 scoped_ptr<TextureStateTrackingContext> context_owned( |
2982 new TextureStateTrackingContext); | 2927 new TextureStateTrackingContext); |
2983 TextureStateTrackingContext* context = context_owned.get(); | 2928 TextureStateTrackingContext* context = context_owned.get(); |
2984 | 2929 |
2985 FakeOutputSurfaceClient output_surface_client; | 2930 FakeOutputSurfaceClient output_surface_client; |
2986 scoped_ptr<OutputSurface> output_surface( | 2931 scoped_ptr<OutputSurface> output_surface( |
2987 FakeOutputSurface::Create3d(context_owned.Pass())); | 2932 FakeOutputSurface::Create3d(context_owned.Pass())); |
2988 CHECK(output_surface->BindToClient(&output_surface_client)); | 2933 CHECK(output_surface->BindToClient(&output_surface_client)); |
2989 | 2934 |
2990 scoped_ptr<ResourceProvider> resource_provider( | 2935 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2991 ResourceProvider::Create(output_surface.get(), | 2936 output_surface.get(), shared_bitmap_manager_.get(), |
2992 shared_bitmap_manager_.get(), | 2937 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
2993 gpu_memory_buffer_manager_.get(), | |
2994 NULL, | |
2995 0, | |
2996 false, | |
2997 1)); | |
2998 | 2938 |
2999 uint32 sync_point = 30; | 2939 uint32 sync_point = 30; |
3000 unsigned target = GL_TEXTURE_2D; | 2940 unsigned target = GL_TEXTURE_2D; |
3001 | 2941 |
3002 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2942 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
3003 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2943 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
3004 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2944 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
3005 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2945 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
3006 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2946 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
3007 | 2947 |
(...skipping 30 matching lines...) Expand all Loading... |
3038 | 2978 |
3039 scoped_ptr<TextureStateTrackingContext> context_owned( | 2979 scoped_ptr<TextureStateTrackingContext> context_owned( |
3040 new TextureStateTrackingContext); | 2980 new TextureStateTrackingContext); |
3041 TextureStateTrackingContext* context = context_owned.get(); | 2981 TextureStateTrackingContext* context = context_owned.get(); |
3042 | 2982 |
3043 FakeOutputSurfaceClient output_surface_client; | 2983 FakeOutputSurfaceClient output_surface_client; |
3044 scoped_ptr<OutputSurface> output_surface( | 2984 scoped_ptr<OutputSurface> output_surface( |
3045 FakeOutputSurface::Create3d(context_owned.Pass())); | 2985 FakeOutputSurface::Create3d(context_owned.Pass())); |
3046 CHECK(output_surface->BindToClient(&output_surface_client)); | 2986 CHECK(output_surface->BindToClient(&output_surface_client)); |
3047 | 2987 |
3048 scoped_ptr<ResourceProvider> resource_provider( | 2988 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3049 ResourceProvider::Create(output_surface.get(), | 2989 output_surface.get(), shared_bitmap_manager_.get(), |
3050 shared_bitmap_manager_.get(), | 2990 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3051 gpu_memory_buffer_manager_.get(), | |
3052 NULL, | |
3053 0, | |
3054 false, | |
3055 1)); | |
3056 | 2991 |
3057 uint32 sync_point = 0; | 2992 uint32 sync_point = 0; |
3058 unsigned target = GL_TEXTURE_2D; | 2993 unsigned target = GL_TEXTURE_2D; |
3059 | 2994 |
3060 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2995 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
3061 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2996 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
3062 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2997 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
3063 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2998 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
3064 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2999 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
3065 | 3000 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3163 return; | 3098 return; |
3164 scoped_ptr<AllocationTrackingContext3D> context_owned( | 3099 scoped_ptr<AllocationTrackingContext3D> context_owned( |
3165 new StrictMock<AllocationTrackingContext3D>); | 3100 new StrictMock<AllocationTrackingContext3D>); |
3166 AllocationTrackingContext3D* context = context_owned.get(); | 3101 AllocationTrackingContext3D* context = context_owned.get(); |
3167 | 3102 |
3168 FakeOutputSurfaceClient output_surface_client; | 3103 FakeOutputSurfaceClient output_surface_client; |
3169 scoped_ptr<OutputSurface> output_surface( | 3104 scoped_ptr<OutputSurface> output_surface( |
3170 FakeOutputSurface::Create3d(context_owned.Pass())); | 3105 FakeOutputSurface::Create3d(context_owned.Pass())); |
3171 CHECK(output_surface->BindToClient(&output_surface_client)); | 3106 CHECK(output_surface->BindToClient(&output_surface_client)); |
3172 | 3107 |
3173 scoped_ptr<ResourceProvider> resource_provider( | 3108 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3174 ResourceProvider::Create(output_surface.get(), | 3109 output_surface.get(), shared_bitmap_manager_.get(), |
3175 shared_bitmap_manager_.get(), | 3110 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3176 gpu_memory_buffer_manager_.get(), | |
3177 NULL, | |
3178 0, | |
3179 false, | |
3180 1)); | |
3181 | 3111 |
3182 gfx::Size size(2, 2); | 3112 gfx::Size size(2, 2); |
3183 gfx::Vector2d offset(0, 0); | 3113 gfx::Vector2d offset(0, 0); |
3184 ResourceFormat format = RGBA_8888; | 3114 ResourceFormat format = RGBA_8888; |
3185 ResourceId id = 0; | 3115 ResourceId id = 0; |
3186 uint8_t pixels[16] = { 0 }; | 3116 uint8_t pixels[16] = { 0 }; |
3187 int texture_id = 123; | 3117 int texture_id = 123; |
3188 | 3118 |
3189 // Lazy allocation. Don't allocate when creating the resource. | 3119 // Lazy allocation. Don't allocate when creating the resource. |
3190 id = resource_provider->CreateResource( | 3120 id = resource_provider->CreateResource( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3242 new StrictMock<AllocationTrackingContext3D>); | 3172 new StrictMock<AllocationTrackingContext3D>); |
3243 AllocationTrackingContext3D* context = context_owned.get(); | 3173 AllocationTrackingContext3D* context = context_owned.get(); |
3244 context->set_support_texture_storage(true); | 3174 context->set_support_texture_storage(true); |
3245 context->set_support_texture_usage(true); | 3175 context->set_support_texture_usage(true); |
3246 | 3176 |
3247 FakeOutputSurfaceClient output_surface_client; | 3177 FakeOutputSurfaceClient output_surface_client; |
3248 scoped_ptr<OutputSurface> output_surface( | 3178 scoped_ptr<OutputSurface> output_surface( |
3249 FakeOutputSurface::Create3d(context_owned.Pass())); | 3179 FakeOutputSurface::Create3d(context_owned.Pass())); |
3250 CHECK(output_surface->BindToClient(&output_surface_client)); | 3180 CHECK(output_surface->BindToClient(&output_surface_client)); |
3251 | 3181 |
3252 scoped_ptr<ResourceProvider> resource_provider( | 3182 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3253 ResourceProvider::Create(output_surface.get(), | 3183 output_surface.get(), shared_bitmap_manager_.get(), |
3254 shared_bitmap_manager_.get(), | 3184 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3255 gpu_memory_buffer_manager_.get(), | |
3256 NULL, | |
3257 0, | |
3258 false, | |
3259 1)); | |
3260 | 3185 |
3261 gfx::Size size(2, 2); | 3186 gfx::Size size(2, 2); |
3262 | 3187 |
3263 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3188 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3264 const ResourceProvider::TextureHint hints[4] = { | 3189 const ResourceProvider::TextureHint hints[4] = { |
3265 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3190 ResourceProvider::TEXTURE_HINT_DEFAULT, |
3266 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3191 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3267 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3192 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
3268 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3193 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
3269 }; | 3194 }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3302 AllocationTrackingContext3D* context = context_owned.get(); | 3227 AllocationTrackingContext3D* context = context_owned.get(); |
3303 context->set_support_texture_format_bgra8888(true); | 3228 context->set_support_texture_format_bgra8888(true); |
3304 context->set_support_texture_storage(true); | 3229 context->set_support_texture_storage(true); |
3305 context->set_support_texture_usage(true); | 3230 context->set_support_texture_usage(true); |
3306 | 3231 |
3307 FakeOutputSurfaceClient output_surface_client; | 3232 FakeOutputSurfaceClient output_surface_client; |
3308 scoped_ptr<OutputSurface> output_surface( | 3233 scoped_ptr<OutputSurface> output_surface( |
3309 FakeOutputSurface::Create3d(context_owned.Pass())); | 3234 FakeOutputSurface::Create3d(context_owned.Pass())); |
3310 CHECK(output_surface->BindToClient(&output_surface_client)); | 3235 CHECK(output_surface->BindToClient(&output_surface_client)); |
3311 | 3236 |
3312 scoped_ptr<ResourceProvider> resource_provider( | 3237 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3313 ResourceProvider::Create(output_surface.get(), | 3238 output_surface.get(), shared_bitmap_manager_.get(), |
3314 shared_bitmap_manager_.get(), | 3239 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3315 gpu_memory_buffer_manager_.get(), | |
3316 NULL, | |
3317 0, | |
3318 false, | |
3319 1)); | |
3320 | 3240 |
3321 gfx::Size size(2, 2); | 3241 gfx::Size size(2, 2); |
3322 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3242 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3323 | 3243 |
3324 const ResourceProvider::TextureHint hints[4] = { | 3244 const ResourceProvider::TextureHint hints[4] = { |
3325 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3245 ResourceProvider::TEXTURE_HINT_DEFAULT, |
3326 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3246 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3327 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3247 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
3328 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3248 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
3329 }; | 3249 }; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3361 FakeOutputSurfaceClient output_surface_client; | 3281 FakeOutputSurfaceClient output_surface_client; |
3362 scoped_ptr<OutputSurface> output_surface( | 3282 scoped_ptr<OutputSurface> output_surface( |
3363 FakeOutputSurface::Create3d(context_owned.Pass())); | 3283 FakeOutputSurface::Create3d(context_owned.Pass())); |
3364 CHECK(output_surface->BindToClient(&output_surface_client)); | 3284 CHECK(output_surface->BindToClient(&output_surface_client)); |
3365 | 3285 |
3366 gfx::Size size(2, 2); | 3286 gfx::Size size(2, 2); |
3367 ResourceFormat format = RGBA_8888; | 3287 ResourceFormat format = RGBA_8888; |
3368 ResourceId id = 0; | 3288 ResourceId id = 0; |
3369 int texture_id = 123; | 3289 int texture_id = 123; |
3370 | 3290 |
3371 scoped_ptr<ResourceProvider> resource_provider( | 3291 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3372 ResourceProvider::Create(output_surface.get(), | 3292 output_surface.get(), shared_bitmap_manager_.get(), |
3373 shared_bitmap_manager_.get(), | 3293 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3374 gpu_memory_buffer_manager_.get(), | |
3375 NULL, | |
3376 0, | |
3377 false, | |
3378 1)); | |
3379 | 3294 |
3380 id = resource_provider->CreateResource( | 3295 id = resource_provider->CreateResource( |
3381 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3296 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3382 resource_provider->AcquirePixelBuffer(id); | 3297 resource_provider->AcquirePixelBuffer(id); |
3383 | 3298 |
3384 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3299 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3385 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3300 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3386 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) | 3301 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) |
3387 .Times(1); | 3302 .Times(1); |
3388 resource_provider->BeginSetPixels(id); | 3303 resource_provider->BeginSetPixels(id); |
(...skipping 19 matching lines...) Expand all Loading... |
3408 FakeOutputSurfaceClient output_surface_client; | 3323 FakeOutputSurfaceClient output_surface_client; |
3409 scoped_ptr<OutputSurface> output_surface( | 3324 scoped_ptr<OutputSurface> output_surface( |
3410 FakeOutputSurface::Create3d(context_owned.Pass())); | 3325 FakeOutputSurface::Create3d(context_owned.Pass())); |
3411 CHECK(output_surface->BindToClient(&output_surface_client)); | 3326 CHECK(output_surface->BindToClient(&output_surface_client)); |
3412 | 3327 |
3413 gfx::Size size(2, 2); | 3328 gfx::Size size(2, 2); |
3414 ResourceFormat format = RGBA_8888; | 3329 ResourceFormat format = RGBA_8888; |
3415 ResourceId id = 0; | 3330 ResourceId id = 0; |
3416 int texture_id = 123; | 3331 int texture_id = 123; |
3417 | 3332 |
3418 scoped_ptr<ResourceProvider> resource_provider( | 3333 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3419 ResourceProvider::Create(output_surface.get(), | 3334 output_surface.get(), shared_bitmap_manager_.get(), |
3420 shared_bitmap_manager_.get(), | 3335 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3421 gpu_memory_buffer_manager_.get(), | |
3422 NULL, | |
3423 0, | |
3424 false, | |
3425 1)); | |
3426 | 3336 |
3427 id = resource_provider->CreateResource( | 3337 id = resource_provider->CreateResource( |
3428 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3338 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3429 resource_provider->AcquirePixelBuffer(id); | 3339 resource_provider->AcquirePixelBuffer(id); |
3430 | 3340 |
3431 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3341 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3432 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3342 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3433 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) | 3343 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) |
3434 .Times(1); | 3344 .Times(1); |
3435 resource_provider->BeginSetPixels(id); | 3345 resource_provider->BeginSetPixels(id); |
(...skipping 19 matching lines...) Expand all Loading... |
3455 FakeOutputSurfaceClient output_surface_client; | 3365 FakeOutputSurfaceClient output_surface_client; |
3456 scoped_ptr<OutputSurface> output_surface( | 3366 scoped_ptr<OutputSurface> output_surface( |
3457 FakeOutputSurface::Create3d(context_owned.Pass())); | 3367 FakeOutputSurface::Create3d(context_owned.Pass())); |
3458 CHECK(output_surface->BindToClient(&output_surface_client)); | 3368 CHECK(output_surface->BindToClient(&output_surface_client)); |
3459 | 3369 |
3460 gfx::Size size(2, 2); | 3370 gfx::Size size(2, 2); |
3461 ResourceFormat format = RGBA_8888; | 3371 ResourceFormat format = RGBA_8888; |
3462 ResourceId id = 0; | 3372 ResourceId id = 0; |
3463 int texture_id = 123; | 3373 int texture_id = 123; |
3464 | 3374 |
3465 scoped_ptr<ResourceProvider> resource_provider( | 3375 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3466 ResourceProvider::Create(output_surface.get(), | 3376 output_surface.get(), shared_bitmap_manager_.get(), |
3467 shared_bitmap_manager_.get(), | 3377 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3468 gpu_memory_buffer_manager_.get(), | |
3469 NULL, | |
3470 0, | |
3471 false, | |
3472 1)); | |
3473 | 3378 |
3474 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); | 3379 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); |
3475 | 3380 |
3476 id = resource_provider->CreateResource( | 3381 id = resource_provider->CreateResource( |
3477 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3382 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3478 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 3383 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
3479 GL_INNOCENT_CONTEXT_RESET_ARB); | 3384 GL_INNOCENT_CONTEXT_RESET_ARB); |
3480 | 3385 |
3481 resource_provider->AcquirePixelBuffer(id); | 3386 resource_provider->AcquirePixelBuffer(id); |
3482 int stride; | 3387 int stride; |
(...skipping 17 matching lines...) Expand all Loading... |
3500 CHECK(output_surface->BindToClient(&output_surface_client)); | 3405 CHECK(output_surface->BindToClient(&output_surface_client)); |
3501 | 3406 |
3502 const int kWidth = 2; | 3407 const int kWidth = 2; |
3503 const int kHeight = 2; | 3408 const int kHeight = 2; |
3504 gfx::Size size(kWidth, kHeight); | 3409 gfx::Size size(kWidth, kHeight); |
3505 ResourceFormat format = RGBA_8888; | 3410 ResourceFormat format = RGBA_8888; |
3506 ResourceId id = 0; | 3411 ResourceId id = 0; |
3507 const unsigned kTextureId = 123u; | 3412 const unsigned kTextureId = 123u; |
3508 const unsigned kImageId = 234u; | 3413 const unsigned kImageId = 234u; |
3509 | 3414 |
3510 scoped_ptr<ResourceProvider> resource_provider( | 3415 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3511 ResourceProvider::Create(output_surface.get(), | 3416 output_surface.get(), shared_bitmap_manager_.get(), |
3512 shared_bitmap_manager_.get(), | 3417 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3513 gpu_memory_buffer_manager_.get(), | |
3514 NULL, | |
3515 0, | |
3516 false, | |
3517 1)); | |
3518 | 3418 |
3519 id = resource_provider->CreateResource( | 3419 id = resource_provider->CreateResource( |
3520 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3420 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3521 | 3421 |
3522 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) | 3422 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) |
3523 .WillOnce(Return(kImageId)) | 3423 .WillOnce(Return(kImageId)) |
3524 .RetiresOnSaturation(); | 3424 .RetiresOnSaturation(); |
3525 { | 3425 { |
3526 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3426 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
3527 resource_provider.get(), id); | 3427 resource_provider.get(), id); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3587 const int kWidth = 2; | 3487 const int kWidth = 2; |
3588 const int kHeight = 2; | 3488 const int kHeight = 2; |
3589 gfx::Size size(kWidth, kHeight); | 3489 gfx::Size size(kWidth, kHeight); |
3590 ResourceFormat format = RGBA_8888; | 3490 ResourceFormat format = RGBA_8888; |
3591 ResourceId source_id = 0; | 3491 ResourceId source_id = 0; |
3592 ResourceId dest_id = 0; | 3492 ResourceId dest_id = 0; |
3593 const unsigned kSourceTextureId = 123u; | 3493 const unsigned kSourceTextureId = 123u; |
3594 const unsigned kDestTextureId = 321u; | 3494 const unsigned kDestTextureId = 321u; |
3595 const unsigned kImageId = 234u; | 3495 const unsigned kImageId = 234u; |
3596 | 3496 |
3597 scoped_ptr<ResourceProvider> resource_provider( | 3497 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3598 ResourceProvider::Create(output_surface.get(), | 3498 output_surface.get(), shared_bitmap_manager_.get(), |
3599 shared_bitmap_manager_.get(), | 3499 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3600 gpu_memory_buffer_manager_.get(), | |
3601 NULL, | |
3602 0, | |
3603 false, | |
3604 1)); | |
3605 | 3500 |
3606 source_id = resource_provider->CreateResource( | 3501 source_id = resource_provider->CreateResource( |
3607 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3502 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3608 | 3503 |
3609 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) | 3504 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) |
3610 .WillOnce(Return(kImageId)) | 3505 .WillOnce(Return(kImageId)) |
3611 .RetiresOnSaturation(); | 3506 .RetiresOnSaturation(); |
3612 { | 3507 { |
3613 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3508 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
3614 resource_provider.get(), source_id); | 3509 resource_provider.get(), source_id); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3662 new AllocationTrackingContext3D); | 3557 new AllocationTrackingContext3D); |
3663 AllocationTrackingContext3D* context = context_owned.get(); | 3558 AllocationTrackingContext3D* context = context_owned.get(); |
3664 context_owned->set_support_compressed_texture_etc1(true); | 3559 context_owned->set_support_compressed_texture_etc1(true); |
3665 | 3560 |
3666 FakeOutputSurfaceClient output_surface_client; | 3561 FakeOutputSurfaceClient output_surface_client; |
3667 scoped_ptr<OutputSurface> output_surface( | 3562 scoped_ptr<OutputSurface> output_surface( |
3668 FakeOutputSurface::Create3d(context_owned.Pass())); | 3563 FakeOutputSurface::Create3d(context_owned.Pass())); |
3669 CHECK(output_surface->BindToClient(&output_surface_client)); | 3564 CHECK(output_surface->BindToClient(&output_surface_client)); |
3670 | 3565 |
3671 gfx::Size size(4, 4); | 3566 gfx::Size size(4, 4); |
3672 scoped_ptr<ResourceProvider> resource_provider( | 3567 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3673 ResourceProvider::Create(output_surface.get(), | 3568 output_surface.get(), shared_bitmap_manager_.get(), |
3674 shared_bitmap_manager_.get(), | 3569 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3675 gpu_memory_buffer_manager_.get(), | |
3676 NULL, | |
3677 0, | |
3678 false, | |
3679 1)); | |
3680 int texture_id = 123; | 3570 int texture_id = 123; |
3681 | 3571 |
3682 ResourceId id = resource_provider->CreateResource( | 3572 ResourceId id = resource_provider->CreateResource( |
3683 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3573 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
3684 EXPECT_NE(0u, id); | 3574 EXPECT_NE(0u, id); |
3685 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3575 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3686 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3576 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3687 resource_provider->AllocateForTesting(id); | 3577 resource_provider->AllocateForTesting(id); |
3688 | 3578 |
3689 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3579 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
3690 resource_provider->DeleteResource(id); | 3580 resource_provider->DeleteResource(id); |
3691 } | 3581 } |
3692 | 3582 |
3693 TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) { | 3583 TEST_P(ResourceProviderTest, CompressedTextureETC1Upload) { |
3694 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 3584 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
3695 return; | 3585 return; |
3696 | 3586 |
3697 scoped_ptr<AllocationTrackingContext3D> context_owned( | 3587 scoped_ptr<AllocationTrackingContext3D> context_owned( |
3698 new AllocationTrackingContext3D); | 3588 new AllocationTrackingContext3D); |
3699 AllocationTrackingContext3D* context = context_owned.get(); | 3589 AllocationTrackingContext3D* context = context_owned.get(); |
3700 context_owned->set_support_compressed_texture_etc1(true); | 3590 context_owned->set_support_compressed_texture_etc1(true); |
3701 | 3591 |
3702 FakeOutputSurfaceClient output_surface_client; | 3592 FakeOutputSurfaceClient output_surface_client; |
3703 scoped_ptr<OutputSurface> output_surface( | 3593 scoped_ptr<OutputSurface> output_surface( |
3704 FakeOutputSurface::Create3d(context_owned.Pass())); | 3594 FakeOutputSurface::Create3d(context_owned.Pass())); |
3705 CHECK(output_surface->BindToClient(&output_surface_client)); | 3595 CHECK(output_surface->BindToClient(&output_surface_client)); |
3706 | 3596 |
3707 gfx::Size size(4, 4); | 3597 gfx::Size size(4, 4); |
3708 scoped_ptr<ResourceProvider> resource_provider( | 3598 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3709 ResourceProvider::Create(output_surface.get(), | 3599 output_surface.get(), shared_bitmap_manager_.get(), |
3710 shared_bitmap_manager_.get(), | 3600 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); |
3711 gpu_memory_buffer_manager_.get(), | |
3712 NULL, | |
3713 0, | |
3714 false, | |
3715 1)); | |
3716 int texture_id = 123; | 3601 int texture_id = 123; |
3717 uint8_t pixels[8]; | 3602 uint8_t pixels[8]; |
3718 | 3603 |
3719 ResourceId id = resource_provider->CreateResource( | 3604 ResourceId id = resource_provider->CreateResource( |
3720 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3605 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
3721 EXPECT_NE(0u, id); | 3606 EXPECT_NE(0u, id); |
3722 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3607 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3723 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); | 3608 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); |
3724 EXPECT_CALL(*context, | 3609 EXPECT_CALL(*context, |
3725 compressedTexImage2D( | 3610 compressedTexImage2D( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3759 FakeOutputSurface::Create3d(context_owned.Pass())); | 3644 FakeOutputSurface::Create3d(context_owned.Pass())); |
3760 CHECK(output_surface->BindToClient(&output_surface_client)); | 3645 CHECK(output_surface->BindToClient(&output_surface_client)); |
3761 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 3646 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
3762 new TestSharedBitmapManager()); | 3647 new TestSharedBitmapManager()); |
3763 | 3648 |
3764 gfx::Size size(1, 1); | 3649 gfx::Size size(1, 1); |
3765 ResourceFormat format = RGBA_8888; | 3650 ResourceFormat format = RGBA_8888; |
3766 | 3651 |
3767 { | 3652 { |
3768 size_t kTextureAllocationChunkSize = 1; | 3653 size_t kTextureAllocationChunkSize = 1; |
3769 scoped_ptr<ResourceProvider> resource_provider( | 3654 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3770 ResourceProvider::Create(output_surface.get(), | 3655 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, |
3771 shared_bitmap_manager.get(), | 3656 kTextureAllocationChunkSize, false)); |
3772 NULL, | |
3773 NULL, | |
3774 0, | |
3775 false, | |
3776 kTextureAllocationChunkSize)); | |
3777 | 3657 |
3778 ResourceId id = resource_provider->CreateResource( | 3658 ResourceId id = resource_provider->CreateResource( |
3779 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3659 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3780 format); | 3660 format); |
3781 resource_provider->AllocateForTesting(id); | 3661 resource_provider->AllocateForTesting(id); |
3782 Mock::VerifyAndClearExpectations(context); | 3662 Mock::VerifyAndClearExpectations(context); |
3783 | 3663 |
3784 DCHECK_EQ(2u, context->PeekTextureId()); | 3664 DCHECK_EQ(2u, context->PeekTextureId()); |
3785 resource_provider->DeleteResource(id); | 3665 resource_provider->DeleteResource(id); |
3786 } | 3666 } |
3787 | 3667 |
3788 { | 3668 { |
3789 size_t kTextureAllocationChunkSize = 8; | 3669 size_t kTextureAllocationChunkSize = 8; |
3790 scoped_ptr<ResourceProvider> resource_provider( | 3670 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3791 ResourceProvider::Create(output_surface.get(), | 3671 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, |
3792 shared_bitmap_manager.get(), | 3672 kTextureAllocationChunkSize, false)); |
3793 NULL, | |
3794 NULL, | |
3795 0, | |
3796 false, | |
3797 kTextureAllocationChunkSize)); | |
3798 | 3673 |
3799 ResourceId id = resource_provider->CreateResource( | 3674 ResourceId id = resource_provider->CreateResource( |
3800 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3675 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3801 format); | 3676 format); |
3802 resource_provider->AllocateForTesting(id); | 3677 resource_provider->AllocateForTesting(id); |
3803 Mock::VerifyAndClearExpectations(context); | 3678 Mock::VerifyAndClearExpectations(context); |
3804 | 3679 |
3805 DCHECK_EQ(10u, context->PeekTextureId()); | 3680 DCHECK_EQ(10u, context->PeekTextureId()); |
3806 resource_provider->DeleteResource(id); | 3681 resource_provider->DeleteResource(id); |
3807 } | 3682 } |
3808 } | 3683 } |
3809 | 3684 |
3810 } // namespace | 3685 } // namespace |
3811 } // namespace cc | 3686 } // namespace cc |
OLD | NEW |