Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Side by Side Diff: tools/vulkan/VulkanTestContext.h

Issue 1899213002: Revise WSI setup. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Updated for comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkMemory.cpp ('k') | tools/vulkan/VulkanTestContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VulkanTestContext_DEFINED 8 #ifndef VulkanTestContext_DEFINED
9 #define VulkanTestContext_DEFINED 9 #define VulkanTestContext_DEFINED
10 10
11 #ifdef SK_VULKAN 11 #ifdef SK_VULKAN
12 12
13 #include "GrTypes.h" 13 #include "GrTypes.h"
14 #include "vk/GrVkBackendContext.h" 14 #include "vk/GrVkBackendContext.h"
15 15
16 class SkSurface; 16 class SkSurface;
17 class GrContext; 17 class GrContext;
18 18
19 class VulkanTestContext { 19 class VulkanTestContext {
20 public: 20 public:
21 ~VulkanTestContext(); 21 ~VulkanTestContext();
22 22
23 // each platform will have to implement these in its CPP file 23 // each platform will have to implement these in its CPP file
24 VkSurfaceKHR createVkSurface(void* platformData); 24 static VkSurfaceKHR createVkSurface(VkInstance, void* platformData);
25 bool canPresent(uint32_t queueFamilyIndex); 25 static bool canPresent(VkInstance, VkPhysicalDevice, uint32_t queueFamilyInd ex);
26 26
27 static VulkanTestContext* Create(void* platformData, int msaaSampleCount) { 27 static VulkanTestContext* Create(void* platformData, int msaaSampleCount) {
28 VulkanTestContext* ctx = new VulkanTestContext(platformData, msaaSampleC ount); 28 VulkanTestContext* ctx = new VulkanTestContext(platformData, msaaSampleC ount);
29 if (!ctx->isValid()) { 29 if (!ctx->isValid()) {
30 delete ctx; 30 delete ctx;
31 return nullptr; 31 return nullptr;
32 } 32 }
33 return ctx; 33 return ctx;
34 } 34 }
35 35
(...skipping 26 matching lines...) Expand all
62 VkFence fUsageFences[2]; // used to ensure this data is no longer used on GPU 62 VkFence fUsageFences[2]; // used to ensure this data is no longer used on GPU
63 }; 63 };
64 64
65 BackbufferInfo* getAvailableBackbuffer(); 65 BackbufferInfo* getAvailableBackbuffer();
66 bool createSwapchain(uint32_t width, uint32_t height); 66 bool createSwapchain(uint32_t width, uint32_t height);
67 void createBuffers(VkFormat format); 67 void createBuffers(VkFormat format);
68 void destroyBuffers(); 68 void destroyBuffers();
69 69
70 SkAutoTUnref<const GrVkBackendContext> fBackendContext; 70 SkAutoTUnref<const GrVkBackendContext> fBackendContext;
71 71
72 // simple wrapper class that exists only to initialize a pointer to NULL
73 template <typename FNPTR_TYPE> class VkPtr {
74 public:
75 VkPtr() : fPtr(NULL) {}
76 VkPtr operator=(FNPTR_TYPE ptr) { fPtr = ptr; return *this; }
77 operator FNPTR_TYPE() const { return fPtr; }
78 private:
79 FNPTR_TYPE fPtr;
80 };
81
82 // WSI interface functions
83 VkPtr<PFN_vkDestroySurfaceKHR> fDestroySurfaceKHR;
84 VkPtr<PFN_vkGetPhysicalDeviceSurfaceSupportKHR> fGetPhysicalDeviceSurfaceSup portKHR;
85 VkPtr<PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR> fGetPhysicalDeviceSurfa ceCapabilitiesKHR;
86 VkPtr<PFN_vkGetPhysicalDeviceSurfaceFormatsKHR> fGetPhysicalDeviceSurfaceFor matsKHR;
87 VkPtr<PFN_vkGetPhysicalDeviceSurfacePresentModesKHR> fGetPhysicalDeviceSurfa cePresentModesKHR;
88
89 VkPtr<PFN_vkCreateSwapchainKHR> fCreateSwapchainKHR;
90 VkPtr<PFN_vkDestroySwapchainKHR> fDestroySwapchainKHR;
91 VkPtr<PFN_vkGetSwapchainImagesKHR> fGetSwapchainImagesKHR;
92 VkPtr<PFN_vkAcquireNextImageKHR> fAcquireNextImageKHR;
93 VkPtr<PFN_vkQueuePresentKHR> fQueuePresentKHR;
94 VkPtr<PFN_vkCreateSharedSwapchainsKHR> fCreateSharedSwapchainsKHR;
95
72 GrContext* fContext; 96 GrContext* fContext;
73 VkSurfaceKHR fSurface; 97 VkSurfaceKHR fSurface;
74 VkSwapchainKHR fSwapchain; 98 VkSwapchainKHR fSwapchain;
75 uint32_t fPresentQueueIndex; 99 uint32_t fPresentQueueIndex;
76 VkQueue fPresentQueue; 100 VkQueue fPresentQueue;
77 int fWidth; 101 int fWidth;
78 int fHeight; 102 int fHeight;
79 GrPixelConfig fPixelConfig; 103 GrPixelConfig fPixelConfig;
80 104
81 uint32_t fImageCount; 105 uint32_t fImageCount;
82 VkImage* fImages; // images in the swapchain 106 VkImage* fImages; // images in the swapchain
83 VkImageLayout* fImageLayouts; // layouts of these images when not color attachment 107 VkImageLayout* fImageLayouts; // layouts of these images when not color attachment
84 sk_sp<SkSurface>* fSurfaces; // wrapped surface for those images 108 sk_sp<SkSurface>* fSurfaces; // wrapped surface for those images
85 VkCommandPool fCommandPool; 109 VkCommandPool fCommandPool;
86 BackbufferInfo* fBackbuffers; 110 BackbufferInfo* fBackbuffers;
87 uint32_t fCurrentBackbufferIndex; 111 uint32_t fCurrentBackbufferIndex;
88 }; 112 };
89 113
90 #endif // SK_VULKAN 114 #endif // SK_VULKAN
91 115
92 #endif 116 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkMemory.cpp ('k') | tools/vulkan/VulkanTestContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698