OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2016 Google Inc. | 3 * Copyright 2016 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef VulkanWindowContext_DEFINED | 8 #ifndef VulkanWindowContext_DEFINED |
9 #define VulkanWindowContext_DEFINED | 9 #define VulkanWindowContext_DEFINED |
10 | 10 |
11 #ifdef SK_VULKAN | 11 #ifdef SK_VULKAN |
12 | 12 |
13 #include "vk/GrVkBackendContext.h" | 13 #include "vk/GrVkBackendContext.h" |
14 #include "WindowContext.h" | 14 #include "WindowContext.h" |
15 | 15 |
16 class GrRenderTarget; | 16 class GrRenderTarget; |
17 | 17 |
18 namespace sk_app { | 18 namespace sk_app { |
19 | 19 |
20 class VulkanWindowContext : public WindowContext { | 20 class VulkanWindowContext : public WindowContext { |
21 public: | 21 public: |
22 ~VulkanWindowContext() override; | 22 ~VulkanWindowContext() override; |
23 | 23 |
24 // each platform will have to implement these in its CPP file | 24 // each platform will have to implement these in its CPP file |
25 static VkSurfaceKHR createVkSurface(VkInstance, void* platformData); | 25 static VkSurfaceKHR createVkSurface(VkInstance, void* platformData); |
26 static bool canPresent(VkInstance, VkPhysicalDevice, uint32_t queueFamilyInd
ex); | 26 static bool canPresent(VkInstance, VkPhysicalDevice, uint32_t queueFamilyInd
ex, |
| 27 void* platformData); |
27 | 28 |
28 static VulkanWindowContext* Create(void* platformData, const DisplayParams&
params) { | 29 static VulkanWindowContext* Create(void* platformData, const DisplayParams&
params) { |
29 VulkanWindowContext* ctx = new VulkanWindowContext(platformData, params)
; | 30 VulkanWindowContext* ctx = new VulkanWindowContext(platformData, params)
; |
30 if (!ctx->isValid()) { | 31 if (!ctx->isValid()) { |
31 delete ctx; | 32 delete ctx; |
32 return nullptr; | 33 return nullptr; |
33 } | 34 } |
34 return ctx; | 35 return ctx; |
35 } | 36 } |
36 | 37 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 VkPtr<PFN_vkDestroySwapchainKHR> fDestroySwapchainKHR; | 93 VkPtr<PFN_vkDestroySwapchainKHR> fDestroySwapchainKHR; |
93 VkPtr<PFN_vkGetSwapchainImagesKHR> fGetSwapchainImagesKHR; | 94 VkPtr<PFN_vkGetSwapchainImagesKHR> fGetSwapchainImagesKHR; |
94 VkPtr<PFN_vkAcquireNextImageKHR> fAcquireNextImageKHR; | 95 VkPtr<PFN_vkAcquireNextImageKHR> fAcquireNextImageKHR; |
95 VkPtr<PFN_vkQueuePresentKHR> fQueuePresentKHR; | 96 VkPtr<PFN_vkQueuePresentKHR> fQueuePresentKHR; |
96 VkPtr<PFN_vkCreateSharedSwapchainsKHR> fCreateSharedSwapchainsKHR; | 97 VkPtr<PFN_vkCreateSharedSwapchainsKHR> fCreateSharedSwapchainsKHR; |
97 | 98 |
98 VkSurfaceKHR fSurface; | 99 VkSurfaceKHR fSurface; |
99 VkSwapchainKHR fSwapchain; | 100 VkSwapchainKHR fSwapchain; |
100 uint32_t fPresentQueueIndex; | 101 uint32_t fPresentQueueIndex; |
101 VkQueue fPresentQueue; | 102 VkQueue fPresentQueue; |
102 int fWidth; | |
103 int fHeight; | |
104 | 103 |
105 uint32_t fImageCount; | 104 uint32_t fImageCount; |
106 VkImage* fImages; // images in the swapchain | 105 VkImage* fImages; // images in the swapchain |
107 VkImageLayout* fImageLayouts; // layouts of these images when not
color attachment | 106 VkImageLayout* fImageLayouts; // layouts of these images when not
color attachment |
108 sk_sp<GrRenderTarget>* fRenderTargets; // wrapped rendertargets for those i
mages | 107 sk_sp<GrRenderTarget>* fRenderTargets; // wrapped rendertargets for those i
mages |
109 sk_sp<SkSurface>* fSurfaces; // surfaces client renders to (may n
ot be based on rts) | 108 sk_sp<SkSurface>* fSurfaces; // surfaces client renders to (may n
ot be based on rts) |
110 VkCommandPool fCommandPool; | 109 VkCommandPool fCommandPool; |
111 BackbufferInfo* fBackbuffers; | 110 BackbufferInfo* fBackbuffers; |
112 uint32_t fCurrentBackbufferIndex; | 111 uint32_t fCurrentBackbufferIndex; |
113 }; | 112 }; |
114 | 113 |
115 } // namespace sk_app | 114 } // namespace sk_app |
116 | 115 |
117 #endif // SK_VULKAN | 116 #endif // SK_VULKAN |
118 | 117 |
119 #endif | 118 #endif |
OLD | NEW |