Chromium Code Reviews| Index: blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc |
| diff --git a/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc b/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc |
| index f1c05796992c98d7a163479de7d8bbf1540331da..f8e081326c9eaab489e69726ac8b9b010546494a 100644 |
| --- a/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc |
| +++ b/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc |
| @@ -4,17 +4,40 @@ |
| #include "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h" |
| +#include <GLES2/gl2.h> |
| #include <stddef.h> |
| #include <stdint.h> |
| #include <memory> |
| +#include "base/hash.h" |
| #include "base/logging.h" |
| #include "base/memory/ptr_util.h" |
| #include "base/numerics/safe_conversions.h" |
| #include "ui/gfx/buffer_format_util.h" |
| #include "ui/gfx/gpu_memory_buffer.h" |
| +namespace { |
|
Khushal
2016/08/02 06:39:01
Doesn't look like GetDefaultBufferToTextureTargetM
David Trainor- moved to gerrit
2016/08/02 15:37:27
Crap. done.
|
| + |
| +using GpuMemoryBufferConfigurationKey = |
| + std::pair<gfx::BufferFormat, gfx::BufferUsage>; |
| +using GpuMemoryBufferConfigurationSet = |
| + base::hash_set<GpuMemoryBufferConfigurationKey>; |
| + |
| +} // namespace |
| + |
| +namespace BASE_HASH_NAMESPACE { |
| + |
| +template <> |
| +struct hash<GpuMemoryBufferConfigurationKey> { |
| + size_t operator()(const GpuMemoryBufferConfigurationKey& key) const { |
| + return base::HashInts(static_cast<int>(key.first), |
| + static_cast<int>(key.second)); |
| + } |
| +}; |
| + |
| +} // namespace BASE_HASH_NAMESPACE |
| + |
| namespace blimp { |
| namespace client { |
| @@ -101,6 +124,24 @@ BlimpGpuMemoryBufferManager::BlimpGpuMemoryBufferManager() {} |
| BlimpGpuMemoryBufferManager::~BlimpGpuMemoryBufferManager() {} |
| +// static |
| +cc::BufferToTextureTargetMap |
| +BlimpGpuMemoryBufferManager::GetDefaultBufferToTextureTargetMap() { |
| + cc::BufferToTextureTargetMap image_targets; |
| + for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST); |
| + ++usage_idx) { |
| + gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx); |
| + for (int format_idx = 0; |
| + format_idx <= static_cast<int>(gfx::BufferFormat::LAST); |
| + ++format_idx) { |
| + gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx); |
| + image_targets.insert(cc::BufferToTextureTargetMap::value_type( |
| + cc::BufferToTextureTargetKey(usage, format), GL_TEXTURE_2D)); |
| + } |
| + } |
| + return image_targets; |
| +} |
| + |
| std::unique_ptr<gfx::GpuMemoryBuffer> |
| BlimpGpuMemoryBufferManager::AllocateGpuMemoryBuffer( |
| const gfx::Size& size, |