aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/sk_app/VulkanWindowContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sk_app/VulkanWindowContext.h')
-rw-r--r--tools/sk_app/VulkanWindowContext.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/sk_app/VulkanWindowContext.h b/tools/sk_app/VulkanWindowContext.h
index 1fca9dc83e..79298f6b38 100644
--- a/tools/sk_app/VulkanWindowContext.h
+++ b/tools/sk_app/VulkanWindowContext.h
@@ -13,6 +13,8 @@
#ifdef SK_VULKAN
#include "vk/GrVkBackendContext.h"
+#include "vk/GrVkInterface.h"
+#include "vk/VkTestUtils.h"
#include "WindowContext.h"
class GrRenderTarget;
@@ -26,7 +28,7 @@ public:
sk_sp<SkSurface> getBackbufferSurface() override;
void swapBuffers() override;
- bool isValid() override { return SkToBool(fBackendContext.get()); }
+ bool isValid() override { return fDevice != VK_NULL_HANDLE; }
void resize(int w, int h) override {
this->createSwapchain(w, h, fDisplayParams);
@@ -41,7 +43,7 @@ public:
/** Platform specific function that creates a VkSurfaceKHR for a window */
using CreateVkSurfaceFn = std::function<VkSurfaceKHR(VkInstance)>;
/** Platform specific function that determines whether presentation will succeed. */
- using CanPresentFn = GrVkBackendContext::CanPresentFn;
+ using CanPresentFn = sk_gpu_test::CanPresentFn;
VulkanWindowContext(const DisplayParams&, CreateVkSurfaceFn, CanPresentFn,
PFN_vkGetInstanceProcAddr, PFN_vkGetDeviceProcAddr);
@@ -63,7 +65,9 @@ private:
void createBuffers(VkFormat format, SkColorType colorType);
void destroyBuffers();
- sk_sp<const GrVkBackendContext> fBackendContext;
+ VkInstance fInstance = VK_NULL_HANDLE;
+ VkPhysicalDevice fPhysicalDevice = VK_NULL_HANDLE;
+ VkDevice fDevice = VK_NULL_HANDLE;
// simple wrapper class that exists only to initialize a pointer to NULL
template <typename FNPTR_TYPE> class VkPtr {
@@ -95,10 +99,19 @@ private:
VkPtr<PFN_vkGetSwapchainImagesKHR> fGetSwapchainImagesKHR;
VkPtr<PFN_vkAcquireNextImageKHR> fAcquireNextImageKHR;
VkPtr<PFN_vkQueuePresentKHR> fQueuePresentKHR;
+
+ VkPtr<PFN_vkDestroyInstance> fDestroyInstance;
+ VkPtr<PFN_vkDeviceWaitIdle> fDeviceWaitIdle;
+ VkPtr<PFN_vkQueueWaitIdle> fQueueWaitIdle;
+ VkPtr<PFN_vkDestroyDevice> fDestroyDevice;
VkPtr<PFN_vkGetDeviceQueue> fGetDeviceQueue;
+ sk_sp<const GrVkInterface> fInterface;
+
VkSurfaceKHR fSurface;
VkSwapchainKHR fSwapchain;
+ uint32_t fGraphicsQueueIndex;
+ VkQueue fGraphicsQueue;
uint32_t fPresentQueueIndex;
VkQueue fPresentQueue;