Flutter Engine
The Flutter Engine
VulkanBackendContext.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC
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 skgpu_VulkanBackendContext_DEFINED
9#define skgpu_VulkanBackendContext_DEFINED
10
17
18#include <cstdint>
19
20namespace skgpu {
21
22class VulkanExtensions;
23
24// The VkBackendContext contains all of the base Vk objects needed by the skia Vulkan context.
26 VkInstance fInstance = VK_NULL_HANDLE;
27 VkPhysicalDevice fPhysicalDevice = VK_NULL_HANDLE;
28 VkDevice fDevice = VK_NULL_HANDLE;
29 VkQueue fQueue = VK_NULL_HANDLE;
30 uint32_t fGraphicsQueueIndex = 0;
31 // The max api version set here should match the value set in VkApplicationInfo::apiVersion when
32 // then VkInstance was created.
33 uint32_t fMaxAPIVersion = 0;
34 const skgpu::VulkanExtensions* fVkExtensions = nullptr;
35 // The client can create their VkDevice with either a VkPhysicalDeviceFeatures or
36 // VkPhysicalDeviceFeatures2 struct, thus we have to support taking both. The
37 // VkPhysicalDeviceFeatures2 struct is needed so we know if the client enabled any extension
38 // specific features. If fDeviceFeatures2 is not null then we ignore fDeviceFeatures. If both
39 // fDeviceFeatures and fDeviceFeatures2 are null we will assume no features are enabled.
40 const VkPhysicalDeviceFeatures* fDeviceFeatures = nullptr;
41 const VkPhysicalDeviceFeatures2* fDeviceFeatures2 = nullptr;
42 // Optional. The client may provide an inplementation of a VulkanMemoryAllocator for Skia to use
43 // for allocating Vulkan resources that use VkDeviceMemory.
46 Protected fProtectedContext = Protected::kNo;
47 // Optional callback which will be invoked if a VK_ERROR_DEVICE_LOST error code is received from
48 // the driver. Debug information from the driver will be provided to the callback if the
49 // VK_EXT_device_fault extension is supported and enabled (VkPhysicalDeviceFaultFeaturesEXT must
50 // be in the pNext chain of VkDeviceCreateInfo).
51 skgpu::VulkanDeviceLostContext fDeviceLostContext = nullptr;
52 skgpu::VulkanDeviceLostProc fDeviceLostProc = nullptr;
53};
54
55} // namespace skgpu
56
57#endif // skgpu_VulkanBackendContext_DEFINED
#define SK_API
Definition: SkAPI.h:35
Definition: GpuTools.h:21
void * VulkanDeviceLostContext
Definition: VulkanTypes.h:121
std::function< PFN_vkVoidFunction(const char *, VkInstance, VkDevice)> VulkanGetProc
Definition: VulkanTypes.h:30
void(* VulkanDeviceLostProc)(VulkanDeviceLostContext faultContext, const std::string &description, const std::vector< VkDeviceFaultAddressInfoEXT > &addressInfos, const std::vector< VkDeviceFaultVendorInfoEXT > &vendorInfos, const std::vector< std::byte > &vendorBinaryData)
Definition: VulkanTypes.h:122
Protected
Definition: GpuTypes.h:61
sk_sp< VulkanMemoryAllocator > fMemoryAllocator
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46