Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrVkBackendContext.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 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 GrVkBackendContext_DEFINED
9#define GrVkBackendContext_DEFINED
10
14
15namespace skgpu { class VulkanExtensions; }
16
26
32
33// It is not guaranteed VkPhysicalDeviceProperties2 will be in the client's header so we forward
34// declare it here to be safe.
36
37// The BackendContext contains all of the base Vulkan objects needed by the GrVkGpu. The assumption
38// is that the client will set these up and pass them to the GrVkGpu constructor. The VkDevice
39// created must support at least one graphics queue, which is passed in as well.
40// The QueueFamilyIndex must match the family of the given queue. It is needed for CommandPool
41// creation, and any GrBackendObjects handed to us (e.g., for wrapped textures) needs to be created
42// in or transitioned to that family. The refs held by members of this struct must be released
43// (either by deleting the struct or manually releasing the refs) before the underlying vulkan
44// device and instance are destroyed.
46 VkInstance fInstance = VK_NULL_HANDLE;
47 VkPhysicalDevice fPhysicalDevice = VK_NULL_HANDLE;
48 VkDevice fDevice = VK_NULL_HANDLE;
49 VkQueue fQueue = VK_NULL_HANDLE;
50 uint32_t fGraphicsQueueIndex = 0;
51 uint32_t fMinAPIVersion = 0; // Deprecated. Use fInstanceVersion
52 // instead.
53 uint32_t fInstanceVersion = 0; // Deprecated. Use fMaxApiVersion
54 // The max api version set here should match the value set in VkApplicationInfo::apiVersion when
55 // then VkInstance was created.
56 uint32_t fMaxAPIVersion = 0;
57 uint32_t fExtensions = 0; // Deprecated. Use fVkExtensions instead.
58 const skgpu::VulkanExtensions* fVkExtensions = nullptr;
59 uint32_t fFeatures = 0; // Deprecated. Use fDeviceFeatures[2]
60 // instead.
61 // The client can create their VkDevice with either a VkPhysicalDeviceFeatures or
62 // VkPhysicalDeviceFeatures2 struct, thus we have to support taking both. The
63 // VkPhysicalDeviceFeatures2 struct is needed so we know if the client enabled any extension
64 // specific features. If fDeviceFeatures2 is not null then we ignore fDeviceFeatures. If both
65 // fDeviceFeatures and fDeviceFeatures2 are null we will assume no features are enabled.
66 const VkPhysicalDeviceFeatures* fDeviceFeatures = nullptr;
67 const VkPhysicalDeviceFeatures2* fDeviceFeatures2 = nullptr;
69 skgpu::VulkanGetProc fGetProc = nullptr;
70 // This is deprecated and should be set to false. The client is responsible for managing the
71 // lifetime of the VkInstance and VkDevice objects.
72 bool fOwnsInstanceAndDevice = false;
73 // Indicates that we are working with protected content and all CommandPool and Queue operations
74 // should be done in a protected context.
75 skgpu::Protected fProtectedContext = skgpu::Protected::kNo;
76 // Optional callback which will be invoked if a VK_ERROR_DEVICE_LOST error code is received from
77 // the driver. Debug information from the driver will be provided to the callback if the
78 // VK_EXT_device_fault extension is supported and enabled (VkPhysicalDeviceFaultFeaturesEXT must
79 // be in the pNext chain of VkDeviceCreateInfo).
80 skgpu::VulkanDeviceLostContext fDeviceLostContext = nullptr;
81 skgpu::VulkanDeviceLostProc fDeviceLostProc = nullptr;
82};
83
84#endif
GrVkExtensionFlags
@ kKHR_android_surface_GrVkExtensionFlag
@ kKHR_surface_GrVkExtensionFlag
@ kKHR_xcb_surface_GrVkExtensionFlag
@ kEXT_debug_report_GrVkExtensionFlag
@ kNV_glsl_shader_GrVkExtensionFlag
@ kKHR_win32_surface_GrVkExtensionFlag
@ kKHR_swapchain_GrVkExtensionFlag
GrVkFeatureFlags
@ kSampleRateShading_GrVkFeatureFlag
@ kDualSrcBlend_GrVkFeatureFlag
@ kGeometryShader_GrVkFeatureFlag
#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< skgpu::VulkanMemoryAllocator > fMemoryAllocator
#define VK_NULL_HANDLE
Definition vulkan_core.h:46