OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 416 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
417 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); | 417 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); |
418 | 418 |
419 shared_bitmap_manager_.reset(new TestSharedBitmapManager); | 419 shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
420 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); | 420 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
421 | 421 |
422 resource_provider_ = ResourceProvider::Create( | 422 resource_provider_ = ResourceProvider::Create( |
423 output_surface_.get(), shared_bitmap_manager_.get(), | 423 output_surface_.get(), shared_bitmap_manager_.get(), |
424 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, | 424 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, |
425 use_image_texture_targets_); | 425 use_gpu_memory_buffer_resources_, use_image_texture_targets_); |
426 child_resource_provider_ = ResourceProvider::Create( | 426 child_resource_provider_ = ResourceProvider::Create( |
427 child_output_surface_.get(), shared_bitmap_manager_.get(), | 427 child_output_surface_.get(), shared_bitmap_manager_.get(), |
428 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, | 428 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, |
429 use_image_texture_targets_); | 429 use_gpu_memory_buffer_resources_, use_image_texture_targets_); |
430 } | 430 } |
431 | 431 |
432 ResourceProviderTest() : ResourceProviderTest(true) {} | 432 ResourceProviderTest() : ResourceProviderTest(true) {} |
433 | 433 |
434 static void CollectResources(ReturnedResourceArray* array, | 434 static void CollectResources(ReturnedResourceArray* array, |
435 const ReturnedResourceArray& returned, | 435 const ReturnedResourceArray& returned, |
436 BlockingTaskRunner* main_thread_task_runner) { | 436 BlockingTaskRunner* main_thread_task_runner) { |
437 array->insert(array->end(), returned.begin(), returned.end()); | 437 array->insert(array->end(), returned.begin(), returned.end()); |
438 } | 438 } |
439 | 439 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 scoped_ptr<SingleReleaseCallbackImpl> callback = | 480 scoped_ptr<SingleReleaseCallbackImpl> callback = |
481 SingleReleaseCallbackImpl::Create(base::Bind( | 481 SingleReleaseCallbackImpl::Create(base::Bind( |
482 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), | 482 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), |
483 release_called, release_sync_point, lost_resource)); | 483 release_called, release_sync_point, lost_resource)); |
484 return child_resource_provider_->CreateResourceFromTextureMailbox( | 484 return child_resource_provider_->CreateResourceFromTextureMailbox( |
485 TextureMailbox(shared_bitmap_ptr, size), callback.Pass()); | 485 TextureMailbox(shared_bitmap_ptr, size), callback.Pass()); |
486 } | 486 } |
487 } | 487 } |
488 | 488 |
489 public: | 489 public: |
| 490 static bool use_gpu_memory_buffer_resources() { |
| 491 return use_gpu_memory_buffer_resources_; |
| 492 } |
490 static std::vector<unsigned> use_image_texture_targets() { | 493 static std::vector<unsigned> use_image_texture_targets() { |
491 return use_image_texture_targets_; | 494 return use_image_texture_targets_; |
492 } | 495 } |
493 | 496 |
494 protected: | 497 protected: |
| 498 static bool use_gpu_memory_buffer_resources_; |
495 static std::vector<unsigned> use_image_texture_targets_; | 499 static std::vector<unsigned> use_image_texture_targets_; |
496 scoped_ptr<ContextSharedData> shared_data_; | 500 scoped_ptr<ContextSharedData> shared_data_; |
497 ResourceProviderContext* context3d_; | 501 ResourceProviderContext* context3d_; |
498 ResourceProviderContext* child_context_; | 502 ResourceProviderContext* child_context_; |
499 FakeOutputSurfaceClient output_surface_client_; | 503 FakeOutputSurfaceClient output_surface_client_; |
500 FakeOutputSurfaceClient child_output_surface_client_; | 504 FakeOutputSurfaceClient child_output_surface_client_; |
501 scoped_ptr<OutputSurface> output_surface_; | 505 scoped_ptr<OutputSurface> output_surface_; |
502 scoped_ptr<OutputSurface> child_output_surface_; | 506 scoped_ptr<OutputSurface> child_output_surface_; |
503 scoped_ptr<BlockingTaskRunner> main_thread_task_runner_; | 507 scoped_ptr<BlockingTaskRunner> main_thread_task_runner_; |
504 scoped_ptr<ResourceProvider> resource_provider_; | 508 scoped_ptr<ResourceProvider> resource_provider_; |
505 scoped_ptr<ResourceProvider> child_resource_provider_; | 509 scoped_ptr<ResourceProvider> child_resource_provider_; |
506 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; | 510 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; |
507 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 511 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
508 }; | 512 }; |
509 | 513 |
| 514 bool ResourceProviderTest::use_gpu_memory_buffer_resources_ = false; |
| 515 |
510 std::vector<unsigned> ResourceProviderTest::use_image_texture_targets_ = | 516 std::vector<unsigned> ResourceProviderTest::use_image_texture_targets_ = |
511 std::vector<unsigned>(static_cast<size_t>(gfx::BufferFormat::LAST) + 1, | 517 std::vector<unsigned>(static_cast<size_t>(gfx::BufferFormat::LAST) + 1, |
512 GL_TEXTURE_2D); | 518 GL_TEXTURE_2D); |
513 | 519 |
514 void CheckCreateResource(ResourceProvider::ResourceType expected_default_type, | 520 void CheckCreateResource(ResourceProvider::ResourceType expected_default_type, |
515 ResourceProvider* resource_provider, | 521 ResourceProvider* resource_provider, |
516 ResourceProviderContext* context) { | 522 ResourceProviderContext* context) { |
517 DCHECK_EQ(expected_default_type, resource_provider->default_resource_type()); | 523 DCHECK_EQ(expected_default_type, resource_provider->default_resource_type()); |
518 | 524 |
519 gfx::Size size(1, 1); | 525 gfx::Size size(1, 1); |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 ResourceProviderContext::Create(shared_data_.get())); | 1378 ResourceProviderContext::Create(shared_data_.get())); |
1373 | 1379 |
1374 FakeOutputSurfaceClient child_output_surface_client; | 1380 FakeOutputSurfaceClient child_output_surface_client; |
1375 scoped_ptr<OutputSurface> child_output_surface( | 1381 scoped_ptr<OutputSurface> child_output_surface( |
1376 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1382 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1377 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1383 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1378 | 1384 |
1379 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( | 1385 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( |
1380 child_output_surface.get(), shared_bitmap_manager_.get(), | 1386 child_output_surface.get(), shared_bitmap_manager_.get(), |
1381 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 1387 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
1382 use_image_texture_targets_)); | 1388 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
1383 | 1389 |
1384 gfx::Size size(1, 1); | 1390 gfx::Size size(1, 1); |
1385 ResourceFormat format = RGBA_8888; | 1391 ResourceFormat format = RGBA_8888; |
1386 size_t pixel_size = TextureSizeBytes(size, format); | 1392 size_t pixel_size = TextureSizeBytes(size, format); |
1387 ASSERT_EQ(4U, pixel_size); | 1393 ASSERT_EQ(4U, pixel_size); |
1388 | 1394 |
1389 ResourceId id1 = child_resource_provider->CreateResource( | 1395 ResourceId id1 = child_resource_provider->CreateResource( |
1390 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 1396 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
1391 uint8_t data1[4] = { 1, 2, 3, 4 }; | 1397 uint8_t data1[4] = { 1, 2, 3, 4 }; |
1392 child_resource_provider->CopyToResource(id1, data1, size); | 1398 child_resource_provider->CopyToResource(id1, data1, size); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 FakeOutputSurfaceClient child_output_surface_client; | 1862 FakeOutputSurfaceClient child_output_surface_client; |
1857 scoped_ptr<OutputSurface> child_output_surface( | 1863 scoped_ptr<OutputSurface> child_output_surface( |
1858 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1864 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1859 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1865 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1860 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1866 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1861 new TestSharedBitmapManager()); | 1867 new TestSharedBitmapManager()); |
1862 | 1868 |
1863 scoped_ptr<ResourceProvider> child_resource_provider( | 1869 scoped_ptr<ResourceProvider> child_resource_provider( |
1864 ResourceProvider::Create(child_output_surface.get(), | 1870 ResourceProvider::Create(child_output_surface.get(), |
1865 shared_bitmap_manager.get(), NULL, NULL, 0, 1, | 1871 shared_bitmap_manager.get(), NULL, NULL, 0, 1, |
| 1872 use_gpu_memory_buffer_resources_, |
1866 use_image_texture_targets_)); | 1873 use_image_texture_targets_)); |
1867 | 1874 |
1868 scoped_ptr<TextureStateTrackingContext> parent_context_owned( | 1875 scoped_ptr<TextureStateTrackingContext> parent_context_owned( |
1869 new TextureStateTrackingContext); | 1876 new TextureStateTrackingContext); |
1870 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1877 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
1871 | 1878 |
1872 FakeOutputSurfaceClient parent_output_surface_client; | 1879 FakeOutputSurfaceClient parent_output_surface_client; |
1873 scoped_ptr<OutputSurface> parent_output_surface( | 1880 scoped_ptr<OutputSurface> parent_output_surface( |
1874 FakeOutputSurface::Create3d(parent_context_owned.Pass())); | 1881 FakeOutputSurface::Create3d(parent_context_owned.Pass())); |
1875 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1882 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
1876 | 1883 |
1877 scoped_ptr<ResourceProvider> parent_resource_provider( | 1884 scoped_ptr<ResourceProvider> parent_resource_provider( |
1878 ResourceProvider::Create(parent_output_surface.get(), | 1885 ResourceProvider::Create(parent_output_surface.get(), |
1879 shared_bitmap_manager.get(), NULL, NULL, 0, 1, | 1886 shared_bitmap_manager.get(), NULL, NULL, 0, 1, |
| 1887 use_gpu_memory_buffer_resources_, |
1880 use_image_texture_targets_)); | 1888 use_image_texture_targets_)); |
1881 | 1889 |
1882 gfx::Size size(1, 1); | 1890 gfx::Size size(1, 1); |
1883 ResourceFormat format = RGBA_8888; | 1891 ResourceFormat format = RGBA_8888; |
1884 int child_texture_id = 1; | 1892 int child_texture_id = 1; |
1885 int parent_texture_id = 2; | 1893 int parent_texture_id = 2; |
1886 | 1894 |
1887 size_t pixel_size = TextureSizeBytes(size, format); | 1895 size_t pixel_size = TextureSizeBytes(size, format); |
1888 ASSERT_EQ(4U, pixel_size); | 1896 ASSERT_EQ(4U, pixel_size); |
1889 | 1897 |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 TextureStateTrackingContext* context = context_owned.get(); | 2506 TextureStateTrackingContext* context = context_owned.get(); |
2499 | 2507 |
2500 FakeOutputSurfaceClient output_surface_client; | 2508 FakeOutputSurfaceClient output_surface_client; |
2501 scoped_ptr<OutputSurface> output_surface( | 2509 scoped_ptr<OutputSurface> output_surface( |
2502 FakeOutputSurface::Create3d(context_owned.Pass())); | 2510 FakeOutputSurface::Create3d(context_owned.Pass())); |
2503 CHECK(output_surface->BindToClient(&output_surface_client)); | 2511 CHECK(output_surface->BindToClient(&output_surface_client)); |
2504 | 2512 |
2505 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2513 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2506 output_surface.get(), shared_bitmap_manager_.get(), | 2514 output_surface.get(), shared_bitmap_manager_.get(), |
2507 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 2515 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2508 use_image_texture_targets_)); | 2516 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
2509 | 2517 |
2510 gfx::Size size(1, 1); | 2518 gfx::Size size(1, 1); |
2511 ResourceFormat format = RGBA_8888; | 2519 ResourceFormat format = RGBA_8888; |
2512 int texture_id = 1; | 2520 int texture_id = 1; |
2513 | 2521 |
2514 ResourceId id = resource_provider->CreateResource( | 2522 ResourceId id = resource_provider->CreateResource( |
2515 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2523 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
2516 | 2524 |
2517 // Check that the texture gets created with the right sampler settings. | 2525 // Check that the texture gets created with the right sampler settings. |
2518 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) | 2526 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 TextureStateTrackingContext* context = context_owned.get(); | 2585 TextureStateTrackingContext* context = context_owned.get(); |
2578 | 2586 |
2579 FakeOutputSurfaceClient output_surface_client; | 2587 FakeOutputSurfaceClient output_surface_client; |
2580 scoped_ptr<OutputSurface> output_surface( | 2588 scoped_ptr<OutputSurface> output_surface( |
2581 FakeOutputSurface::Create3d(context_owned.Pass())); | 2589 FakeOutputSurface::Create3d(context_owned.Pass())); |
2582 CHECK(output_surface->BindToClient(&output_surface_client)); | 2590 CHECK(output_surface->BindToClient(&output_surface_client)); |
2583 | 2591 |
2584 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2592 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2585 output_surface.get(), shared_bitmap_manager_.get(), | 2593 output_surface.get(), shared_bitmap_manager_.get(), |
2586 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 2594 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2587 use_image_texture_targets_)); | 2595 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
2588 | 2596 |
2589 gfx::Size size(1, 1); | 2597 gfx::Size size(1, 1); |
2590 ResourceFormat format = RGBA_8888; | 2598 ResourceFormat format = RGBA_8888; |
2591 int texture_id = 1; | 2599 int texture_id = 1; |
2592 | 2600 |
2593 // Check that the texture gets created with the right sampler settings. | 2601 // Check that the texture gets created with the right sampler settings. |
2594 ResourceId id = resource_provider->CreateResource( | 2602 ResourceId id = resource_provider->CreateResource( |
2595 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2603 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
2596 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); | 2604 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); |
2597 EXPECT_CALL(*context, | 2605 EXPECT_CALL(*context, |
(...skipping 22 matching lines...) Expand all Loading... |
2620 TextureStateTrackingContext* context = context_owned.get(); | 2628 TextureStateTrackingContext* context = context_owned.get(); |
2621 | 2629 |
2622 FakeOutputSurfaceClient output_surface_client; | 2630 FakeOutputSurfaceClient output_surface_client; |
2623 scoped_ptr<OutputSurface> output_surface( | 2631 scoped_ptr<OutputSurface> output_surface( |
2624 FakeOutputSurface::Create3d(context_owned.Pass())); | 2632 FakeOutputSurface::Create3d(context_owned.Pass())); |
2625 CHECK(output_surface->BindToClient(&output_surface_client)); | 2633 CHECK(output_surface->BindToClient(&output_surface_client)); |
2626 | 2634 |
2627 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2635 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2628 output_surface.get(), shared_bitmap_manager_.get(), | 2636 output_surface.get(), shared_bitmap_manager_.get(), |
2629 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 2637 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2630 use_image_texture_targets_)); | 2638 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
2631 | 2639 |
2632 gfx::Size size(1, 1); | 2640 gfx::Size size(1, 1); |
2633 ResourceFormat format = RGBA_8888; | 2641 ResourceFormat format = RGBA_8888; |
2634 | 2642 |
2635 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2643 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
2636 // Check that the texture gets created with the right sampler settings. | 2644 // Check that the texture gets created with the right sampler settings. |
2637 ResourceId id = resource_provider->CreateResource( | 2645 ResourceId id = resource_provider->CreateResource( |
2638 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2646 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
2639 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); | 2647 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); |
2640 EXPECT_CALL(*context, | 2648 EXPECT_CALL(*context, |
(...skipping 23 matching lines...) Expand all Loading... |
2664 context->set_support_texture_usage(true); | 2672 context->set_support_texture_usage(true); |
2665 | 2673 |
2666 FakeOutputSurfaceClient output_surface_client; | 2674 FakeOutputSurfaceClient output_surface_client; |
2667 scoped_ptr<OutputSurface> output_surface( | 2675 scoped_ptr<OutputSurface> output_surface( |
2668 FakeOutputSurface::Create3d(context_owned.Pass())); | 2676 FakeOutputSurface::Create3d(context_owned.Pass())); |
2669 CHECK(output_surface->BindToClient(&output_surface_client)); | 2677 CHECK(output_surface->BindToClient(&output_surface_client)); |
2670 | 2678 |
2671 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2679 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2672 output_surface.get(), shared_bitmap_manager_.get(), | 2680 output_surface.get(), shared_bitmap_manager_.get(), |
2673 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 2681 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2674 use_image_texture_targets_)); | 2682 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
2675 | 2683 |
2676 gfx::Size size(1, 1); | 2684 gfx::Size size(1, 1); |
2677 ResourceFormat format = RGBA_8888; | 2685 ResourceFormat format = RGBA_8888; |
2678 | 2686 |
2679 const ResourceProvider::TextureHint hints[4] = { | 2687 const ResourceProvider::TextureHint hints[4] = { |
2680 ResourceProvider::TEXTURE_HINT_DEFAULT, | 2688 ResourceProvider::TEXTURE_HINT_DEFAULT, |
2681 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 2689 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
2682 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 2690 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
2683 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 2691 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
2684 }; | 2692 }; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2723 | 2731 |
2724 FakeOutputSurfaceClient output_surface_client; | 2732 FakeOutputSurfaceClient output_surface_client; |
2725 scoped_ptr<OutputSurface> output_surface( | 2733 scoped_ptr<OutputSurface> output_surface( |
2726 FakeOutputSurface::CreateSoftware(make_scoped_ptr( | 2734 FakeOutputSurface::CreateSoftware(make_scoped_ptr( |
2727 new SoftwareOutputDevice))); | 2735 new SoftwareOutputDevice))); |
2728 CHECK(output_surface->BindToClient(&output_surface_client)); | 2736 CHECK(output_surface->BindToClient(&output_surface_client)); |
2729 | 2737 |
2730 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2738 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2731 output_surface.get(), shared_bitmap_manager_.get(), | 2739 output_surface.get(), shared_bitmap_manager_.get(), |
2732 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, | 2740 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, |
2733 use_image_texture_targets_)); | 2741 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
2734 | 2742 |
2735 uint32 release_sync_point = 0; | 2743 uint32 release_sync_point = 0; |
2736 bool lost_resource = false; | 2744 bool lost_resource = false; |
2737 BlockingTaskRunner* main_thread_task_runner = NULL; | 2745 BlockingTaskRunner* main_thread_task_runner = NULL; |
2738 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2746 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2739 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2747 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
2740 &release_sync_point, | 2748 &release_sync_point, |
2741 &lost_resource, | 2749 &lost_resource, |
2742 &main_thread_task_runner)); | 2750 &main_thread_task_runner)); |
2743 TextureMailbox mailbox(shared_bitmap.get(), size); | 2751 TextureMailbox mailbox(shared_bitmap.get(), size); |
(...skipping 28 matching lines...) Expand all Loading... |
2772 new TextureStateTrackingContext); | 2780 new TextureStateTrackingContext); |
2773 TextureStateTrackingContext* context = context_owned.get(); | 2781 TextureStateTrackingContext* context = context_owned.get(); |
2774 | 2782 |
2775 FakeOutputSurfaceClient output_surface_client; | 2783 FakeOutputSurfaceClient output_surface_client; |
2776 scoped_ptr<OutputSurface> output_surface( | 2784 scoped_ptr<OutputSurface> output_surface( |
2777 FakeOutputSurface::Create3d(context_owned.Pass())); | 2785 FakeOutputSurface::Create3d(context_owned.Pass())); |
2778 CHECK(output_surface->BindToClient(&output_surface_client)); | 2786 CHECK(output_surface->BindToClient(&output_surface_client)); |
2779 | 2787 |
2780 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2788 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2781 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, | 2789 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, |
2782 main_thread_task_runner, 0, 1, use_image_texture_targets_)); | 2790 main_thread_task_runner, 0, 1, use_gpu_memory_buffer_resources_, |
| 2791 use_image_texture_targets_)); |
2783 | 2792 |
2784 unsigned texture_id = 1; | 2793 unsigned texture_id = 1; |
2785 uint32 sync_point = 30; | 2794 uint32 sync_point = 30; |
2786 unsigned target = GL_TEXTURE_2D; | 2795 unsigned target = GL_TEXTURE_2D; |
2787 | 2796 |
2788 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2797 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2789 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2798 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2790 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2799 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2791 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2800 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2792 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2801 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2916 TextureStateTrackingContext* context = context_owned.get(); | 2925 TextureStateTrackingContext* context = context_owned.get(); |
2917 | 2926 |
2918 FakeOutputSurfaceClient output_surface_client; | 2927 FakeOutputSurfaceClient output_surface_client; |
2919 scoped_ptr<OutputSurface> output_surface( | 2928 scoped_ptr<OutputSurface> output_surface( |
2920 FakeOutputSurface::Create3d(context_owned.Pass())); | 2929 FakeOutputSurface::Create3d(context_owned.Pass())); |
2921 CHECK(output_surface->BindToClient(&output_surface_client)); | 2930 CHECK(output_surface->BindToClient(&output_surface_client)); |
2922 | 2931 |
2923 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2932 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2924 output_surface.get(), shared_bitmap_manager_.get(), | 2933 output_surface.get(), shared_bitmap_manager_.get(), |
2925 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 2934 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2926 use_image_texture_targets_)); | 2935 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
2927 | 2936 |
2928 uint32 sync_point = 30; | 2937 uint32 sync_point = 30; |
2929 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2938 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
2930 | 2939 |
2931 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2940 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2932 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2941 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2933 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2942 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2934 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2943 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2935 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2944 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
2936 | 2945 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2986 TextureStateTrackingContext* context = context_owned.get(); | 2995 TextureStateTrackingContext* context = context_owned.get(); |
2987 | 2996 |
2988 FakeOutputSurfaceClient output_surface_client; | 2997 FakeOutputSurfaceClient output_surface_client; |
2989 scoped_ptr<OutputSurface> output_surface( | 2998 scoped_ptr<OutputSurface> output_surface( |
2990 FakeOutputSurface::Create3d(context_owned.Pass())); | 2999 FakeOutputSurface::Create3d(context_owned.Pass())); |
2991 CHECK(output_surface->BindToClient(&output_surface_client)); | 3000 CHECK(output_surface->BindToClient(&output_surface_client)); |
2992 | 3001 |
2993 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3002 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2994 output_surface.get(), shared_bitmap_manager_.get(), | 3003 output_surface.get(), shared_bitmap_manager_.get(), |
2995 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 3004 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2996 use_image_texture_targets_)); | 3005 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
2997 | 3006 |
2998 uint32 sync_point = 30; | 3007 uint32 sync_point = 30; |
2999 unsigned target = GL_TEXTURE_2D; | 3008 unsigned target = GL_TEXTURE_2D; |
3000 | 3009 |
3001 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3010 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
3002 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 3011 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
3003 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 3012 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
3004 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3013 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
3005 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3014 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
3006 | 3015 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3040 TextureStateTrackingContext* context = context_owned.get(); | 3049 TextureStateTrackingContext* context = context_owned.get(); |
3041 | 3050 |
3042 FakeOutputSurfaceClient output_surface_client; | 3051 FakeOutputSurfaceClient output_surface_client; |
3043 scoped_ptr<OutputSurface> output_surface( | 3052 scoped_ptr<OutputSurface> output_surface( |
3044 FakeOutputSurface::Create3d(context_owned.Pass())); | 3053 FakeOutputSurface::Create3d(context_owned.Pass())); |
3045 CHECK(output_surface->BindToClient(&output_surface_client)); | 3054 CHECK(output_surface->BindToClient(&output_surface_client)); |
3046 | 3055 |
3047 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3056 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3048 output_surface.get(), shared_bitmap_manager_.get(), | 3057 output_surface.get(), shared_bitmap_manager_.get(), |
3049 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 3058 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3050 use_image_texture_targets_)); | 3059 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
3051 | 3060 |
3052 uint32 sync_point = 0; | 3061 uint32 sync_point = 0; |
3053 unsigned target = GL_TEXTURE_2D; | 3062 unsigned target = GL_TEXTURE_2D; |
3054 | 3063 |
3055 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3064 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
3056 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 3065 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
3057 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 3066 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
3058 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3067 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
3059 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3068 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
3060 | 3069 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3161 AllocationTrackingContext3D* context = context_owned.get(); | 3170 AllocationTrackingContext3D* context = context_owned.get(); |
3162 | 3171 |
3163 FakeOutputSurfaceClient output_surface_client; | 3172 FakeOutputSurfaceClient output_surface_client; |
3164 scoped_ptr<OutputSurface> output_surface( | 3173 scoped_ptr<OutputSurface> output_surface( |
3165 FakeOutputSurface::Create3d(context_owned.Pass())); | 3174 FakeOutputSurface::Create3d(context_owned.Pass())); |
3166 CHECK(output_surface->BindToClient(&output_surface_client)); | 3175 CHECK(output_surface->BindToClient(&output_surface_client)); |
3167 | 3176 |
3168 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3177 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3169 output_surface.get(), shared_bitmap_manager_.get(), | 3178 output_surface.get(), shared_bitmap_manager_.get(), |
3170 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 3179 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3171 use_image_texture_targets_)); | 3180 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
3172 | 3181 |
3173 gfx::Size size(2, 2); | 3182 gfx::Size size(2, 2); |
3174 gfx::Vector2d offset(0, 0); | 3183 gfx::Vector2d offset(0, 0); |
3175 ResourceFormat format = RGBA_8888; | 3184 ResourceFormat format = RGBA_8888; |
3176 ResourceId id = 0; | 3185 ResourceId id = 0; |
3177 uint8_t pixels[16] = { 0 }; | 3186 uint8_t pixels[16] = { 0 }; |
3178 int texture_id = 123; | 3187 int texture_id = 123; |
3179 | 3188 |
3180 // Lazy allocation. Don't allocate when creating the resource. | 3189 // Lazy allocation. Don't allocate when creating the resource. |
3181 id = resource_provider->CreateResource( | 3190 id = resource_provider->CreateResource( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 context->set_support_texture_usage(true); | 3226 context->set_support_texture_usage(true); |
3218 | 3227 |
3219 FakeOutputSurfaceClient output_surface_client; | 3228 FakeOutputSurfaceClient output_surface_client; |
3220 scoped_ptr<OutputSurface> output_surface( | 3229 scoped_ptr<OutputSurface> output_surface( |
3221 FakeOutputSurface::Create3d(context_owned.Pass())); | 3230 FakeOutputSurface::Create3d(context_owned.Pass())); |
3222 CHECK(output_surface->BindToClient(&output_surface_client)); | 3231 CHECK(output_surface->BindToClient(&output_surface_client)); |
3223 | 3232 |
3224 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3233 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3225 output_surface.get(), shared_bitmap_manager_.get(), | 3234 output_surface.get(), shared_bitmap_manager_.get(), |
3226 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 3235 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3227 use_image_texture_targets_)); | 3236 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
3228 | 3237 |
3229 gfx::Size size(2, 2); | 3238 gfx::Size size(2, 2); |
3230 | 3239 |
3231 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3240 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3232 const ResourceProvider::TextureHint hints[4] = { | 3241 const ResourceProvider::TextureHint hints[4] = { |
3233 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3242 ResourceProvider::TEXTURE_HINT_DEFAULT, |
3234 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3243 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3235 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3244 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
3236 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3245 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
3237 }; | 3246 }; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3273 context->set_support_texture_usage(true); | 3282 context->set_support_texture_usage(true); |
3274 | 3283 |
3275 FakeOutputSurfaceClient output_surface_client; | 3284 FakeOutputSurfaceClient output_surface_client; |
3276 scoped_ptr<OutputSurface> output_surface( | 3285 scoped_ptr<OutputSurface> output_surface( |
3277 FakeOutputSurface::Create3d(context_owned.Pass())); | 3286 FakeOutputSurface::Create3d(context_owned.Pass())); |
3278 CHECK(output_surface->BindToClient(&output_surface_client)); | 3287 CHECK(output_surface->BindToClient(&output_surface_client)); |
3279 | 3288 |
3280 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3289 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3281 output_surface.get(), shared_bitmap_manager_.get(), | 3290 output_surface.get(), shared_bitmap_manager_.get(), |
3282 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 3291 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3283 use_image_texture_targets_)); | 3292 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
3284 | 3293 |
3285 gfx::Size size(2, 2); | 3294 gfx::Size size(2, 2); |
3286 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3295 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3287 | 3296 |
3288 const ResourceProvider::TextureHint hints[4] = { | 3297 const ResourceProvider::TextureHint hints[4] = { |
3289 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3298 ResourceProvider::TEXTURE_HINT_DEFAULT, |
3290 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3299 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3291 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3300 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
3292 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3301 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
3293 }; | 3302 }; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3332 const int kHeight = 2; | 3341 const int kHeight = 2; |
3333 gfx::Size size(kWidth, kHeight); | 3342 gfx::Size size(kWidth, kHeight); |
3334 ResourceFormat format = RGBA_8888; | 3343 ResourceFormat format = RGBA_8888; |
3335 ResourceId id = 0; | 3344 ResourceId id = 0; |
3336 const unsigned kTextureId = 123u; | 3345 const unsigned kTextureId = 123u; |
3337 const unsigned kImageId = 234u; | 3346 const unsigned kImageId = 234u; |
3338 | 3347 |
3339 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3348 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3340 output_surface.get(), shared_bitmap_manager_.get(), | 3349 output_surface.get(), shared_bitmap_manager_.get(), |
3341 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 3350 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3342 use_image_texture_targets_)); | 3351 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
3343 | 3352 |
3344 id = resource_provider->CreateResource( | 3353 id = resource_provider->CreateResource( |
3345 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3354 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3346 | 3355 |
3347 EXPECT_CALL(*context, NextTextureId()) | 3356 EXPECT_CALL(*context, NextTextureId()) |
3348 .WillOnce(Return(kTextureId)) | 3357 .WillOnce(Return(kTextureId)) |
3349 .RetiresOnSaturation(); | 3358 .RetiresOnSaturation(); |
3350 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) | 3359 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) |
3351 .Times(1) | 3360 .Times(3) |
3352 .RetiresOnSaturation(); | 3361 .RetiresOnSaturation(); |
3353 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) | 3362 EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) |
3354 .WillOnce(Return(kImageId)) | 3363 .WillOnce(Return(kImageId)) |
3355 .RetiresOnSaturation(); | 3364 .RetiresOnSaturation(); |
3356 { | 3365 { |
3357 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 3366 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
3358 resource_provider.get(), id); | 3367 resource_provider.get(), id); |
3359 EXPECT_TRUE(lock.GetGpuMemoryBuffer()); | 3368 EXPECT_TRUE(lock.GetGpuMemoryBuffer()); |
3360 } | 3369 } |
3361 | 3370 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3410 | 3419 |
3411 FakeOutputSurfaceClient output_surface_client; | 3420 FakeOutputSurfaceClient output_surface_client; |
3412 scoped_ptr<OutputSurface> output_surface( | 3421 scoped_ptr<OutputSurface> output_surface( |
3413 FakeOutputSurface::Create3d(context_owned.Pass())); | 3422 FakeOutputSurface::Create3d(context_owned.Pass())); |
3414 CHECK(output_surface->BindToClient(&output_surface_client)); | 3423 CHECK(output_surface->BindToClient(&output_surface_client)); |
3415 | 3424 |
3416 gfx::Size size(4, 4); | 3425 gfx::Size size(4, 4); |
3417 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3426 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3418 output_surface.get(), shared_bitmap_manager_.get(), | 3427 output_surface.get(), shared_bitmap_manager_.get(), |
3419 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 3428 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3420 use_image_texture_targets_)); | 3429 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
3421 int texture_id = 123; | 3430 int texture_id = 123; |
3422 | 3431 |
3423 ResourceId id = resource_provider->CreateResource( | 3432 ResourceId id = resource_provider->CreateResource( |
3424 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3433 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
3425 EXPECT_NE(0u, id); | 3434 EXPECT_NE(0u, id); |
3426 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3435 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3427 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3436 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3428 resource_provider->AllocateForTesting(id); | 3437 resource_provider->AllocateForTesting(id); |
3429 | 3438 |
3430 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); | 3439 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); |
(...skipping 11 matching lines...) Expand all Loading... |
3442 | 3451 |
3443 FakeOutputSurfaceClient output_surface_client; | 3452 FakeOutputSurfaceClient output_surface_client; |
3444 scoped_ptr<OutputSurface> output_surface( | 3453 scoped_ptr<OutputSurface> output_surface( |
3445 FakeOutputSurface::Create3d(context_owned.Pass())); | 3454 FakeOutputSurface::Create3d(context_owned.Pass())); |
3446 CHECK(output_surface->BindToClient(&output_surface_client)); | 3455 CHECK(output_surface->BindToClient(&output_surface_client)); |
3447 | 3456 |
3448 gfx::Size size(4, 4); | 3457 gfx::Size size(4, 4); |
3449 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3458 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3450 output_surface.get(), shared_bitmap_manager_.get(), | 3459 output_surface.get(), shared_bitmap_manager_.get(), |
3451 gpu_memory_buffer_manager_.get(), NULL, 0, 1, | 3460 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3452 use_image_texture_targets_)); | 3461 use_gpu_memory_buffer_resources_, use_image_texture_targets_)); |
3453 int texture_id = 123; | 3462 int texture_id = 123; |
3454 uint8_t pixels[8]; | 3463 uint8_t pixels[8]; |
3455 | 3464 |
3456 ResourceId id = resource_provider->CreateResource( | 3465 ResourceId id = resource_provider->CreateResource( |
3457 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3466 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
3458 EXPECT_NE(0u, id); | 3467 EXPECT_NE(0u, id); |
3459 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3468 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3460 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); | 3469 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); |
3461 EXPECT_CALL(*context, | 3470 EXPECT_CALL(*context, |
3462 compressedTexImage2D( | 3471 compressedTexImage2D( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 new TestSharedBitmapManager()); | 3508 new TestSharedBitmapManager()); |
3500 | 3509 |
3501 gfx::Size size(1, 1); | 3510 gfx::Size size(1, 1); |
3502 ResourceFormat format = RGBA_8888; | 3511 ResourceFormat format = RGBA_8888; |
3503 | 3512 |
3504 { | 3513 { |
3505 size_t kTextureAllocationChunkSize = 1; | 3514 size_t kTextureAllocationChunkSize = 1; |
3506 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3515 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3507 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, | 3516 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, |
3508 kTextureAllocationChunkSize, | 3517 kTextureAllocationChunkSize, |
| 3518 ResourceProviderTest::use_gpu_memory_buffer_resources(), |
3509 ResourceProviderTest::use_image_texture_targets())); | 3519 ResourceProviderTest::use_image_texture_targets())); |
3510 | 3520 |
3511 ResourceId id = resource_provider->CreateResource( | 3521 ResourceId id = resource_provider->CreateResource( |
3512 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3522 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3513 resource_provider->AllocateForTesting(id); | 3523 resource_provider->AllocateForTesting(id); |
3514 Mock::VerifyAndClearExpectations(context); | 3524 Mock::VerifyAndClearExpectations(context); |
3515 | 3525 |
3516 DCHECK_EQ(2u, context->PeekTextureId()); | 3526 DCHECK_EQ(2u, context->PeekTextureId()); |
3517 resource_provider->DeleteResource(id); | 3527 resource_provider->DeleteResource(id); |
3518 } | 3528 } |
3519 | 3529 |
3520 { | 3530 { |
3521 size_t kTextureAllocationChunkSize = 8; | 3531 size_t kTextureAllocationChunkSize = 8; |
3522 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3532 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3523 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, | 3533 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, |
3524 kTextureAllocationChunkSize, | 3534 kTextureAllocationChunkSize, |
| 3535 ResourceProviderTest::use_gpu_memory_buffer_resources(), |
3525 ResourceProviderTest::use_image_texture_targets())); | 3536 ResourceProviderTest::use_image_texture_targets())); |
3526 | 3537 |
3527 ResourceId id = resource_provider->CreateResource( | 3538 ResourceId id = resource_provider->CreateResource( |
3528 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3539 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3529 resource_provider->AllocateForTesting(id); | 3540 resource_provider->AllocateForTesting(id); |
3530 Mock::VerifyAndClearExpectations(context); | 3541 Mock::VerifyAndClearExpectations(context); |
3531 | 3542 |
3532 DCHECK_EQ(10u, context->PeekTextureId()); | 3543 DCHECK_EQ(10u, context->PeekTextureId()); |
3533 resource_provider->DeleteResource(id); | 3544 resource_provider->DeleteResource(id); |
3534 } | 3545 } |
3535 } | 3546 } |
3536 | 3547 |
3537 } // namespace | 3548 } // namespace |
3538 } // namespace cc | 3549 } // namespace cc |
OLD | NEW |