OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_VULKAN_VULKAN_SURFACE_H_ | 5 #ifndef GPU_VULKAN_VULKAN_SURFACE_H_ |
6 #define GPU_VULKAN_VULKAN_SURFACE_H_ | 6 #define GPU_VULKAN_VULKAN_SURFACE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "gpu/vulkan/vulkan_export.h" | 10 #include "gpu/vulkan/vulkan_export.h" |
11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
13 #include "ui/gfx/swap_result.h" | 13 #include "ui/gfx/swap_result.h" |
14 | 14 |
15 namespace gpu { | 15 namespace gpu { |
16 | 16 |
17 class VulkanDeviceQueue; | 17 class VulkanDeviceQueue; |
18 class VulkanSwapChain; | 18 class VulkanSwapChain; |
19 | 19 |
20 class VULKAN_EXPORT VulkanSurface { | 20 class VULKAN_EXPORT VulkanSurface { |
21 public: | 21 public: |
22 // Minimum bit depth of surface. | 22 // Minimum bit depth of surface. |
23 enum Format { | 23 enum Format { |
24 FORMAT_BGRA8888, | 24 FORMAT_RGBA_32, |
25 FORMAT_RGB565, | 25 FORMAT_RGB_16, |
26 | 26 |
27 NUM_SURFACE_FORMATS, | 27 NUM_SURFACE_FORMATS, |
28 DEFAULT_SURFACE_FORMAT = FORMAT_BGRA8888 | 28 DEFAULT_SURFACE_FORMAT = FORMAT_RGBA_32 |
29 }; | 29 }; |
30 | 30 |
31 virtual ~VulkanSurface() = 0; | 31 virtual ~VulkanSurface() = 0; |
32 | 32 |
33 virtual bool Initialize(VulkanDeviceQueue* device_queue, | 33 virtual bool Initialize(VulkanDeviceQueue* device_queue, |
34 VulkanSurface::Format format) = 0; | 34 VulkanSurface::Format format) = 0; |
35 virtual void Destroy() = 0; | 35 virtual void Destroy() = 0; |
36 | 36 |
37 virtual gfx::SwapResult SwapBuffers() = 0; | 37 virtual gfx::SwapResult SwapBuffers() = 0; |
38 | 38 |
39 virtual VulkanSwapChain* GetSwapChain() = 0; | 39 virtual VulkanSwapChain* GetSwapChain() = 0; |
40 | 40 |
41 virtual void Finish() = 0; | 41 virtual void Finish() = 0; |
42 | 42 |
43 // Create a surface that render directlys into a surface. | 43 // Create a surface that render directlys into a surface. |
44 static std::unique_ptr<VulkanSurface> CreateViewSurface( | 44 static std::unique_ptr<VulkanSurface> CreateViewSurface( |
45 gfx::AcceleratedWidget window); | 45 gfx::AcceleratedWidget window); |
46 | 46 |
47 protected: | 47 protected: |
48 VulkanSurface(); | 48 VulkanSurface(); |
49 | 49 |
50 private: | 50 private: |
51 DISALLOW_COPY_AND_ASSIGN(VulkanSurface); | 51 DISALLOW_COPY_AND_ASSIGN(VulkanSurface); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace gpu | 54 } // namespace gpu |
55 | 55 |
56 #endif // GPU_VULKAN_VULKAN_SURFACE_H_ | 56 #endif // GPU_VULKAN_VULKAN_SURFACE_H_ |
OLD | NEW |