bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Robert Phillips | 08ba085 | 2019-05-22 20:23:43 +0000 | [diff] [blame] | 8 | #include "tools/gpu/vk/VkTestContext.h" |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 9 | |
| 10 | #ifdef SK_VULKAN |
| 11 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "include/gpu/GrContext.h" |
| 13 | #include "include/gpu/vk/GrVkExtensions.h" |
| 14 | #include "tools/gpu/vk/VkTestUtils.h" |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 15 | |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 16 | namespace { |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 17 | |
| 18 | #define ACQUIRE_VK_PROC(name, device) \ |
| 19 | f##name = reinterpret_cast<PFN_vk##name>(getProc("vk" #name, nullptr, device)); \ |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 20 | SkASSERT(f##name) |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 21 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 22 | /** |
csmartdalton | 421a3c1 | 2016-10-04 11:08:45 -0700 | [diff] [blame] | 23 | * Implements sk_gpu_test::FenceSync for Vulkan. It creates a single command |
| 24 | * buffer with USAGE_SIMULTANEOUS with no content . On every insertFence request |
| 25 | * it submits the command buffer with a new fence. |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 26 | */ |
csmartdalton | 421a3c1 | 2016-10-04 11:08:45 -0700 | [diff] [blame] | 27 | class VkFenceSync : public sk_gpu_test::FenceSync { |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 28 | public: |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 29 | VkFenceSync(GrVkGetProc getProc, VkDevice device, VkQueue queue, |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 30 | uint32_t queueFamilyIndex) |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 31 | : fDevice(device) |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 32 | , fQueue(queue) { |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 33 | ACQUIRE_VK_PROC(CreateCommandPool, device); |
| 34 | ACQUIRE_VK_PROC(DestroyCommandPool, device); |
| 35 | ACQUIRE_VK_PROC(AllocateCommandBuffers, device); |
| 36 | ACQUIRE_VK_PROC(FreeCommandBuffers, device); |
| 37 | ACQUIRE_VK_PROC(BeginCommandBuffer, device); |
| 38 | ACQUIRE_VK_PROC(EndCommandBuffer, device); |
| 39 | ACQUIRE_VK_PROC(CreateFence, device); |
| 40 | ACQUIRE_VK_PROC(DestroyFence, device); |
| 41 | ACQUIRE_VK_PROC(WaitForFences, device); |
| 42 | ACQUIRE_VK_PROC(QueueSubmit, device); |
| 43 | |
| 44 | VkResult result; |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 45 | SkDEBUGCODE(fUnfinishedSyncs = 0;) |
| 46 | VkCommandPoolCreateInfo createInfo; |
| 47 | createInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; |
| 48 | createInfo.pNext = nullptr; |
| 49 | createInfo.flags = 0; |
| 50 | createInfo.queueFamilyIndex = queueFamilyIndex; |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 51 | result = fCreateCommandPool(fDevice, &createInfo, nullptr, &fCommandPool); |
| 52 | SkASSERT(VK_SUCCESS == result); |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 53 | |
| 54 | VkCommandBufferAllocateInfo allocateInfo; |
| 55 | allocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; |
| 56 | allocateInfo.pNext = nullptr; |
| 57 | allocateInfo.commandBufferCount = 1; |
| 58 | allocateInfo.commandPool = fCommandPool; |
| 59 | allocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 60 | result = fAllocateCommandBuffers(fDevice, &allocateInfo, &fCommandBuffer); |
| 61 | SkASSERT(VK_SUCCESS == result); |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 62 | |
| 63 | VkCommandBufferBeginInfo beginInfo; |
| 64 | beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; |
| 65 | beginInfo.pNext = nullptr; |
| 66 | beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; |
| 67 | beginInfo.pInheritanceInfo = nullptr; |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 68 | result = fBeginCommandBuffer(fCommandBuffer, &beginInfo); |
| 69 | SkASSERT(VK_SUCCESS == result); |
| 70 | result = fEndCommandBuffer(fCommandBuffer); |
| 71 | SkASSERT(VK_SUCCESS == result); |
| 72 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | ~VkFenceSync() override { |
| 76 | SkASSERT(!fUnfinishedSyncs); |
| 77 | // If the above assertion is true then the command buffer should not be in flight. |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 78 | fFreeCommandBuffers(fDevice, fCommandPool, 1, &fCommandBuffer); |
| 79 | fDestroyCommandPool(fDevice, fCommandPool, nullptr); |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 80 | } |
| 81 | |
csmartdalton | 421a3c1 | 2016-10-04 11:08:45 -0700 | [diff] [blame] | 82 | sk_gpu_test::PlatformFence SK_WARN_UNUSED_RESULT insertFence() const override { |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 83 | VkResult result; |
| 84 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 85 | VkFence fence; |
| 86 | VkFenceCreateInfo info; |
| 87 | info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; |
| 88 | info.pNext = nullptr; |
| 89 | info.flags = 0; |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 90 | result = fCreateFence(fDevice, &info, nullptr, &fence); |
| 91 | SkASSERT(VK_SUCCESS == result); |
| 92 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 93 | VkSubmitInfo submitInfo; |
| 94 | submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; |
| 95 | submitInfo.pNext = nullptr; |
| 96 | submitInfo.waitSemaphoreCount = 0; |
| 97 | submitInfo.pWaitSemaphores = nullptr; |
| 98 | submitInfo.pWaitDstStageMask = nullptr; |
| 99 | submitInfo.commandBufferCount = 1; |
| 100 | submitInfo.pCommandBuffers = &fCommandBuffer; |
| 101 | submitInfo.signalSemaphoreCount = 0; |
| 102 | submitInfo.pSignalSemaphores = nullptr; |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 103 | result = fQueueSubmit(fQueue, 1, &submitInfo, fence); |
| 104 | SkASSERT(VK_SUCCESS == result); |
| 105 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 106 | SkDEBUGCODE(++fUnfinishedSyncs;) |
Brian Osman | bbdf45e | 2016-10-10 17:04:52 -0400 | [diff] [blame] | 107 | return (sk_gpu_test::PlatformFence)fence; |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 108 | } |
| 109 | |
csmartdalton | 421a3c1 | 2016-10-04 11:08:45 -0700 | [diff] [blame] | 110 | bool waitFence(sk_gpu_test::PlatformFence opaqueFence) const override { |
Brian Osman | bbdf45e | 2016-10-10 17:04:52 -0400 | [diff] [blame] | 111 | VkFence fence = (VkFence)opaqueFence; |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 112 | static constexpr uint64_t kForever = ~((uint64_t)0); |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 113 | auto result = fWaitForFences(fDevice, 1, &fence, true, kForever); |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 114 | return result != VK_TIMEOUT; |
| 115 | } |
| 116 | |
csmartdalton | 421a3c1 | 2016-10-04 11:08:45 -0700 | [diff] [blame] | 117 | void deleteFence(sk_gpu_test::PlatformFence opaqueFence) const override { |
Brian Osman | bbdf45e | 2016-10-10 17:04:52 -0400 | [diff] [blame] | 118 | VkFence fence = (VkFence)opaqueFence; |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 119 | fDestroyFence(fDevice, fence, nullptr); |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 120 | SkDEBUGCODE(--fUnfinishedSyncs;) |
| 121 | } |
| 122 | |
| 123 | private: |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 124 | VkDevice fDevice; |
| 125 | VkQueue fQueue; |
| 126 | VkCommandPool fCommandPool; |
| 127 | VkCommandBuffer fCommandBuffer; |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 128 | |
| 129 | PFN_vkCreateCommandPool fCreateCommandPool = nullptr; |
| 130 | PFN_vkDestroyCommandPool fDestroyCommandPool = nullptr; |
| 131 | PFN_vkAllocateCommandBuffers fAllocateCommandBuffers = nullptr; |
| 132 | PFN_vkFreeCommandBuffers fFreeCommandBuffers = nullptr; |
| 133 | PFN_vkBeginCommandBuffer fBeginCommandBuffer = nullptr; |
| 134 | PFN_vkEndCommandBuffer fEndCommandBuffer = nullptr; |
| 135 | PFN_vkCreateFence fCreateFence = nullptr; |
| 136 | PFN_vkDestroyFence fDestroyFence = nullptr; |
| 137 | PFN_vkWaitForFences fWaitForFences = nullptr; |
| 138 | PFN_vkQueueSubmit fQueueSubmit = nullptr; |
| 139 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 140 | SkDEBUGCODE(mutable int fUnfinishedSyncs;) |
csmartdalton | 421a3c1 | 2016-10-04 11:08:45 -0700 | [diff] [blame] | 141 | typedef sk_gpu_test::FenceSync INHERITED; |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 142 | }; |
| 143 | |
Brian Salomon | 4dea72a | 2019-12-18 10:43:10 -0500 | [diff] [blame] | 144 | static_assert(sizeof(VkFence) <= sizeof(sk_gpu_test::PlatformFence)); |
csmartdalton | 024229a | 2016-10-04 14:24:23 -0700 | [diff] [blame] | 145 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 146 | // TODO: Implement swap buffers and finish |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 147 | class VkTestContextImpl : public sk_gpu_test::VkTestContext { |
| 148 | public: |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 149 | static VkTestContext* Create(VkTestContext* sharedContext) { |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 150 | GrVkBackendContext backendContext; |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame] | 151 | GrVkExtensions* extensions; |
Greg Daniel | a0651ac | 2018-08-08 09:23:18 -0400 | [diff] [blame] | 152 | VkPhysicalDeviceFeatures2* features; |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 153 | bool ownsContext = true; |
Greg Daniel | 37329b3 | 2018-07-02 20:16:44 +0000 | [diff] [blame] | 154 | VkDebugReportCallbackEXT debugCallback = VK_NULL_HANDLE; |
Greg Daniel | a31f4e5 | 2018-08-01 16:48:52 -0400 | [diff] [blame] | 155 | PFN_vkDestroyDebugReportCallbackEXT destroyCallback = nullptr; |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 156 | if (sharedContext) { |
| 157 | backendContext = sharedContext->getVkBackendContext(); |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame] | 158 | extensions = const_cast<GrVkExtensions*>(sharedContext->getVkExtensions()); |
Greg Daniel | a0651ac | 2018-08-08 09:23:18 -0400 | [diff] [blame] | 159 | features = const_cast<VkPhysicalDeviceFeatures2*>(sharedContext->getVkFeatures()); |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 160 | // We always delete the parent context last so make sure the child does not think they |
| 161 | // own the vulkan context. |
| 162 | ownsContext = false; |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 163 | } else { |
Greg Daniel | 35970ec | 2017-11-10 10:03:05 -0500 | [diff] [blame] | 164 | PFN_vkGetInstanceProcAddr instProc; |
| 165 | PFN_vkGetDeviceProcAddr devProc; |
| 166 | if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc, &devProc)) { |
| 167 | return nullptr; |
| 168 | } |
Greg Daniel | d3e65aa | 2018-08-01 09:19:45 -0400 | [diff] [blame] | 169 | auto getProc = [instProc, devProc](const char* proc_name, |
| 170 | VkInstance instance, VkDevice device) { |
| 171 | if (device != VK_NULL_HANDLE) { |
| 172 | return devProc(device, proc_name); |
| 173 | } |
| 174 | return instProc(instance, proc_name); |
| 175 | }; |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame] | 176 | extensions = new GrVkExtensions(); |
Greg Daniel | a0651ac | 2018-08-08 09:23:18 -0400 | [diff] [blame] | 177 | features = new VkPhysicalDeviceFeatures2; |
Greg Daniel | 74b1c01 | 2018-08-29 12:57:02 -0400 | [diff] [blame] | 178 | memset(features, 0, sizeof(VkPhysicalDeviceFeatures2)); |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame] | 179 | if (!sk_gpu_test::CreateVkBackendContext(getProc, &backendContext, extensions, |
Greg Daniel | a0651ac | 2018-08-08 09:23:18 -0400 | [diff] [blame] | 180 | features, &debugCallback)) { |
| 181 | sk_gpu_test::FreeVulkanFeaturesStructs(features); |
| 182 | delete features; |
Greg Daniel | 24d861d | 2019-01-30 15:13:22 -0500 | [diff] [blame] | 183 | delete extensions; |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 184 | return nullptr; |
| 185 | } |
Greg Daniel | a31f4e5 | 2018-08-01 16:48:52 -0400 | [diff] [blame] | 186 | if (debugCallback != VK_NULL_HANDLE) { |
| 187 | destroyCallback = (PFN_vkDestroyDebugReportCallbackEXT) instProc( |
| 188 | backendContext.fInstance, "vkDestroyDebugReportCallbackEXT"); |
| 189 | } |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 190 | } |
Greg Daniel | a0651ac | 2018-08-08 09:23:18 -0400 | [diff] [blame] | 191 | return new VkTestContextImpl(backendContext, extensions, features, ownsContext, |
| 192 | debugCallback, destroyCallback); |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 193 | } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 194 | |
| 195 | ~VkTestContextImpl() override { this->teardown(); } |
| 196 | |
| 197 | void testAbandon() override {} |
| 198 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 199 | // There is really nothing to here since we don't own any unqueued command buffers here. |
bsalomon | c869932 | 2016-05-11 11:55:36 -0700 | [diff] [blame] | 200 | void submit() override {} |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 201 | |
bsalomon | c869932 | 2016-05-11 11:55:36 -0700 | [diff] [blame] | 202 | void finish() override {} |
| 203 | |
Greg Daniel | 02611d9 | 2017-07-25 10:05:01 -0400 | [diff] [blame] | 204 | sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override { |
Brian Salomon | 384fab4 | 2017-12-07 12:33:05 -0500 | [diff] [blame] | 205 | return GrContext::MakeVulkan(fVk, options); |
Greg Daniel | 02611d9 | 2017-07-25 10:05:01 -0400 | [diff] [blame] | 206 | } |
| 207 | |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 208 | protected: |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 209 | #define ACQUIRE_VK_PROC_LOCAL(name, inst) \ |
| 210 | PFN_vk##name grVk##name = \ |
| 211 | reinterpret_cast<PFN_vk##name>(fVk.fGetProc("vk" #name, inst, nullptr)); \ |
| 212 | do { \ |
| 213 | if (grVk##name == nullptr) { \ |
| 214 | SkDebugf("Function ptr for vk%s could not be acquired\n", #name); \ |
| 215 | return; \ |
| 216 | } \ |
| 217 | } while (0) |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 218 | |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 219 | void teardown() override { |
| 220 | INHERITED::teardown(); |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 221 | fVk.fMemoryAllocator.reset(); |
| 222 | if (fOwnsContext) { |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 223 | ACQUIRE_VK_PROC_LOCAL(DeviceWaitIdle, fVk.fInstance); |
| 224 | ACQUIRE_VK_PROC_LOCAL(DestroyDevice, fVk.fInstance); |
| 225 | ACQUIRE_VK_PROC_LOCAL(DestroyInstance, fVk.fInstance); |
| 226 | grVkDeviceWaitIdle(fVk.fDevice); |
| 227 | grVkDestroyDevice(fVk.fDevice, nullptr); |
Greg Daniel | 37329b3 | 2018-07-02 20:16:44 +0000 | [diff] [blame] | 228 | #ifdef SK_ENABLE_VK_LAYERS |
| 229 | if (fDebugCallback != VK_NULL_HANDLE) { |
Greg Daniel | 24d861d | 2019-01-30 15:13:22 -0500 | [diff] [blame] | 230 | fDestroyDebugReportCallbackEXT(fVk.fInstance, fDebugCallback, nullptr); |
Greg Daniel | 37329b3 | 2018-07-02 20:16:44 +0000 | [diff] [blame] | 231 | } |
| 232 | #endif |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 233 | grVkDestroyInstance(fVk.fInstance, nullptr); |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame] | 234 | delete fExtensions; |
Greg Daniel | a0651ac | 2018-08-08 09:23:18 -0400 | [diff] [blame] | 235 | |
| 236 | sk_gpu_test::FreeVulkanFeaturesStructs(fFeatures); |
| 237 | delete fFeatures; |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 238 | } |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 239 | } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 240 | |
| 241 | private: |
Greg Daniel | 98bffae | 2018-08-01 13:25:41 -0400 | [diff] [blame] | 242 | VkTestContextImpl(const GrVkBackendContext& backendContext, const GrVkExtensions* extensions, |
Greg Daniel | a0651ac | 2018-08-08 09:23:18 -0400 | [diff] [blame] | 243 | VkPhysicalDeviceFeatures2* features, bool ownsContext, |
| 244 | VkDebugReportCallbackEXT debugCallback, |
Greg Daniel | a31f4e5 | 2018-08-01 16:48:52 -0400 | [diff] [blame] | 245 | PFN_vkDestroyDebugReportCallbackEXT destroyCallback) |
Greg Daniel | a0651ac | 2018-08-08 09:23:18 -0400 | [diff] [blame] | 246 | : VkTestContext(backendContext, extensions, features, ownsContext, debugCallback, |
Greg Daniel | a31f4e5 | 2018-08-01 16:48:52 -0400 | [diff] [blame] | 247 | destroyCallback) { |
Greg Daniel | c8cd45a | 2018-07-12 10:02:37 -0400 | [diff] [blame] | 248 | fFenceSync.reset(new VkFenceSync(fVk.fGetProc, fVk.fDevice, fVk.fQueue, |
Greg Daniel | f730c18 | 2018-07-02 20:15:37 +0000 | [diff] [blame] | 249 | fVk.fGraphicsQueueIndex)); |
bsalomon | edea94c | 2016-05-16 14:09:56 -0700 | [diff] [blame] | 250 | } |
| 251 | |
Robert Phillips | edf3f38 | 2020-02-13 12:59:19 -0500 | [diff] [blame] | 252 | void onPlatformMakeNotCurrent() const override {} |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 253 | void onPlatformMakeCurrent() const override {} |
Brian Salomon | 55ad774 | 2017-11-17 09:25:23 -0500 | [diff] [blame] | 254 | std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 255 | void onPlatformSwapBuffers() const override {} |
| 256 | |
| 257 | typedef sk_gpu_test::VkTestContext INHERITED; |
| 258 | }; |
csmartdalton | 421a3c1 | 2016-10-04 11:08:45 -0700 | [diff] [blame] | 259 | } // anonymous namespace |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 260 | |
| 261 | namespace sk_gpu_test { |
Greg Daniel | 604b197 | 2017-05-15 13:50:35 -0400 | [diff] [blame] | 262 | VkTestContext* CreatePlatformVkTestContext(VkTestContext* sharedContext) { |
| 263 | return VkTestContextImpl::Create(sharedContext); |
| 264 | } |
bsalomon | 18a2f9d | 2016-05-11 10:09:18 -0700 | [diff] [blame] | 265 | } // namespace sk_gpu_test |
| 266 | |
| 267 | #endif |