7#ifndef VulkanWindowContext_DEFINED
8#define VulkanWindowContext_DEFINED
20namespace skgpu {
struct VulkanInterface; }
24class VulkanWindowContext :
public WindowContext {
26 ~VulkanWindowContext()
override;
32 void resize(
int w,
int h)
override {
33 this->createSwapchain(
w,
h, fDisplayParams);
36 void setDisplayParams(
const DisplayParams&
params)
override {
37 this->destroyContext();
39 this->initializeContext();
43 using CreateVkSurfaceFn =
std::function<VkSurfaceKHR(VkInstance)>;
45 using CanPresentFn = sk_gpu_test::CanPresentFn;
47 VulkanWindowContext(
const DisplayParams&, CreateVkSurfaceFn, CanPresentFn,
51 void initializeContext();
52 void destroyContext();
54 struct BackbufferInfo {
56 VkSemaphore fRenderSemaphore;
59 BackbufferInfo* getAvailableBackbuffer();
62 void destroyBuffers();
63 void onSwapBuffers()
override;
71 CreateVkSurfaceFn fCreateVkSurfaceFn;
72 CanPresentFn fCanPresentFn;
98 VkSurfaceKHR fSurface;
99 VkSwapchainKHR fSwapchain;
100 uint32_t fGraphicsQueueIndex;
101 VkQueue fGraphicsQueue;
102 uint32_t fPresentQueueIndex;
103 VkQueue fPresentQueue;
105 uint32_t fImageCount;
109 BackbufferInfo* fBackbuffers;
110 uint32_t fCurrentBackbufferIndex;
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
const EmbeddedViewParams * params
uint32_t uint32_t * format
Dart_NativeFunction function
void(VKAPI_PTR * PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
VkResult(VKAPI_PTR * PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages)
void(VKAPI_PTR * PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue)
VkFlags VkImageUsageFlags
void(VKAPI_PTR * PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks *pAllocator)
VkResult(VKAPI_PTR * PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
void(VKAPI_PTR * PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator)
VkResult(VKAPI_PTR * PFN_vkQueueWaitIdle)(VkQueue queue)
VkResult(VKAPI_PTR * PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported)
void(VKAPI_PTR * PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks *pAllocator)
VkResult(VKAPI_PTR * PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain)
VkResult(VKAPI_PTR * PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR *pPresentInfo)
VkResult(VKAPI_PTR * PFN_vkDeviceWaitIdle)(VkDevice device)
VkResult(VKAPI_PTR * PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats)
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
VkResult(VKAPI_PTR * PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex)
VkResult(VKAPI_PTR * PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes)
void(VKAPI_PTR * PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator)