Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: cc/resources/resource_provider_unittest.cc

Issue 1251693003: cc: Fix the format of GpuMemoryBuffer for SurfaceTexture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/surfaces/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "cc/base/scoped_ptr_deque.h" 16 #include "cc/base/scoped_ptr_deque.h"
16 #include "cc/output/output_surface.h" 17 #include "cc/output/output_surface.h"
17 #include "cc/resources/returned_resource.h" 18 #include "cc/resources/returned_resource.h"
18 #include "cc/resources/shared_bitmap_manager.h" 19 #include "cc/resources/shared_bitmap_manager.h"
19 #include "cc/resources/single_release_callback.h" 20 #include "cc/resources/single_release_callback.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 415 }
415 CHECK(output_surface_->BindToClient(&output_surface_client_)); 416 CHECK(output_surface_->BindToClient(&output_surface_client_));
416 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); 417 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_));
417 418
418 shared_bitmap_manager_.reset(new TestSharedBitmapManager); 419 shared_bitmap_manager_.reset(new TestSharedBitmapManager);
419 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); 420 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager);
420 421
421 resource_provider_ = ResourceProvider::Create( 422 resource_provider_ = ResourceProvider::Create(
422 output_surface_.get(), shared_bitmap_manager_.get(), 423 output_surface_.get(), shared_bitmap_manager_.get(),
423 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 424 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0,
424 false, 1, false); 425 false, 1, false, use_image_texture_targets_);
425 child_resource_provider_ = ResourceProvider::Create( 426 child_resource_provider_ = ResourceProvider::Create(
426 child_output_surface_.get(), shared_bitmap_manager_.get(), 427 child_output_surface_.get(), shared_bitmap_manager_.get(),
427 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 428 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0,
428 false, 1, false); 429 false, 1, false, use_image_texture_targets_);
429 } 430 }
430 431
431 ResourceProviderTest() : ResourceProviderTest(true) {} 432 ResourceProviderTest() : ResourceProviderTest(true) {}
432 433
433 static void CollectResources(ReturnedResourceArray* array, 434 static void CollectResources(ReturnedResourceArray* array,
434 const ReturnedResourceArray& returned, 435 const ReturnedResourceArray& returned,
435 BlockingTaskRunner* main_thread_task_runner) { 436 BlockingTaskRunner* main_thread_task_runner) {
436 array->insert(array->end(), returned.begin(), returned.end()); 437 array->insert(array->end(), returned.begin(), returned.end());
437 } 438 }
438 439
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 SharedBitmap* shared_bitmap_ptr = shared_bitmap.get(); 479 SharedBitmap* shared_bitmap_ptr = shared_bitmap.get();
479 scoped_ptr<SingleReleaseCallbackImpl> callback = 480 scoped_ptr<SingleReleaseCallbackImpl> callback =
480 SingleReleaseCallbackImpl::Create(base::Bind( 481 SingleReleaseCallbackImpl::Create(base::Bind(
481 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), 482 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap),
482 release_called, release_sync_point, lost_resource)); 483 release_called, release_sync_point, lost_resource));
483 return child_resource_provider_->CreateResourceFromTextureMailbox( 484 return child_resource_provider_->CreateResourceFromTextureMailbox(
484 TextureMailbox(shared_bitmap_ptr, size), callback.Pass()); 485 TextureMailbox(shared_bitmap_ptr, size), callback.Pass());
485 } 486 }
486 } 487 }
487 488
489 public:
490 static std::vector<unsigned> use_image_texture_targets() {
491 return use_image_texture_targets_;
492 }
493
488 protected: 494 protected:
495 static std::vector<unsigned> use_image_texture_targets_;
489 scoped_ptr<ContextSharedData> shared_data_; 496 scoped_ptr<ContextSharedData> shared_data_;
490 ResourceProviderContext* context3d_; 497 ResourceProviderContext* context3d_;
491 ResourceProviderContext* child_context_; 498 ResourceProviderContext* child_context_;
492 FakeOutputSurfaceClient output_surface_client_; 499 FakeOutputSurfaceClient output_surface_client_;
493 FakeOutputSurfaceClient child_output_surface_client_; 500 FakeOutputSurfaceClient child_output_surface_client_;
494 scoped_ptr<OutputSurface> output_surface_; 501 scoped_ptr<OutputSurface> output_surface_;
495 scoped_ptr<OutputSurface> child_output_surface_; 502 scoped_ptr<OutputSurface> child_output_surface_;
496 scoped_ptr<BlockingTaskRunner> main_thread_task_runner_; 503 scoped_ptr<BlockingTaskRunner> main_thread_task_runner_;
497 scoped_ptr<ResourceProvider> resource_provider_; 504 scoped_ptr<ResourceProvider> resource_provider_;
498 scoped_ptr<ResourceProvider> child_resource_provider_; 505 scoped_ptr<ResourceProvider> child_resource_provider_;
499 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; 506 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_;
500 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; 507 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
501 }; 508 };
502 509
510 std::vector<unsigned> ResourceProviderTest::use_image_texture_targets_ =
511 std::vector<unsigned>(static_cast<size_t>(gfx::BufferFormat::LAST) + 1,
512 GL_TEXTURE_2D);
513
503 void CheckCreateResource(ResourceProvider::ResourceType expected_default_type, 514 void CheckCreateResource(ResourceProvider::ResourceType expected_default_type,
504 ResourceProvider* resource_provider, 515 ResourceProvider* resource_provider,
505 ResourceProviderContext* context) { 516 ResourceProviderContext* context) {
506 DCHECK_EQ(expected_default_type, resource_provider->default_resource_type()); 517 DCHECK_EQ(expected_default_type, resource_provider->default_resource_type());
507 518
508 gfx::Size size(1, 1); 519 gfx::Size size(1, 1);
509 ResourceFormat format = RGBA_8888; 520 ResourceFormat format = RGBA_8888;
510 size_t pixel_size = TextureSizeBytes(size, format); 521 size_t pixel_size = TextureSizeBytes(size, format);
511 ASSERT_EQ(4U, pixel_size); 522 ASSERT_EQ(4U, pixel_size);
512 523
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 scoped_ptr<ResourceProviderContext> child_context_owned( 1371 scoped_ptr<ResourceProviderContext> child_context_owned(
1361 ResourceProviderContext::Create(shared_data_.get())); 1372 ResourceProviderContext::Create(shared_data_.get()));
1362 1373
1363 FakeOutputSurfaceClient child_output_surface_client; 1374 FakeOutputSurfaceClient child_output_surface_client;
1364 scoped_ptr<OutputSurface> child_output_surface( 1375 scoped_ptr<OutputSurface> child_output_surface(
1365 FakeOutputSurface::Create3d(child_context_owned.Pass())); 1376 FakeOutputSurface::Create3d(child_context_owned.Pass()));
1366 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); 1377 CHECK(child_output_surface->BindToClient(&child_output_surface_client));
1367 1378
1368 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( 1379 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create(
1369 child_output_surface.get(), shared_bitmap_manager_.get(), 1380 child_output_surface.get(), shared_bitmap_manager_.get(),
1370 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 1381 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
1382 use_image_texture_targets_));
1371 1383
1372 gfx::Size size(1, 1); 1384 gfx::Size size(1, 1);
1373 ResourceFormat format = RGBA_8888; 1385 ResourceFormat format = RGBA_8888;
1374 size_t pixel_size = TextureSizeBytes(size, format); 1386 size_t pixel_size = TextureSizeBytes(size, format);
1375 ASSERT_EQ(4U, pixel_size); 1387 ASSERT_EQ(4U, pixel_size);
1376 1388
1377 ResourceId id1 = child_resource_provider->CreateResource( 1389 ResourceId id1 = child_resource_provider->CreateResource(
1378 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 1390 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
1379 uint8_t data1[4] = { 1, 2, 3, 4 }; 1391 uint8_t data1[4] = { 1, 2, 3, 4 };
1380 child_resource_provider->CopyToResource(id1, data1, size); 1392 child_resource_provider->CopyToResource(id1, data1, size);
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 FakeOutputSurfaceClient child_output_surface_client; 1856 FakeOutputSurfaceClient child_output_surface_client;
1845 scoped_ptr<OutputSurface> child_output_surface( 1857 scoped_ptr<OutputSurface> child_output_surface(
1846 FakeOutputSurface::Create3d(child_context_owned.Pass())); 1858 FakeOutputSurface::Create3d(child_context_owned.Pass()));
1847 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); 1859 CHECK(child_output_surface->BindToClient(&child_output_surface_client));
1848 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 1860 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
1849 new TestSharedBitmapManager()); 1861 new TestSharedBitmapManager());
1850 1862
1851 scoped_ptr<ResourceProvider> child_resource_provider( 1863 scoped_ptr<ResourceProvider> child_resource_provider(
1852 ResourceProvider::Create(child_output_surface.get(), 1864 ResourceProvider::Create(child_output_surface.get(),
1853 shared_bitmap_manager.get(), NULL, NULL, 0, 1865 shared_bitmap_manager.get(), NULL, NULL, 0,
1854 false, 1, false)); 1866 false, 1, false, use_image_texture_targets_));
1855 1867
1856 scoped_ptr<TextureStateTrackingContext> parent_context_owned( 1868 scoped_ptr<TextureStateTrackingContext> parent_context_owned(
1857 new TextureStateTrackingContext); 1869 new TextureStateTrackingContext);
1858 TextureStateTrackingContext* parent_context = parent_context_owned.get(); 1870 TextureStateTrackingContext* parent_context = parent_context_owned.get();
1859 1871
1860 FakeOutputSurfaceClient parent_output_surface_client; 1872 FakeOutputSurfaceClient parent_output_surface_client;
1861 scoped_ptr<OutputSurface> parent_output_surface( 1873 scoped_ptr<OutputSurface> parent_output_surface(
1862 FakeOutputSurface::Create3d(parent_context_owned.Pass())); 1874 FakeOutputSurface::Create3d(parent_context_owned.Pass()));
1863 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); 1875 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client));
1864 1876
1865 scoped_ptr<ResourceProvider> parent_resource_provider( 1877 scoped_ptr<ResourceProvider> parent_resource_provider(
1866 ResourceProvider::Create(parent_output_surface.get(), 1878 ResourceProvider::Create(parent_output_surface.get(),
1867 shared_bitmap_manager.get(), NULL, NULL, 0, 1879 shared_bitmap_manager.get(), NULL, NULL, 0,
1868 false, 1, false)); 1880 false, 1, false, use_image_texture_targets_));
1869 1881
1870 gfx::Size size(1, 1); 1882 gfx::Size size(1, 1);
1871 ResourceFormat format = RGBA_8888; 1883 ResourceFormat format = RGBA_8888;
1872 int child_texture_id = 1; 1884 int child_texture_id = 1;
1873 int parent_texture_id = 2; 1885 int parent_texture_id = 2;
1874 1886
1875 size_t pixel_size = TextureSizeBytes(size, format); 1887 size_t pixel_size = TextureSizeBytes(size, format);
1876 ASSERT_EQ(4U, pixel_size); 1888 ASSERT_EQ(4U, pixel_size);
1877 1889
1878 ResourceId id = child_resource_provider->CreateResource( 1890 ResourceId id = child_resource_provider->CreateResource(
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 new TextureStateTrackingContext); 2502 new TextureStateTrackingContext);
2491 TextureStateTrackingContext* context = context_owned.get(); 2503 TextureStateTrackingContext* context = context_owned.get();
2492 2504
2493 FakeOutputSurfaceClient output_surface_client; 2505 FakeOutputSurfaceClient output_surface_client;
2494 scoped_ptr<OutputSurface> output_surface( 2506 scoped_ptr<OutputSurface> output_surface(
2495 FakeOutputSurface::Create3d(context_owned.Pass())); 2507 FakeOutputSurface::Create3d(context_owned.Pass()));
2496 CHECK(output_surface->BindToClient(&output_surface_client)); 2508 CHECK(output_surface->BindToClient(&output_surface_client));
2497 2509
2498 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2510 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2499 output_surface.get(), shared_bitmap_manager_.get(), 2511 output_surface.get(), shared_bitmap_manager_.get(),
2500 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 2512 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
2513 use_image_texture_targets_));
2501 2514
2502 gfx::Size size(1, 1); 2515 gfx::Size size(1, 1);
2503 ResourceFormat format = RGBA_8888; 2516 ResourceFormat format = RGBA_8888;
2504 int texture_id = 1; 2517 int texture_id = 1;
2505 2518
2506 ResourceId id = resource_provider->CreateResource( 2519 ResourceId id = resource_provider->CreateResource(
2507 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 2520 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
2508 2521
2509 // Check that the texture gets created with the right sampler settings. 2522 // Check that the texture gets created with the right sampler settings.
2510 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) 2523 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id))
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 new TextureStateTrackingContext); 2585 new TextureStateTrackingContext);
2573 TextureStateTrackingContext* context = context_owned.get(); 2586 TextureStateTrackingContext* context = context_owned.get();
2574 2587
2575 FakeOutputSurfaceClient output_surface_client; 2588 FakeOutputSurfaceClient output_surface_client;
2576 scoped_ptr<OutputSurface> output_surface( 2589 scoped_ptr<OutputSurface> output_surface(
2577 FakeOutputSurface::Create3d(context_owned.Pass())); 2590 FakeOutputSurface::Create3d(context_owned.Pass()));
2578 CHECK(output_surface->BindToClient(&output_surface_client)); 2591 CHECK(output_surface->BindToClient(&output_surface_client));
2579 2592
2580 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2593 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2581 output_surface.get(), shared_bitmap_manager_.get(), 2594 output_surface.get(), shared_bitmap_manager_.get(),
2582 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 2595 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
2596 use_image_texture_targets_));
2583 2597
2584 gfx::Size size(1, 1); 2598 gfx::Size size(1, 1);
2585 ResourceFormat format = RGBA_8888; 2599 ResourceFormat format = RGBA_8888;
2586 int texture_id = 1; 2600 int texture_id = 1;
2587 2601
2588 // Check that the texture gets created with the right sampler settings. 2602 // Check that the texture gets created with the right sampler settings.
2589 ResourceId id = resource_provider->CreateManagedResource( 2603 ResourceId id = resource_provider->CreateManagedResource(
2590 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, 2604 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
2591 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 2605 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
2592 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); 2606 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
(...skipping 26 matching lines...) Expand all
2619 new TextureStateTrackingContext); 2633 new TextureStateTrackingContext);
2620 TextureStateTrackingContext* context = context_owned.get(); 2634 TextureStateTrackingContext* context = context_owned.get();
2621 2635
2622 FakeOutputSurfaceClient output_surface_client; 2636 FakeOutputSurfaceClient output_surface_client;
2623 scoped_ptr<OutputSurface> output_surface( 2637 scoped_ptr<OutputSurface> output_surface(
2624 FakeOutputSurface::Create3d(context_owned.Pass())); 2638 FakeOutputSurface::Create3d(context_owned.Pass()));
2625 CHECK(output_surface->BindToClient(&output_surface_client)); 2639 CHECK(output_surface->BindToClient(&output_surface_client));
2626 2640
2627 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2641 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2628 output_surface.get(), shared_bitmap_manager_.get(), 2642 output_surface.get(), shared_bitmap_manager_.get(),
2629 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 2643 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
2644 use_image_texture_targets_));
2630 2645
2631 gfx::Size size(1, 1); 2646 gfx::Size size(1, 1);
2632 ResourceFormat format = RGBA_8888; 2647 ResourceFormat format = RGBA_8888;
2633 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; 2648 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM;
2634 2649
2635 for (int texture_id = 1; texture_id <= 2; ++texture_id) { 2650 for (int texture_id = 1; texture_id <= 2; ++texture_id) {
2636 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; 2651 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT;
2637 // Check that the texture gets created with the right sampler settings. 2652 // Check that the texture gets created with the right sampler settings.
2638 ResourceId id = resource_provider->CreateGLTexture( 2653 ResourceId id = resource_provider->CreateGLTexture(
2639 size, GL_TEXTURE_2D, texture_pool, wrap_mode, 2654 size, GL_TEXTURE_2D, texture_pool, wrap_mode,
(...skipping 29 matching lines...) Expand all
2669 context->set_support_texture_storage(true); 2684 context->set_support_texture_storage(true);
2670 context->set_support_texture_usage(true); 2685 context->set_support_texture_usage(true);
2671 2686
2672 FakeOutputSurfaceClient output_surface_client; 2687 FakeOutputSurfaceClient output_surface_client;
2673 scoped_ptr<OutputSurface> output_surface( 2688 scoped_ptr<OutputSurface> output_surface(
2674 FakeOutputSurface::Create3d(context_owned.Pass())); 2689 FakeOutputSurface::Create3d(context_owned.Pass()));
2675 CHECK(output_surface->BindToClient(&output_surface_client)); 2690 CHECK(output_surface->BindToClient(&output_surface_client));
2676 2691
2677 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2692 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2678 output_surface.get(), shared_bitmap_manager_.get(), 2693 output_surface.get(), shared_bitmap_manager_.get(),
2679 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 2694 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
2695 use_image_texture_targets_));
2680 2696
2681 gfx::Size size(1, 1); 2697 gfx::Size size(1, 1);
2682 ResourceFormat format = RGBA_8888; 2698 ResourceFormat format = RGBA_8888;
2683 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; 2699 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM;
2684 2700
2685 const ResourceProvider::TextureHint hints[4] = { 2701 const ResourceProvider::TextureHint hints[4] = {
2686 ResourceProvider::TEXTURE_HINT_DEFAULT, 2702 ResourceProvider::TEXTURE_HINT_DEFAULT,
2687 ResourceProvider::TEXTURE_HINT_IMMUTABLE, 2703 ResourceProvider::TEXTURE_HINT_IMMUTABLE,
2688 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, 2704 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
2689 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, 2705 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 2750
2735 FakeOutputSurfaceClient output_surface_client; 2751 FakeOutputSurfaceClient output_surface_client;
2736 scoped_ptr<OutputSurface> output_surface( 2752 scoped_ptr<OutputSurface> output_surface(
2737 FakeOutputSurface::CreateSoftware(make_scoped_ptr( 2753 FakeOutputSurface::CreateSoftware(make_scoped_ptr(
2738 new SoftwareOutputDevice))); 2754 new SoftwareOutputDevice)));
2739 CHECK(output_surface->BindToClient(&output_surface_client)); 2755 CHECK(output_surface->BindToClient(&output_surface_client));
2740 2756
2741 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2757 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2742 output_surface.get(), shared_bitmap_manager_.get(), 2758 output_surface.get(), shared_bitmap_manager_.get(),
2743 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 2759 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0,
2744 false, 1, false)); 2760 false, 1, false, use_image_texture_targets_));
2745 2761
2746 uint32 release_sync_point = 0; 2762 uint32 release_sync_point = 0;
2747 bool lost_resource = false; 2763 bool lost_resource = false;
2748 BlockingTaskRunner* main_thread_task_runner = NULL; 2764 BlockingTaskRunner* main_thread_task_runner = NULL;
2749 scoped_ptr<SingleReleaseCallbackImpl> callback = 2765 scoped_ptr<SingleReleaseCallbackImpl> callback =
2750 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, 2766 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback,
2751 &release_sync_point, 2767 &release_sync_point,
2752 &lost_resource, 2768 &lost_resource,
2753 &main_thread_task_runner)); 2769 &main_thread_task_runner));
2754 TextureMailbox mailbox(shared_bitmap.get(), size); 2770 TextureMailbox mailbox(shared_bitmap.get(), size);
(...skipping 28 matching lines...) Expand all
2783 new TextureStateTrackingContext); 2799 new TextureStateTrackingContext);
2784 TextureStateTrackingContext* context = context_owned.get(); 2800 TextureStateTrackingContext* context = context_owned.get();
2785 2801
2786 FakeOutputSurfaceClient output_surface_client; 2802 FakeOutputSurfaceClient output_surface_client;
2787 scoped_ptr<OutputSurface> output_surface( 2803 scoped_ptr<OutputSurface> output_surface(
2788 FakeOutputSurface::Create3d(context_owned.Pass())); 2804 FakeOutputSurface::Create3d(context_owned.Pass()));
2789 CHECK(output_surface->BindToClient(&output_surface_client)); 2805 CHECK(output_surface->BindToClient(&output_surface_client));
2790 2806
2791 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2807 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2792 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, 2808 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager,
2793 main_thread_task_runner, 0, false, 1, false)); 2809 main_thread_task_runner, 0, false, 1, false,
2810 use_image_texture_targets_));
2794 2811
2795 unsigned texture_id = 1; 2812 unsigned texture_id = 1;
2796 uint32 sync_point = 30; 2813 uint32 sync_point = 30;
2797 unsigned target = GL_TEXTURE_2D; 2814 unsigned target = GL_TEXTURE_2D;
2798 2815
2799 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2816 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2800 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2817 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2801 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2818 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2802 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); 2819 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2803 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); 2820 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 new TextureStateTrackingContext); 2943 new TextureStateTrackingContext);
2927 TextureStateTrackingContext* context = context_owned.get(); 2944 TextureStateTrackingContext* context = context_owned.get();
2928 2945
2929 FakeOutputSurfaceClient output_surface_client; 2946 FakeOutputSurfaceClient output_surface_client;
2930 scoped_ptr<OutputSurface> output_surface( 2947 scoped_ptr<OutputSurface> output_surface(
2931 FakeOutputSurface::Create3d(context_owned.Pass())); 2948 FakeOutputSurface::Create3d(context_owned.Pass()));
2932 CHECK(output_surface->BindToClient(&output_surface_client)); 2949 CHECK(output_surface->BindToClient(&output_surface_client));
2933 2950
2934 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 2951 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
2935 output_surface.get(), shared_bitmap_manager_.get(), 2952 output_surface.get(), shared_bitmap_manager_.get(),
2936 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 2953 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
2954 use_image_texture_targets_));
2937 2955
2938 uint32 sync_point = 30; 2956 uint32 sync_point = 30;
2939 unsigned target = GL_TEXTURE_EXTERNAL_OES; 2957 unsigned target = GL_TEXTURE_EXTERNAL_OES;
2940 2958
2941 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2959 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2942 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2960 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2943 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2961 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2944 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); 2962 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2945 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); 2963 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0);
2946 2964
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 new TextureStateTrackingContext); 3013 new TextureStateTrackingContext);
2996 TextureStateTrackingContext* context = context_owned.get(); 3014 TextureStateTrackingContext* context = context_owned.get();
2997 3015
2998 FakeOutputSurfaceClient output_surface_client; 3016 FakeOutputSurfaceClient output_surface_client;
2999 scoped_ptr<OutputSurface> output_surface( 3017 scoped_ptr<OutputSurface> output_surface(
3000 FakeOutputSurface::Create3d(context_owned.Pass())); 3018 FakeOutputSurface::Create3d(context_owned.Pass()));
3001 CHECK(output_surface->BindToClient(&output_surface_client)); 3019 CHECK(output_surface->BindToClient(&output_surface_client));
3002 3020
3003 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3021 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3004 output_surface.get(), shared_bitmap_manager_.get(), 3022 output_surface.get(), shared_bitmap_manager_.get(),
3005 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3023 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3024 use_image_texture_targets_));
3006 3025
3007 uint32 sync_point = 30; 3026 uint32 sync_point = 30;
3008 unsigned target = GL_TEXTURE_2D; 3027 unsigned target = GL_TEXTURE_2D;
3009 3028
3010 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 3029 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
3011 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 3030 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
3012 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 3031 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
3013 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); 3032 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
3014 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); 3033 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0);
3015 3034
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 new TextureStateTrackingContext); 3067 new TextureStateTrackingContext);
3049 TextureStateTrackingContext* context = context_owned.get(); 3068 TextureStateTrackingContext* context = context_owned.get();
3050 3069
3051 FakeOutputSurfaceClient output_surface_client; 3070 FakeOutputSurfaceClient output_surface_client;
3052 scoped_ptr<OutputSurface> output_surface( 3071 scoped_ptr<OutputSurface> output_surface(
3053 FakeOutputSurface::Create3d(context_owned.Pass())); 3072 FakeOutputSurface::Create3d(context_owned.Pass()));
3054 CHECK(output_surface->BindToClient(&output_surface_client)); 3073 CHECK(output_surface->BindToClient(&output_surface_client));
3055 3074
3056 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3075 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3057 output_surface.get(), shared_bitmap_manager_.get(), 3076 output_surface.get(), shared_bitmap_manager_.get(),
3058 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3077 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3078 use_image_texture_targets_));
3059 3079
3060 uint32 sync_point = 0; 3080 uint32 sync_point = 0;
3061 unsigned target = GL_TEXTURE_2D; 3081 unsigned target = GL_TEXTURE_2D;
3062 3082
3063 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 3083 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
3064 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 3084 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
3065 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 3085 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
3066 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); 3086 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
3067 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); 3087 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0);
3068 3088
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3168 new StrictMock<AllocationTrackingContext3D>); 3188 new StrictMock<AllocationTrackingContext3D>);
3169 AllocationTrackingContext3D* context = context_owned.get(); 3189 AllocationTrackingContext3D* context = context_owned.get();
3170 3190
3171 FakeOutputSurfaceClient output_surface_client; 3191 FakeOutputSurfaceClient output_surface_client;
3172 scoped_ptr<OutputSurface> output_surface( 3192 scoped_ptr<OutputSurface> output_surface(
3173 FakeOutputSurface::Create3d(context_owned.Pass())); 3193 FakeOutputSurface::Create3d(context_owned.Pass()));
3174 CHECK(output_surface->BindToClient(&output_surface_client)); 3194 CHECK(output_surface->BindToClient(&output_surface_client));
3175 3195
3176 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3196 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3177 output_surface.get(), shared_bitmap_manager_.get(), 3197 output_surface.get(), shared_bitmap_manager_.get(),
3178 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3198 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3199 use_image_texture_targets_));
3179 3200
3180 gfx::Size size(2, 2); 3201 gfx::Size size(2, 2);
3181 gfx::Vector2d offset(0, 0); 3202 gfx::Vector2d offset(0, 0);
3182 ResourceFormat format = RGBA_8888; 3203 ResourceFormat format = RGBA_8888;
3183 ResourceId id = 0; 3204 ResourceId id = 0;
3184 uint8_t pixels[16] = { 0 }; 3205 uint8_t pixels[16] = { 0 };
3185 int texture_id = 123; 3206 int texture_id = 123;
3186 3207
3187 // Lazy allocation. Don't allocate when creating the resource. 3208 // Lazy allocation. Don't allocate when creating the resource.
3188 id = resource_provider->CreateResource( 3209 id = resource_provider->CreateResource(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 context->set_support_texture_storage(true); 3263 context->set_support_texture_storage(true);
3243 context->set_support_texture_usage(true); 3264 context->set_support_texture_usage(true);
3244 3265
3245 FakeOutputSurfaceClient output_surface_client; 3266 FakeOutputSurfaceClient output_surface_client;
3246 scoped_ptr<OutputSurface> output_surface( 3267 scoped_ptr<OutputSurface> output_surface(
3247 FakeOutputSurface::Create3d(context_owned.Pass())); 3268 FakeOutputSurface::Create3d(context_owned.Pass()));
3248 CHECK(output_surface->BindToClient(&output_surface_client)); 3269 CHECK(output_surface->BindToClient(&output_surface_client));
3249 3270
3250 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3271 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3251 output_surface.get(), shared_bitmap_manager_.get(), 3272 output_surface.get(), shared_bitmap_manager_.get(),
3252 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3273 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3274 use_image_texture_targets_));
3253 3275
3254 gfx::Size size(2, 2); 3276 gfx::Size size(2, 2);
3255 3277
3256 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; 3278 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888};
3257 const ResourceProvider::TextureHint hints[4] = { 3279 const ResourceProvider::TextureHint hints[4] = {
3258 ResourceProvider::TEXTURE_HINT_DEFAULT, 3280 ResourceProvider::TEXTURE_HINT_DEFAULT,
3259 ResourceProvider::TEXTURE_HINT_IMMUTABLE, 3281 ResourceProvider::TEXTURE_HINT_IMMUTABLE,
3260 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, 3282 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
3261 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, 3283 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
3262 }; 3284 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3297 context->set_support_texture_storage(true); 3319 context->set_support_texture_storage(true);
3298 context->set_support_texture_usage(true); 3320 context->set_support_texture_usage(true);
3299 3321
3300 FakeOutputSurfaceClient output_surface_client; 3322 FakeOutputSurfaceClient output_surface_client;
3301 scoped_ptr<OutputSurface> output_surface( 3323 scoped_ptr<OutputSurface> output_surface(
3302 FakeOutputSurface::Create3d(context_owned.Pass())); 3324 FakeOutputSurface::Create3d(context_owned.Pass()));
3303 CHECK(output_surface->BindToClient(&output_surface_client)); 3325 CHECK(output_surface->BindToClient(&output_surface_client));
3304 3326
3305 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3327 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3306 output_surface.get(), shared_bitmap_manager_.get(), 3328 output_surface.get(), shared_bitmap_manager_.get(),
3307 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3329 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3330 use_image_texture_targets_));
3308 3331
3309 gfx::Size size(2, 2); 3332 gfx::Size size(2, 2);
3310 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; 3333 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888};
3311 3334
3312 const ResourceProvider::TextureHint hints[4] = { 3335 const ResourceProvider::TextureHint hints[4] = {
3313 ResourceProvider::TEXTURE_HINT_DEFAULT, 3336 ResourceProvider::TEXTURE_HINT_DEFAULT,
3314 ResourceProvider::TEXTURE_HINT_IMMUTABLE, 3337 ResourceProvider::TEXTURE_HINT_IMMUTABLE,
3315 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, 3338 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER,
3316 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, 3339 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
3317 }; 3340 };
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3351 FakeOutputSurface::Create3d(context_owned.Pass())); 3374 FakeOutputSurface::Create3d(context_owned.Pass()));
3352 CHECK(output_surface->BindToClient(&output_surface_client)); 3375 CHECK(output_surface->BindToClient(&output_surface_client));
3353 3376
3354 gfx::Size size(2, 2); 3377 gfx::Size size(2, 2);
3355 ResourceFormat format = RGBA_8888; 3378 ResourceFormat format = RGBA_8888;
3356 ResourceId id = 0; 3379 ResourceId id = 0;
3357 int texture_id = 123; 3380 int texture_id = 123;
3358 3381
3359 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3382 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3360 output_surface.get(), shared_bitmap_manager_.get(), 3383 output_surface.get(), shared_bitmap_manager_.get(),
3361 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3384 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3385 use_image_texture_targets_));
3362 3386
3363 id = resource_provider->CreateResource( 3387 id = resource_provider->CreateResource(
3364 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 3388 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
3365 resource_provider->AcquirePixelBuffer(id); 3389 resource_provider->AcquirePixelBuffer(id);
3366 3390
3367 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 3391 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
3368 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); 3392 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
3369 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) 3393 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _))
3370 .Times(1); 3394 .Times(1);
3371 resource_provider->BeginSetPixels(id); 3395 resource_provider->BeginSetPixels(id);
(...skipping 21 matching lines...) Expand all
3393 FakeOutputSurface::Create3d(context_owned.Pass())); 3417 FakeOutputSurface::Create3d(context_owned.Pass()));
3394 CHECK(output_surface->BindToClient(&output_surface_client)); 3418 CHECK(output_surface->BindToClient(&output_surface_client));
3395 3419
3396 gfx::Size size(2, 2); 3420 gfx::Size size(2, 2);
3397 ResourceFormat format = RGBA_8888; 3421 ResourceFormat format = RGBA_8888;
3398 ResourceId id = 0; 3422 ResourceId id = 0;
3399 int texture_id = 123; 3423 int texture_id = 123;
3400 3424
3401 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3425 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3402 output_surface.get(), shared_bitmap_manager_.get(), 3426 output_surface.get(), shared_bitmap_manager_.get(),
3403 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3427 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3428 use_image_texture_targets_));
3404 3429
3405 id = resource_provider->CreateResource( 3430 id = resource_provider->CreateResource(
3406 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 3431 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
3407 resource_provider->AcquirePixelBuffer(id); 3432 resource_provider->AcquirePixelBuffer(id);
3408 3433
3409 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 3434 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
3410 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); 3435 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
3411 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _)) 3436 EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_, _, _, 2, 2, _, _, _, _))
3412 .Times(1); 3437 .Times(1);
3413 resource_provider->BeginSetPixels(id); 3438 resource_provider->BeginSetPixels(id);
(...skipping 21 matching lines...) Expand all
3435 FakeOutputSurface::Create3d(context_owned.Pass())); 3460 FakeOutputSurface::Create3d(context_owned.Pass()));
3436 CHECK(output_surface->BindToClient(&output_surface_client)); 3461 CHECK(output_surface->BindToClient(&output_surface_client));
3437 3462
3438 gfx::Size size(2, 2); 3463 gfx::Size size(2, 2);
3439 ResourceFormat format = RGBA_8888; 3464 ResourceFormat format = RGBA_8888;
3440 ResourceId id = 0; 3465 ResourceId id = 0;
3441 int texture_id = 123; 3466 int texture_id = 123;
3442 3467
3443 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3468 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3444 output_surface.get(), shared_bitmap_manager_.get(), 3469 output_surface.get(), shared_bitmap_manager_.get(),
3445 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3470 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3471 use_image_texture_targets_));
3446 3472
3447 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); 3473 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id));
3448 3474
3449 id = resource_provider->CreateResource( 3475 id = resource_provider->CreateResource(
3450 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 3476 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
3451 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, 3477 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
3452 GL_INNOCENT_CONTEXT_RESET_ARB); 3478 GL_INNOCENT_CONTEXT_RESET_ARB);
3453 3479
3454 resource_provider->AcquirePixelBuffer(id); 3480 resource_provider->AcquirePixelBuffer(id);
3455 int stride; 3481 int stride;
(...skipping 19 matching lines...) Expand all
3475 const int kWidth = 2; 3501 const int kWidth = 2;
3476 const int kHeight = 2; 3502 const int kHeight = 2;
3477 gfx::Size size(kWidth, kHeight); 3503 gfx::Size size(kWidth, kHeight);
3478 ResourceFormat format = RGBA_8888; 3504 ResourceFormat format = RGBA_8888;
3479 ResourceId id = 0; 3505 ResourceId id = 0;
3480 const unsigned kTextureId = 123u; 3506 const unsigned kTextureId = 123u;
3481 const unsigned kImageId = 234u; 3507 const unsigned kImageId = 234u;
3482 3508
3483 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3509 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3484 output_surface.get(), shared_bitmap_manager_.get(), 3510 output_surface.get(), shared_bitmap_manager_.get(),
3485 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3511 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3512 use_image_texture_targets_));
3486 3513
3487 id = resource_provider->CreateResource( 3514 id = resource_provider->CreateResource(
3488 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 3515 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
3489 3516
3490 EXPECT_CALL(*context, NextTextureId()) 3517 EXPECT_CALL(*context, NextTextureId())
3491 .WillOnce(Return(kTextureId)) 3518 .WillOnce(Return(kTextureId))
3492 .RetiresOnSaturation(); 3519 .RetiresOnSaturation();
3493 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) 3520 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId))
3494 .Times(1) 3521 .Times(1)
3495 .RetiresOnSaturation(); 3522 .RetiresOnSaturation();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3560 gfx::Size size(kWidth, kHeight); 3587 gfx::Size size(kWidth, kHeight);
3561 ResourceFormat format = RGBA_8888; 3588 ResourceFormat format = RGBA_8888;
3562 ResourceId source_id = 0; 3589 ResourceId source_id = 0;
3563 ResourceId dest_id = 0; 3590 ResourceId dest_id = 0;
3564 const unsigned kSourceTextureId = 123u; 3591 const unsigned kSourceTextureId = 123u;
3565 const unsigned kDestTextureId = 321u; 3592 const unsigned kDestTextureId = 321u;
3566 const unsigned kImageId = 234u; 3593 const unsigned kImageId = 234u;
3567 3594
3568 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3595 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3569 output_surface.get(), shared_bitmap_manager_.get(), 3596 output_surface.get(), shared_bitmap_manager_.get(),
3570 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3597 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3598 std::vector<unsigned>(static_cast<size_t>(gfx::BufferFormat::LAST) + 1,
3599 GL_TEXTURE_2D)));
3571 3600
3572 source_id = resource_provider->CreateResource( 3601 source_id = resource_provider->CreateResource(
3573 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); 3602 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format);
3574 3603
3575 EXPECT_CALL(*context, NextTextureId()) 3604 EXPECT_CALL(*context, NextTextureId())
3576 .WillOnce(Return(kSourceTextureId)) 3605 .WillOnce(Return(kSourceTextureId))
3577 .RetiresOnSaturation(); 3606 .RetiresOnSaturation();
3578 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kSourceTextureId)) 3607 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kSourceTextureId))
3579 .Times(1) 3608 .Times(1)
3580 .RetiresOnSaturation(); 3609 .RetiresOnSaturation();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3633 context_owned->set_support_compressed_texture_etc1(true); 3662 context_owned->set_support_compressed_texture_etc1(true);
3634 3663
3635 FakeOutputSurfaceClient output_surface_client; 3664 FakeOutputSurfaceClient output_surface_client;
3636 scoped_ptr<OutputSurface> output_surface( 3665 scoped_ptr<OutputSurface> output_surface(
3637 FakeOutputSurface::Create3d(context_owned.Pass())); 3666 FakeOutputSurface::Create3d(context_owned.Pass()));
3638 CHECK(output_surface->BindToClient(&output_surface_client)); 3667 CHECK(output_surface->BindToClient(&output_surface_client));
3639 3668
3640 gfx::Size size(4, 4); 3669 gfx::Size size(4, 4);
3641 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3670 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3642 output_surface.get(), shared_bitmap_manager_.get(), 3671 output_surface.get(), shared_bitmap_manager_.get(),
3643 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3672 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3673 use_image_texture_targets_));
3644 int texture_id = 123; 3674 int texture_id = 123;
3645 3675
3646 ResourceId id = resource_provider->CreateResource( 3676 ResourceId id = resource_provider->CreateResource(
3647 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); 3677 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1);
3648 EXPECT_NE(0u, id); 3678 EXPECT_NE(0u, id);
3649 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 3679 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
3650 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); 3680 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2);
3651 resource_provider->AllocateForTesting(id); 3681 resource_provider->AllocateForTesting(id);
3652 3682
3653 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1); 3683 EXPECT_CALL(*context, RetireTextureId(texture_id)).Times(1);
(...skipping 10 matching lines...) Expand all
3664 context_owned->set_support_compressed_texture_etc1(true); 3694 context_owned->set_support_compressed_texture_etc1(true);
3665 3695
3666 FakeOutputSurfaceClient output_surface_client; 3696 FakeOutputSurfaceClient output_surface_client;
3667 scoped_ptr<OutputSurface> output_surface( 3697 scoped_ptr<OutputSurface> output_surface(
3668 FakeOutputSurface::Create3d(context_owned.Pass())); 3698 FakeOutputSurface::Create3d(context_owned.Pass()));
3669 CHECK(output_surface->BindToClient(&output_surface_client)); 3699 CHECK(output_surface->BindToClient(&output_surface_client));
3670 3700
3671 gfx::Size size(4, 4); 3701 gfx::Size size(4, 4);
3672 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3702 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3673 output_surface.get(), shared_bitmap_manager_.get(), 3703 output_surface.get(), shared_bitmap_manager_.get(),
3674 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false)); 3704 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, false,
3705 use_image_texture_targets_));
3675 int texture_id = 123; 3706 int texture_id = 123;
3676 uint8_t pixels[8]; 3707 uint8_t pixels[8];
3677 3708
3678 ResourceId id = resource_provider->CreateResource( 3709 ResourceId id = resource_provider->CreateResource(
3679 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); 3710 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1);
3680 EXPECT_NE(0u, id); 3711 EXPECT_NE(0u, id);
3681 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); 3712 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id));
3682 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); 3713 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3);
3683 EXPECT_CALL(*context, 3714 EXPECT_CALL(*context,
3684 compressedTexImage2D( 3715 compressedTexImage2D(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 3751 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
3721 new TestSharedBitmapManager()); 3752 new TestSharedBitmapManager());
3722 3753
3723 gfx::Size size(1, 1); 3754 gfx::Size size(1, 1);
3724 ResourceFormat format = RGBA_8888; 3755 ResourceFormat format = RGBA_8888;
3725 3756
3726 { 3757 {
3727 size_t kTextureAllocationChunkSize = 1; 3758 size_t kTextureAllocationChunkSize = 1;
3728 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3759 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3729 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, 3760 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false,
3730 kTextureAllocationChunkSize, false)); 3761 kTextureAllocationChunkSize, false,
3762 ResourceProviderTest::use_image_texture_targets()));
3731 3763
3732 ResourceId id = resource_provider->CreateResource( 3764 ResourceId id = resource_provider->CreateResource(
3733 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, 3765 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
3734 format); 3766 format);
3735 resource_provider->AllocateForTesting(id); 3767 resource_provider->AllocateForTesting(id);
3736 Mock::VerifyAndClearExpectations(context); 3768 Mock::VerifyAndClearExpectations(context);
3737 3769
3738 DCHECK_EQ(2u, context->PeekTextureId()); 3770 DCHECK_EQ(2u, context->PeekTextureId());
3739 resource_provider->DeleteResource(id); 3771 resource_provider->DeleteResource(id);
3740 } 3772 }
3741 3773
3742 { 3774 {
3743 size_t kTextureAllocationChunkSize = 8; 3775 size_t kTextureAllocationChunkSize = 8;
3744 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( 3776 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create(
3745 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, 3777 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false,
3746 kTextureAllocationChunkSize, false)); 3778 kTextureAllocationChunkSize, false,
3779 ResourceProviderTest::use_image_texture_targets()));
3747 3780
3748 ResourceId id = resource_provider->CreateResource( 3781 ResourceId id = resource_provider->CreateResource(
3749 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, 3782 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
3750 format); 3783 format);
3751 resource_provider->AllocateForTesting(id); 3784 resource_provider->AllocateForTesting(id);
3752 Mock::VerifyAndClearExpectations(context); 3785 Mock::VerifyAndClearExpectations(context);
3753 3786
3754 DCHECK_EQ(10u, context->PeekTextureId()); 3787 DCHECK_EQ(10u, context->PeekTextureId());
3755 resource_provider->DeleteResource(id); 3788 resource_provider->DeleteResource(id);
3756 } 3789 }
3757 } 3790 }
3758 3791
3759 } // namespace 3792 } // namespace
3760 } // namespace cc 3793 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/surfaces/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698