| 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/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 return; | 1495 return; |
| 1496 resource->allocated = true; | 1496 resource->allocated = true; |
| 1497 GLES2Interface* gl = ContextGL(); | 1497 GLES2Interface* gl = ContextGL(); |
| 1498 gfx::Size& size = resource->size; | 1498 gfx::Size& size = resource->size; |
| 1499 ResourceFormat format = resource->format; | 1499 ResourceFormat format = resource->format; |
| 1500 gl->BindTexture(resource->target, resource->gl_id); | 1500 gl->BindTexture(resource->target, resource->gl_id); |
| 1501 if (use_gpu_memory_buffer_resources_) { | 1501 if (use_gpu_memory_buffer_resources_) { |
| 1502 resource->gpu_memory_buffer = | 1502 resource->gpu_memory_buffer = |
| 1503 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( | 1503 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( |
| 1504 size, BufferFormat(format), | 1504 size, BufferFormat(format), |
| 1505 gfx::BufferUsage::SCANOUT) | 1505 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE) |
| 1506 .release(); | 1506 .release(); |
| 1507 LazyCreateImage(resource); | 1507 LazyCreateImage(resource); |
| 1508 resource->dirty_image = true; | 1508 resource->dirty_image = true; |
| 1509 resource->is_overlay_candidate = true; | 1509 resource->is_overlay_candidate = true; |
| 1510 } else if (use_texture_storage_ext_ && | 1510 } else if (use_texture_storage_ext_ && |
| 1511 IsFormatSupportedForStorage(format, use_texture_format_bgra_) && | 1511 IsFormatSupportedForStorage(format, use_texture_format_bgra_) && |
| 1512 (resource->hint & TEXTURE_HINT_IMMUTABLE)) { | 1512 (resource->hint & TEXTURE_HINT_IMMUTABLE)) { |
| 1513 GLenum storage_format = TextureToStorageFormat(format); | 1513 GLenum storage_format = TextureToStorageFormat(format); |
| 1514 gl->TexStorage2DEXT(resource->target, 1, storage_format, size.width(), | 1514 gl->TexStorage2DEXT(resource->target, 1, storage_format, size.width(), |
| 1515 size.height()); | 1515 size.height()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 const int kImportance = 2; | 1651 const int kImportance = 2; |
| 1652 pmd->CreateSharedGlobalAllocatorDump(guid); | 1652 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 1653 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1653 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 1654 } | 1654 } |
| 1655 } | 1655 } |
| 1656 | 1656 |
| 1657 return true; | 1657 return true; |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 } // namespace cc | 1660 } // namespace cc |
| OLD | NEW |