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