OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef GPU_IPC_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_ | 5 #ifndef GPU_IPC_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_ |
6 #define GPU_IPC_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_ | 6 #define GPU_IPC_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_ |
7 | 7 |
| 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/hash.h" |
8 #include "gpu/gpu_export.h" | 10 #include "gpu/gpu_export.h" |
9 #include "ui/gfx/buffer_types.h" | 11 #include "ui/gfx/buffer_types.h" |
10 #include "ui/gfx/gpu_memory_buffer.h" | 12 #include "ui/gfx/gpu_memory_buffer.h" |
11 | 13 |
12 namespace gpu { | 14 namespace gpu { |
13 | 15 |
| 16 using GpuMemoryBufferConfigurationKey = |
| 17 std::pair<gfx::BufferFormat, gfx::BufferUsage>; |
| 18 using GpuMemoryBufferConfigurationSet = |
| 19 base::hash_set<GpuMemoryBufferConfigurationKey>; |
| 20 |
| 21 } // namespace gpu |
| 22 |
| 23 namespace BASE_HASH_NAMESPACE { |
| 24 |
| 25 template <> |
| 26 struct hash<gpu::GpuMemoryBufferConfigurationKey> { |
| 27 size_t operator()(const gpu::GpuMemoryBufferConfigurationKey& key) const { |
| 28 return base::HashInts(static_cast<int>(key.first), |
| 29 static_cast<int>(key.second)); |
| 30 } |
| 31 }; |
| 32 |
| 33 } // namespace BASE_HASH_NAMESPACE |
| 34 |
| 35 namespace gpu { |
| 36 |
| 37 GPU_EXPORT bool AreNativeGpuMemoryBuffersEnabled(); |
| 38 |
14 // Returns the native GPU memory buffer factory type. Returns EMPTY_BUFFER | 39 // Returns the native GPU memory buffer factory type. Returns EMPTY_BUFFER |
15 // type if native buffers are not supported. | 40 // type if native buffers are not supported. |
16 GPU_EXPORT gfx::GpuMemoryBufferType GetNativeGpuMemoryBufferType(); | 41 GPU_EXPORT gfx::GpuMemoryBufferType GetNativeGpuMemoryBufferType(); |
17 | 42 |
18 // Returns whether the provided buffer format is supported. | 43 // Returns whether the provided buffer format is supported. |
19 GPU_EXPORT bool IsNativeGpuMemoryBufferConfigurationSupported( | 44 GPU_EXPORT bool IsNativeGpuMemoryBufferConfigurationSupported( |
20 gfx::BufferFormat format, | 45 gfx::BufferFormat format, |
21 gfx::BufferUsage usage); | 46 gfx::BufferUsage usage); |
22 | 47 |
| 48 // Returns the set of supported configurations. |
| 49 GPU_EXPORT GpuMemoryBufferConfigurationSet |
| 50 GetNativeGpuMemoryBufferConfigurations(); |
| 51 |
23 } // namespace gpu | 52 } // namespace gpu |
24 | 53 |
25 #endif // GPU_IPC_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_ | 54 #endif // GPU_IPC_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_ |
OLD | NEW |