diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/vk/GrVkBackendContext.h | 8 | ||||
-rw-r--r-- | include/gpu/vk/GrVkDefines.h | 18 | ||||
-rw-r--r-- | include/gpu/vk/GrVkInterface.h | 24 |
3 files changed, 29 insertions, 21 deletions
diff --git a/include/gpu/vk/GrVkBackendContext.h b/include/gpu/vk/GrVkBackendContext.h index 5e51beea6b..5ae7b31656 100644 --- a/include/gpu/vk/GrVkBackendContext.h +++ b/include/gpu/vk/GrVkBackendContext.h @@ -11,8 +11,7 @@ #include "SkRefCnt.h" #include "vk/GrVkDefines.h" - -struct GrVkInterface; +#include "vk/GrVkInterface.h" enum GrVkExtensionFlags { kEXT_debug_report_GrVkExtensionFlag = 0x0001, @@ -51,10 +50,13 @@ struct GrVkBackendContext : public SkRefCnt { 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. static const GrVkBackendContext* Create(uint32_t* presentQueueIndex = nullptr, - CanPresentFn = CanPresentFn()); + CanPresentFn = CanPresentFn(), + GrVkInterface::GetProc getProc = nullptr); ~GrVkBackendContext() override; }; diff --git a/include/gpu/vk/GrVkDefines.h b/include/gpu/vk/GrVkDefines.h index 9caf2d75e5..ff8f2131f6 100644 --- a/include/gpu/vk/GrVkDefines.h +++ b/include/gpu/vk/GrVkDefines.h @@ -10,11 +10,23 @@ #define GrVkDefines_DEFINED #if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_WIN32) -# define VK_USE_PLATFORM_WIN32_KHR +# if !defined(VK_USE_PLATFORM_WIN32_KHR) +# define VK_USE_PLATFORM_WIN32_KHR +# endif #elif defined(SK_BUILD_FOR_ANDROID) -# define VK_USE_PLATFORM_ANDROID_KHR +# if !defined(VK_USE_PLATFORM_ANDROID_KHR) +# define VK_USE_PLATFORM_ANDROID_KHR +# endif #elif defined(SK_BUILD_FOR_UNIX) -# define VK_USE_PLATFORM_XCB_KHR +# if defined(__Fuchsia__) +# if !defined(VK_USE_PLATFORM_MAGMA_KHR) +# define VK_USE_PLATFORM_MAGMA_KHR +# endif +# else +# if !defined(VK_USE_PLATFORM_XCB_KHR) +# define VK_USE_PLATFORM_XCB_KHR +# endif +# endif #endif #if defined(Bool) || defined(Status) || defined(True) || defined(False) diff --git a/include/gpu/vk/GrVkInterface.h b/include/gpu/vk/GrVkInterface.h index 9dc033392c..dca47ffc4c 100644 --- a/include/gpu/vk/GrVkInterface.h +++ b/include/gpu/vk/GrVkInterface.h @@ -15,20 +15,6 @@ //////////////////////////////////////////////////////////////////////////////// /** - * The default interface is returned by GrVkCreateInterface. This function's - * implementation is platform-specific. - */ - -struct GrVkInterface; - -/** - * Creates a GrVkInterface. - */ -const GrVkInterface* GrVkCreateInterface(VkInstance instance, VkDevice device, - uint32_t extensionFlags); - - -/** * GrContext uses the following interface to make all calls into Vulkan. When a * GrContext is created it is given a GrVkInterface. All functions that should be * available based on the Vulkan's version must be non-NULL or GrContext creation @@ -49,7 +35,15 @@ private: typedef SkRefCnt INHERITED; public: - GrVkInterface(); + using GetProc = std::function<PFN_vkVoidFunction( + const char*, // function name + VkInstance, // instance or VK_NULL_HANDLE + VkDevice // device or VK_NULL_HANDLE + )>; + GrVkInterface(GetProc getProc, + VkInstance instance, + VkDevice device, + uint32_t extensionFlags); // Validates that the GrVkInterface supports its advertised standard. This means the necessary // function pointers have been initialized for Vulkan version. |