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

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

Issue 1513733003: Revert of Allow one-copy task tile worker pool to use compressed textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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.h ('k') | cc/test/layer_tree_pixel_resource_test.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 <limits> 8 #include <limits>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 itr != resources_.end(); ++itr) { 361 itr != resources_.end(); ++itr) {
362 DCHECK(!IsGpuResourceType(itr->second.type)); 362 DCHECK(!IsGpuResourceType(itr->second.type));
363 } 363 }
364 #endif // DCHECK_IS_ON() 364 #endif // DCHECK_IS_ON()
365 365
366 texture_id_allocator_ = nullptr; 366 texture_id_allocator_ = nullptr;
367 buffer_id_allocator_ = nullptr; 367 buffer_id_allocator_ = nullptr;
368 gl->Finish(); 368 gl->Finish();
369 } 369 }
370 370
371 bool ResourceProvider::IsResourceFormatSupported(ResourceFormat format) const {
372 const ContextProvider::Capabilities& caps =
373 output_surface_->context_provider()->ContextCapabilities();
374
375 switch (format) {
376 case ALPHA_8:
377 case RGBA_4444:
378 case RGBA_8888:
379 case RGB_565:
380 case LUMINANCE_8:
381 return true;
382 case BGRA_8888:
383 return caps.gpu.texture_format_bgra8888;
384 case ETC1:
385 return caps.gpu.texture_format_etc1;
386 case RED_8:
387 return caps.gpu.texture_rg;
388 }
389
390 NOTREACHED();
391 return false;
392 }
393
394 bool ResourceProvider::InUseByConsumer(ResourceId id) { 371 bool ResourceProvider::InUseByConsumer(ResourceId id) {
395 Resource* resource = GetResource(id); 372 Resource* resource = GetResource(id);
396 return resource->lock_for_read_count > 0 || resource->exported_count > 0 || 373 return resource->lock_for_read_count > 0 || resource->exported_count > 0 ||
397 resource->lost; 374 resource->lost;
398 } 375 }
399 376
400 bool ResourceProvider::IsLost(ResourceId id) { 377 bool ResourceProvider::IsLost(ResourceId id) {
401 Resource* resource = GetResource(id); 378 Resource* resource = GetResource(id);
402 return resource->lost; 379 return resource->lost;
403 } 380 }
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 use_texture_storage_ext_ = caps.gpu.texture_storage; 1060 use_texture_storage_ext_ = caps.gpu.texture_storage;
1084 use_texture_format_bgra_ = caps.gpu.texture_format_bgra8888; 1061 use_texture_format_bgra_ = caps.gpu.texture_format_bgra8888;
1085 use_texture_usage_hint_ = caps.gpu.texture_usage; 1062 use_texture_usage_hint_ = caps.gpu.texture_usage;
1086 use_compressed_texture_etc1_ = caps.gpu.texture_format_etc1; 1063 use_compressed_texture_etc1_ = caps.gpu.texture_format_etc1;
1087 yuv_resource_format_ = caps.gpu.texture_rg ? RED_8 : LUMINANCE_8; 1064 yuv_resource_format_ = caps.gpu.texture_rg ? RED_8 : LUMINANCE_8;
1088 use_sync_query_ = caps.gpu.sync_query; 1065 use_sync_query_ = caps.gpu.sync_query;
1089 1066
1090 max_texture_size_ = 0; // Context expects cleared value. 1067 max_texture_size_ = 0; // Context expects cleared value.
1091 gl->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size_); 1068 gl->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size_);
1092 best_texture_format_ = 1069 best_texture_format_ =
1093 PlatformColor::BestSupportedTextureFormat(use_texture_format_bgra_); 1070 PlatformColor::BestTextureFormat(use_texture_format_bgra_);
1094 1071
1095 best_render_buffer_format_ = PlatformColor::BestSupportedTextureFormat( 1072 best_render_buffer_format_ =
1096 caps.gpu.render_buffer_format_bgra8888); 1073 PlatformColor::BestTextureFormat(caps.gpu.render_buffer_format_bgra8888);
1097 1074
1098 texture_id_allocator_.reset( 1075 texture_id_allocator_.reset(
1099 new TextureIdAllocator(gl, id_allocation_chunk_size_)); 1076 new TextureIdAllocator(gl, id_allocation_chunk_size_));
1100 buffer_id_allocator_.reset( 1077 buffer_id_allocator_.reset(
1101 new BufferIdAllocator(gl, id_allocation_chunk_size_)); 1078 new BufferIdAllocator(gl, id_allocation_chunk_size_));
1102 } 1079 }
1103 1080
1104 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) { 1081 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) {
1105 DCHECK(thread_checker_.CalledOnValidThread()); 1082 DCHECK(thread_checker_.CalledOnValidThread());
1106 1083
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 const int kImportance = 2; 1661 const int kImportance = 2;
1685 pmd->CreateSharedGlobalAllocatorDump(guid); 1662 pmd->CreateSharedGlobalAllocatorDump(guid);
1686 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1663 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1687 } 1664 }
1688 } 1665 }
1689 1666
1690 return true; 1667 return true;
1691 } 1668 }
1692 1669
1693 } // namespace cc 1670 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/test/layer_tree_pixel_resource_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698