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