1 /* 2 * Copyright 2017 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 8 #ifndef VkTestUtils_DEFINED 9 #define VkTestUtils_DEFINED 10 11 #include "SkTypes.h" 12 13 #ifdef SK_VULKAN 14 15 #include "GrVulkanDefines.h" 16 #include "vk/GrVkBackendContext.h" 17 #include "vk/GrVkTypes.h" 18 #include <functional> 19 20 class GrVkExtensions; 21 struct GrVkBackendContext; 22 23 namespace sk_gpu_test { 24 bool LoadVkLibraryAndGetProcAddrFuncs(PFN_vkGetInstanceProcAddr*, PFN_vkGetDeviceProcAddr*); 25 26 using CanPresentFn = std::function<bool(VkInstance, VkPhysicalDevice, 27 uint32_t queueFamilyIndex)>; 28 29 bool CreateVkBackendContext(GrVkGetProc getProc, 30 GrVkBackendContext* ctx, 31 GrVkExtensions*, 32 VkPhysicalDeviceFeatures2*, 33 VkDebugReportCallbackEXT* debugCallback, 34 uint32_t* presentQueueIndexPtr = nullptr, 35 CanPresentFn canPresent = CanPresentFn()); 36 37 void FreeVulkanFeaturesStructs(const VkPhysicalDeviceFeatures2*); 38 } 39 40 #endif 41 #endif 42 43