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 <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 next_id_(1), | 1207 next_id_(1), |
1208 next_child_(1), | 1208 next_child_(1), |
1209 default_resource_type_(RESOURCE_TYPE_BITMAP), | 1209 default_resource_type_(RESOURCE_TYPE_BITMAP), |
1210 use_texture_storage_ext_(false), | 1210 use_texture_storage_ext_(false), |
1211 use_texture_format_bgra_(false), | 1211 use_texture_format_bgra_(false), |
1212 use_texture_usage_hint_(false), | 1212 use_texture_usage_hint_(false), |
1213 use_compressed_texture_etc1_(false), | 1213 use_compressed_texture_etc1_(false), |
1214 yuv_resource_format_(LUMINANCE_8), | 1214 yuv_resource_format_(LUMINANCE_8), |
1215 max_texture_size_(0), | 1215 max_texture_size_(0), |
1216 best_texture_format_(RGBA_8888), | 1216 best_texture_format_(RGBA_8888), |
| 1217 best_render_buffer_format_(RGBA_8888), |
1217 use_rgba_4444_texture_format_(use_rgba_4444_texture_format), | 1218 use_rgba_4444_texture_format_(use_rgba_4444_texture_format), |
1218 id_allocation_chunk_size_(id_allocation_chunk_size), | 1219 id_allocation_chunk_size_(id_allocation_chunk_size), |
1219 use_sync_query_(false), | 1220 use_sync_query_(false), |
1220 use_persistent_map_for_gpu_memory_buffers_( | 1221 use_persistent_map_for_gpu_memory_buffers_( |
1221 use_persistent_map_for_gpu_memory_buffers) { | 1222 use_persistent_map_for_gpu_memory_buffers) { |
1222 DCHECK(output_surface_->HasClient()); | 1223 DCHECK(output_surface_->HasClient()); |
1223 DCHECK(id_allocation_chunk_size_); | 1224 DCHECK(id_allocation_chunk_size_); |
1224 } | 1225 } |
1225 | 1226 |
1226 void ResourceProvider::Initialize() { | 1227 void ResourceProvider::Initialize() { |
(...skipping 22 matching lines...) Expand all Loading... |
1249 use_compressed_texture_etc1_ = caps.gpu.texture_format_etc1; | 1250 use_compressed_texture_etc1_ = caps.gpu.texture_format_etc1; |
1250 yuv_resource_format_ = caps.gpu.texture_rg ? RED_8 : LUMINANCE_8; | 1251 yuv_resource_format_ = caps.gpu.texture_rg ? RED_8 : LUMINANCE_8; |
1251 use_sync_query_ = caps.gpu.sync_query; | 1252 use_sync_query_ = caps.gpu.sync_query; |
1252 | 1253 |
1253 texture_uploader_ = TextureUploader::Create(gl); | 1254 texture_uploader_ = TextureUploader::Create(gl); |
1254 max_texture_size_ = 0; // Context expects cleared value. | 1255 max_texture_size_ = 0; // Context expects cleared value. |
1255 gl->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size_); | 1256 gl->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size_); |
1256 best_texture_format_ = | 1257 best_texture_format_ = |
1257 PlatformColor::BestTextureFormat(use_texture_format_bgra_); | 1258 PlatformColor::BestTextureFormat(use_texture_format_bgra_); |
1258 | 1259 |
| 1260 best_render_buffer_format_ = |
| 1261 PlatformColor::BestTextureFormat(caps.gpu.render_buffer_format_bgra8888); |
| 1262 |
1259 texture_id_allocator_.reset( | 1263 texture_id_allocator_.reset( |
1260 new TextureIdAllocator(gl, id_allocation_chunk_size_)); | 1264 new TextureIdAllocator(gl, id_allocation_chunk_size_)); |
1261 buffer_id_allocator_.reset( | 1265 buffer_id_allocator_.reset( |
1262 new BufferIdAllocator(gl, id_allocation_chunk_size_)); | 1266 new BufferIdAllocator(gl, id_allocation_chunk_size_)); |
1263 } | 1267 } |
1264 | 1268 |
1265 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) { | 1269 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) { |
1266 DCHECK(thread_checker_.CalledOnValidThread()); | 1270 DCHECK(thread_checker_.CalledOnValidThread()); |
1267 | 1271 |
1268 Child child_info; | 1272 Child child_info; |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 } | 2062 } |
2059 | 2063 |
2060 class GrContext* ResourceProvider::GrContext(bool worker_context) const { | 2064 class GrContext* ResourceProvider::GrContext(bool worker_context) const { |
2061 ContextProvider* context_provider = | 2065 ContextProvider* context_provider = |
2062 worker_context ? output_surface_->worker_context_provider() | 2066 worker_context ? output_surface_->worker_context_provider() |
2063 : output_surface_->context_provider(); | 2067 : output_surface_->context_provider(); |
2064 return context_provider ? context_provider->GrContext() : NULL; | 2068 return context_provider ? context_provider->GrContext() : NULL; |
2065 } | 2069 } |
2066 | 2070 |
2067 } // namespace cc | 2071 } // namespace cc |
OLD | NEW |