| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "gpu/command_buffer/service/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 for (uint32_t face_index = 0; face_index < face_infos_.size(); ++face_index) { | 1749 for (uint32_t face_index = 0; face_index < face_infos_.size(); ++face_index) { |
| 1750 const auto& level_infos = face_infos_[face_index].level_infos; | 1750 const auto& level_infos = face_infos_[face_index].level_infos; |
| 1751 for (uint32_t level_index = 0; level_index < level_infos.size(); | 1751 for (uint32_t level_index = 0; level_index < level_infos.size(); |
| 1752 ++level_index) { | 1752 ++level_index) { |
| 1753 // Skip levels with no size. Textures will have empty levels for all | 1753 // Skip levels with no size. Textures will have empty levels for all |
| 1754 // potential mip levels which are not in use. | 1754 // potential mip levels which are not in use. |
| 1755 if (!level_infos[level_index].estimated_size) | 1755 if (!level_infos[level_index].estimated_size) |
| 1756 continue; | 1756 continue; |
| 1757 | 1757 |
| 1758 // If a level has a GLImage, ask the GLImage to dump itself. | 1758 // If a level has a GLImage, ask the GLImage to dump itself. |
| 1759 // If a level does not have a GLImage bound to it, then dump the |
| 1760 // texture allocation also as the storage is not provided by the |
| 1761 // GLImage in that case. |
| 1759 if (level_infos[level_index].image) { | 1762 if (level_infos[level_index].image) { |
| 1760 level_infos[level_index].image->OnMemoryDump( | 1763 level_infos[level_index].image->OnMemoryDump( |
| 1761 pmd, client_tracing_id, | 1764 pmd, client_tracing_id, |
| 1762 base::StringPrintf("%s/face_%d/level_%d", dump_name.c_str(), | 1765 base::StringPrintf("%s/face_%d/level_%d", dump_name.c_str(), |
| 1763 face_index, level_index)); | 1766 face_index, level_index)); |
| 1764 } | 1767 } else { |
| 1765 | |
| 1766 // If a level does not have a GLImage bound to it, then dump the | |
| 1767 // texture allocation also as the storage is not provided by the | |
| 1768 // GLImage in that case. | |
| 1769 if (level_infos[level_index].image_state != BOUND) { | |
| 1770 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( | 1768 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( |
| 1771 "%s/face_%d/level_%d", dump_name.c_str(), face_index, level_index)); | 1769 "%s/face_%d/level_%d", dump_name.c_str(), face_index, level_index)); |
| 1772 dump->AddScalar( | 1770 dump->AddScalar( |
| 1773 MemoryAllocatorDump::kNameSize, MemoryAllocatorDump::kUnitsBytes, | 1771 MemoryAllocatorDump::kNameSize, MemoryAllocatorDump::kUnitsBytes, |
| 1774 static_cast<uint64_t>(level_infos[level_index].estimated_size)); | 1772 static_cast<uint64_t>(level_infos[level_index].estimated_size)); |
| 1775 } | 1773 } |
| 1776 } | 1774 } |
| 1777 } | 1775 } |
| 1778 } | 1776 } |
| 1779 | 1777 |
| (...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3658 uint32_t TextureManager::GetServiceIdGeneration() const { | 3656 uint32_t TextureManager::GetServiceIdGeneration() const { |
| 3659 return current_service_id_generation_; | 3657 return current_service_id_generation_; |
| 3660 } | 3658 } |
| 3661 | 3659 |
| 3662 void TextureManager::IncrementServiceIdGeneration() { | 3660 void TextureManager::IncrementServiceIdGeneration() { |
| 3663 current_service_id_generation_++; | 3661 current_service_id_generation_++; |
| 3664 } | 3662 } |
| 3665 | 3663 |
| 3666 } // namespace gles2 | 3664 } // namespace gles2 |
| 3667 } // namespace gpu | 3665 } // namespace gpu |
| OLD | NEW |