diff options
Diffstat (limited to 'include/gpu/vk/GrVkBackendContext.h')
-rw-r--r-- | include/gpu/vk/GrVkBackendContext.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/gpu/vk/GrVkBackendContext.h b/include/gpu/vk/GrVkBackendContext.h index 5838caa323..987b32f3b3 100644 --- a/include/gpu/vk/GrVkBackendContext.h +++ b/include/gpu/vk/GrVkBackendContext.h @@ -45,15 +45,28 @@ struct GrVkBackendContext : public SkRefCnt { uint32_t fExtensions; uint32_t fFeatures; sk_sp<const GrVkInterface> fInterface; + /** + * Controls whether this object destroys the instance and device upon destruction. The default + * is temporarily 'true' to avoid breaking existing clients but will be changed to 'false'. + */ + bool fOwnsInstanceAndDevice = true; using CanPresentFn = std::function<bool(VkInstance, VkPhysicalDevice, uint32_t queueFamilyIndex)>; - // Helper function to create the default Vulkan objects needed by the GrVkGpu object - // If getProc is NULL, a default getProc will be constructed if we are statically linking - // against Vulkan. - // If presentQueueIndex is non-NULL, will try to set up presentQueue as part of device - // creation using the platform-specific canPresent() function. + /** + * Helper function to create the Vulkan objects needed for a Vulkan-backed GrContext. + * If getProc is null, a default getProc will be constructed if we are statically linking + * against Vulkan. Note that this default behavior will be removed soon as well as the version + * that uses the unified "GetProc" instead of separate "GetInstanceProc" and "GetDeviceProc" + * functions. + * + * If presentQueueIndex is non-NULL, will try to set up presentQueue as part of device + * creation using the platform-specific canPresent() function. + * + * This will set fOwnsInstanceAndDevice to 'true'. If it is subsequently set to 'false' then + * the client owns the lifetime of the created VkDevice and VkInstance. + */ static const GrVkBackendContext* Create(uint32_t* presentQueueIndex = nullptr, CanPresentFn = CanPresentFn(), GrVkInterface::GetProc getProc = nullptr); |