diff options
author | 2016-03-23 11:01:22 -0700 | |
---|---|---|
committer | 2016-03-23 11:01:22 -0700 | |
commit | 633b35657c964c32e7010b14bb2d396b4a764c52 (patch) | |
tree | 479f0a0e319d9ca046fcff899e831182e7b04d9e /include | |
parent | 734351d2555024a679c4e4f5e13e8be2329803d2 (diff) |
GrVkGpu initialization cleanup.
Add GrVkBackendContext for GrVkGpu initialization
Add missing extension initialization
Use device function pointers rather than instance
BUG=skia:5116
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1825593002
Review URL: https://codereview.chromium.org/1825593002
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/vk/GrVkBackendContext.h | 41 | ||||
-rw-r--r-- | include/gpu/vk/GrVkInterface.h | 3 |
2 files changed, 43 insertions, 1 deletions
diff --git a/include/gpu/vk/GrVkBackendContext.h b/include/gpu/vk/GrVkBackendContext.h new file mode 100644 index 0000000000..6d45a2045d --- /dev/null +++ b/include/gpu/vk/GrVkBackendContext.h @@ -0,0 +1,41 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrVkBackendContext_DEFINED +#define GrVkBackendContext_DEFINED + +#include "SkRefCnt.h" + +#include "vulkan/vulkan.h" + +#ifdef SK_DEBUG +#define ENABLE_VK_LAYERS +#endif + +struct GrVkInterface; + +// The BackendContext contains all of the base Vulkan objects needed by the GrVkGpu. The assumption +// is that the client will set these up and pass them to the GrVkGpu constructor. The VkDevice +// created must support at least one graphics queue, which is passed in as well. +// The QueueFamilyIndex must match the family of the given queue. It is needed for CommandPool +// creation, and any GrBackendObjects handed to us (e.g., for wrapped textures) need to be created +// in or transitioned to that family. +struct GrVkBackendContext : public SkRefCnt { + VkInstance fInstance; + VkPhysicalDevice fPhysicalDevice; + VkDevice fDevice; + VkQueue fQueue; + uint32_t fQueueFamilyIndex; + SkAutoTUnref<const GrVkInterface> fInterface; + + // Helper function to create the default Vulkan objects needed by the GrVkGpu object + static const GrVkBackendContext* Create(); + + ~GrVkBackendContext() override; +}; + +#endif diff --git a/include/gpu/vk/GrVkInterface.h b/include/gpu/vk/GrVkInterface.h index a6cfba73ab..cfab979bd7 100644 --- a/include/gpu/vk/GrVkInterface.h +++ b/include/gpu/vk/GrVkInterface.h @@ -26,7 +26,8 @@ struct GrVkInterface; /** * Creates a GrVkInterface. */ -const GrVkInterface* GrVkCreateInterface(VkInstance instance); +const GrVkInterface* GrVkCreateInterface(VkInstance instance, VkPhysicalDevice physDev, + VkDevice device); /** |