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