Debian Codegraph @

tools/gpu/vk/VkTestUtils.h

raw
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 <functional>
16 #include "include/gpu/vk/VulkanBackendContext.h"
17 #include "include/gpu/vk/VulkanPreferredFeatures.h"
18 #include "tools/gpu/vk/VulkanDefines.h"
19
20 namespace skgpu {
21 struct VulkanBackendContext;
22 class VulkanExtensions;
23 }
24
25 namespace sk_gpu_test {
26 struct TestVkFeatures {
27 VkPhysicalDeviceFeatures2 deviceFeatures;
28
29 // protectedMemoryFeatures and structs from skiaFeatures may be chained into deviceFeatures,
30 // so must share the same lifetime.
31 skgpu::VulkanPreferredFeatures skiaFeatures;
32 VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeatures;
33 };
34
35 bool LoadVkLibraryAndGetProcAddrFuncs(PFN_vkGetInstanceProcAddr*);
36
37 using CanPresentFn = std::function<bool(VkInstance, VkPhysicalDevice,
38 uint32_t queueFamilyIndex)>;
39
40 bool CreateVkBackendContext(PFN_vkGetInstanceProcAddr getInstProc,
41 skgpu::VulkanBackendContext* ctx,
42 skgpu::VulkanExtensions*,
43 TestVkFeatures*,
44 VkDebugUtilsMessengerEXT* debugMessenger,
45 uint32_t* presentQueueIndexPtr = nullptr,
46 const CanPresentFn& canPresent = CanPresentFn(),
47 bool isProtected = false);
48
49 } // namespace sk_gpu_test
50
51 #endif
52 #endif