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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class VulkanWindowContext : public WindowContext { | 22 class VulkanWindowContext : public WindowContext { |
23 public: | 23 public: |
24 ~VulkanWindowContext() override; | 24 ~VulkanWindowContext() override; |
25 | 25 |
26 sk_sp<SkSurface> getBackbufferSurface() override; | 26 sk_sp<SkSurface> getBackbufferSurface() override; |
27 void swapBuffers() override; | 27 void swapBuffers() override; |
28 | 28 |
29 bool isValid() override { return SkToBool(fBackendContext.get()); } | 29 bool isValid() override { return SkToBool(fBackendContext.get()); } |
30 | 30 |
31 void resize(uint32_t w, uint32_t h) override { | 31 void resize(int w, int h) override { |
32 this->createSwapchain(w, h, fDisplayParams); | 32 this->createSwapchain(w, h, fDisplayParams); |
33 } | 33 } |
34 | 34 |
35 void setDisplayParams(const DisplayParams& params) override { | 35 void setDisplayParams(const DisplayParams& params) override { |
36 this->createSwapchain(fWidth, fHeight, params); | 36 this->createSwapchain(fWidth, fHeight, params); |
37 } | 37 } |
38 | 38 |
39 GrBackendContext getBackendContext() override { | 39 GrBackendContext getBackendContext() override { |
40 return (GrBackendContext) fBackendContext.get(); | 40 return (GrBackendContext) fBackendContext.get(); |
41 } | 41 } |
(...skipping 10 matching lines...) Expand all Loading... |
52 | 52 |
53 struct BackbufferInfo { | 53 struct BackbufferInfo { |
54 uint32_t fImageIndex; // image this is associated with | 54 uint32_t fImageIndex; // image this is associated with |
55 VkSemaphore fAcquireSemaphore; // we signal on this for acquisiti
on of image | 55 VkSemaphore fAcquireSemaphore; // we signal on this for acquisiti
on of image |
56 VkSemaphore fRenderSemaphore; // we wait on this for rendering t
o be done | 56 VkSemaphore fRenderSemaphore; // we wait on this for rendering t
o be done |
57 VkCommandBuffer fTransitionCmdBuffers[2]; // to transition layout betwee
n present and render | 57 VkCommandBuffer fTransitionCmdBuffers[2]; // to transition layout betwee
n present and render |
58 VkFence fUsageFences[2]; // used to ensure this data is no
longer used on GPU | 58 VkFence fUsageFences[2]; // used to ensure this data is no
longer used on GPU |
59 }; | 59 }; |
60 | 60 |
61 BackbufferInfo* getAvailableBackbuffer(); | 61 BackbufferInfo* getAvailableBackbuffer(); |
62 bool createSwapchain(uint32_t width, uint32_t height, const DisplayParams& p
arams); | 62 bool createSwapchain(int width, int height, const DisplayParams& params); |
63 void createBuffers(VkFormat format); | 63 void createBuffers(VkFormat format); |
64 void destroyBuffers(); | 64 void destroyBuffers(); |
65 | 65 |
66 SkAutoTUnref<const GrVkBackendContext> fBackendContext; | 66 SkAutoTUnref<const GrVkBackendContext> fBackendContext; |
67 | 67 |
68 // simple wrapper class that exists only to initialize a pointer to NULL | 68 // simple wrapper class that exists only to initialize a pointer to NULL |
69 template <typename FNPTR_TYPE> class VkPtr { | 69 template <typename FNPTR_TYPE> class VkPtr { |
70 public: | 70 public: |
71 VkPtr() : fPtr(NULL) {} | 71 VkPtr() : fPtr(NULL) {} |
72 VkPtr operator=(FNPTR_TYPE ptr) { fPtr = ptr; return *this; } | 72 VkPtr operator=(FNPTR_TYPE ptr) { fPtr = ptr; return *this; } |
(...skipping 29 matching lines...) Expand all Loading... |
102 VkCommandPool fCommandPool; | 102 VkCommandPool fCommandPool; |
103 BackbufferInfo* fBackbuffers; | 103 BackbufferInfo* fBackbuffers; |
104 uint32_t fCurrentBackbufferIndex; | 104 uint32_t fCurrentBackbufferIndex; |
105 }; | 105 }; |
106 | 106 |
107 } // namespace sk_app | 107 } // namespace sk_app |
108 | 108 |
109 #endif // SK_VULKAN | 109 #endif // SK_VULKAN |
110 | 110 |
111 #endif | 111 #endif |
OLD | NEW |