aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/vk
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-04-25 15:03:41 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-25 19:53:53 +0000
commit290c69052b3e734000046cd674c60158b0faa679 (patch)
tree1ec318a24bb6f2d696e5a05c1004c858d9f39729 /include/gpu/vk
parent3deaeb2dc0cfddfdf2e3b64736c860132619a051 (diff)
Add ability to relinquish control of VkDevice and VkInstance lifetime to GrVkBackendContext
Change-Id: I355a8bf573a84b4ba7cbfeed60feec13e251b352 Reviewed-on: https://skia-review.googlesource.com/14303 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/gpu/vk')
-rw-r--r--include/gpu/vk/GrVkBackendContext.h23
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);