• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "include/core/SkTypes.h"
12 
13 #ifdef SK_VULKAN
14 
15 #include "include/gpu/vk/VulkanBackendContext.h"
16 #include "tools/gpu/vk/GrVulkanDefines.h"
17 #include <functional>
18 
19 struct GrVkBackendContext;
20 
21 namespace skgpu {
22 struct VulkanBackendContext;
23 class VulkanExtensions;
24 }
25 
26 namespace sk_gpu_test {
27     bool LoadVkLibraryAndGetProcAddrFuncs(PFN_vkGetInstanceProcAddr*);
28 
29     using CanPresentFn = std::function<bool(VkInstance, VkPhysicalDevice,
30                                             uint32_t queueFamilyIndex)>;
31 
32     bool CreateVkBackendContext(PFN_vkGetInstanceProcAddr getInstProc,
33                                 skgpu::VulkanBackendContext* ctx,
34                                 skgpu::VulkanExtensions*,
35                                 VkPhysicalDeviceFeatures2*,
36                                 VkDebugReportCallbackEXT* debugCallback,
37                                 uint32_t* presentQueueIndexPtr = nullptr,
38                                 CanPresentFn canPresent = CanPresentFn(),
39                                 bool isProtected = false);
40 
41     bool CreateVkBackendContext(PFN_vkGetInstanceProcAddr getInstProc,
42                                 GrVkBackendContext* ctx,
43                                 skgpu::VulkanExtensions*,
44                                 VkPhysicalDeviceFeatures2*,
45                                 VkDebugReportCallbackEXT* debugCallback,
46                                 uint32_t* presentQueueIndexPtr = nullptr,
47                                 CanPresentFn canPresent = CanPresentFn(),
48                                 bool isProtected = false);
49 
50     void FreeVulkanFeaturesStructs(const VkPhysicalDeviceFeatures2*);
51 }  // namespace sk_gpu_test
52 
53 #endif
54 #endif
55 
56