Update vulkan features (again) to support extension features.
We need to handle all the possible ways a client is allowed to initialize
features on Vulkan.
Bug: skia:
Change-Id: I98b1dee2efa2c22c26ce093c590c7ccd0b626969
Reviewed-on: https://skia-review.googlesource.com/145530
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/tools/sk_app/VulkanWindowContext.cpp b/tools/sk_app/VulkanWindowContext.cpp
index c82d4f9..69dc2c5 100644
--- a/tools/sk_app/VulkanWindowContext.cpp
+++ b/tools/sk_app/VulkanWindowContext.cpp
@@ -61,13 +61,16 @@
};
GrVkBackendContext backendContext;
GrVkExtensions extensions;
- if (!sk_gpu_test::CreateVkBackendContext(getProc, &backendContext, &extensions, &fDebugCallback,
- &fPresentQueueIndex, fCanPresentFn)) {
+ VkPhysicalDeviceFeatures2 features;
+ if (!sk_gpu_test::CreateVkBackendContext(getProc, &backendContext, &extensions, &features,
+ &fDebugCallback, &fPresentQueueIndex, fCanPresentFn)) {
+ sk_gpu_test::FreeVulkanFeaturesStructs(&features);
return;
}
if (!extensions.hasExtension(VK_KHR_SURFACE_EXTENSION_NAME, 25) ||
!extensions.hasExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME, 68)) {
+ sk_gpu_test::FreeVulkanFeaturesStructs(&features);
return;
}
@@ -83,6 +86,7 @@
backendContext.fInstance,
VK_NULL_HANDLE));
if (!localGetPhysicalDeviceProperties) {
+ sk_gpu_test::FreeVulkanFeaturesStructs(&features);
return;
}
VkPhysicalDeviceProperties physDeviceProperties;
@@ -117,6 +121,7 @@
fSurface = fCreateVkSurfaceFn(fInstance);
if (VK_NULL_HANDLE == fSurface) {
this->destroyContext();
+ sk_gpu_test::FreeVulkanFeaturesStructs(&features);
return;
}
@@ -125,16 +130,19 @@
fSurface, &supported);
if (VK_SUCCESS != res) {
this->destroyContext();
+ sk_gpu_test::FreeVulkanFeaturesStructs(&features);
return;
}
if (!this->createSwapchain(-1, -1, fDisplayParams)) {
this->destroyContext();
+ sk_gpu_test::FreeVulkanFeaturesStructs(&features);
return;
}
// create presentQueue
fGetDeviceQueue(fDevice, fPresentQueueIndex, 0, &fPresentQueue);
+ sk_gpu_test::FreeVulkanFeaturesStructs(&features);
}
bool VulkanWindowContext::createSwapchain(int width, int height,