Chromium Code Reviews| Index: cc/raster/one_copy_tile_task_worker_pool.cc |
| diff --git a/cc/raster/one_copy_tile_task_worker_pool.cc b/cc/raster/one_copy_tile_task_worker_pool.cc |
| index 86a0561b1ca9ed585da8d4eabbf4bec62cdfa16d..6e9c4c84b2ad44c56e2897ed32de44987f0e7d90 100644 |
| --- a/cc/raster/one_copy_tile_task_worker_pool.cc |
| +++ b/cc/raster/one_copy_tile_task_worker_pool.cc |
| @@ -176,11 +176,13 @@ scoped_ptr<TileTaskWorkerPool> OneCopyTileTaskWorkerPool::Create( |
| int max_copy_texture_chromium_size, |
| bool use_persistent_gpu_memory_buffers, |
| int max_staging_buffer_usage_in_bytes, |
| - bool use_rgba_4444_texture_format) { |
| + bool use_rgba_4444_texture_format, |
| + bool use_compressed_texture_formats) { |
| return make_scoped_ptr<TileTaskWorkerPool>(new OneCopyTileTaskWorkerPool( |
| task_runner, task_graph_runner, resource_provider, |
| max_copy_texture_chromium_size, use_persistent_gpu_memory_buffers, |
| - max_staging_buffer_usage_in_bytes, use_rgba_4444_texture_format)); |
| + max_staging_buffer_usage_in_bytes, use_rgba_4444_texture_format, |
| + use_compressed_texture_formats)); |
| } |
| OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool( |
| @@ -190,7 +192,8 @@ OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool( |
| int max_copy_texture_chromium_size, |
| bool use_persistent_gpu_memory_buffers, |
| int max_staging_buffer_usage_in_bytes, |
| - bool use_rgba_4444_texture_format) |
| + bool use_rgba_4444_texture_format, |
| + bool use_compressed_texture_formats) |
| : task_runner_(task_runner), |
| task_graph_runner_(task_graph_runner), |
| namespace_token_(task_graph_runner->GetNamespaceToken()), |
| @@ -204,6 +207,7 @@ OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool( |
| bytes_scheduled_since_last_flush_(0), |
| max_staging_buffer_usage_in_bytes_(max_staging_buffer_usage_in_bytes), |
| use_rgba_4444_texture_format_(use_rgba_4444_texture_format), |
| + use_compressed_texture_formats_(use_compressed_texture_formats), |
| staging_buffer_usage_in_bytes_(0), |
| free_staging_buffer_usage_in_bytes_(0), |
| staging_buffer_expiration_delay_( |
| @@ -337,6 +341,9 @@ void OneCopyTileTaskWorkerPool::CheckForCompletedTasks() { |
| ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat( |
| bool must_support_alpha) const { |
| + if (use_compressed_texture_formats_ && !must_support_alpha) |
| + return ETC1; |
|
reveman
2015/09/30 09:55:15
Can we include zero-copy support in this patch too
christiank
2015/11/26 15:35:35
Sure!
|
| + |
| return use_rgba_4444_texture_format_ |
| ? RGBA_4444 |
| : resource_provider_->best_texture_format(); |
| @@ -495,10 +502,17 @@ void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( |
| int rows_to_copy = std::min(chunk_size_in_rows, height - y); |
| DCHECK_GT(rows_to_copy, 0); |
| - gl->CopySubTextureCHROMIUM(GL_TEXTURE_2D, staging_buffer->texture_id, |
| - resource_lock->texture_id(), 0, y, 0, y, |
| - resource->size().width(), rows_to_copy, false, |
| - false, false); |
| + if (IsResourceFormatCompressed(resource->format())) { |
| + // TODO(christiank): Should use CompressedCopySubTextureCHROMIUM. |
|
christiank
2015/09/30 07:49:42
reveman (cited from 1197423003):
"Let's fix this T
reveman
2015/09/30 09:55:15
ResourceProvider::LazyAllocate seem wrong. If it c
christiank
2015/11/26 15:35:35
Actually these are two different Resource classes.
reveman
2015/11/27 16:46:49
Ok, I think it's fine to make the use of SubCopy c
christiank
2015/11/30 15:41:08
Ahh good, that'll be better. Fixed now.
|
| + gl->CompressedCopyTextureCHROMIUM(GL_TEXTURE_2D, |
| + staging_buffer->texture_id, |
| + resource_lock->texture_id()); |
| + } else { |
| + gl->CopySubTextureCHROMIUM(GL_TEXTURE_2D, staging_buffer->texture_id, |
| + resource_lock->texture_id(), 0, y, 0, y, |
| + resource->size().width(), rows_to_copy, |
| + false, false, false); |
| + } |
| y += rows_to_copy; |
| // Increment |bytes_scheduled_since_last_flush_| by the amount of memory |