Index: tools/vulkan/android/VulkanTestContext_android.cpp |
diff --git a/tools/vulkan/android/VulkanTestContext_android.cpp b/tools/vulkan/android/VulkanTestContext_android.cpp |
index 522b8399e580dabcf6e9294dbedc17593e9118e0..ea6b4288c02d1d19aea6737d79887e5a4d6ee607 100644 |
--- a/tools/vulkan/android/VulkanTestContext_android.cpp |
+++ b/tools/vulkan/android/VulkanTestContext_android.cpp |
@@ -1,6 +1,6 @@ |
/* |
- * Copyright 2015 Google Inc. |
+ * Copyright 2016 Google Inc. |
* |
* Use of this source code is governed by a BSD-style license that can be |
* found in the LICENSE file. |
@@ -9,11 +9,18 @@ |
#include "VulkanTestContext_android.h" |
#include "vk/GrVkInterface.h" |
-#include "../../src/gpu/vk/GrVkUtil.h" |
+#include "vk/GrVkUtil.h" |
-VkSurfaceKHR VulkanTestContext::createVkSurface(void* platformData) { |
- // need better error handling here |
- SkASSERT(platformData); |
+VkSurfaceKHR VulkanTestContext::createVkSurface(VkInstance instance, void* platformData) { |
+ static PFN_vkCreateAndroidSurfaceKHR createAndroidSurfaceKHR = nullptr; |
+ if (!createAndroidSurfaceKHR) { |
+ createAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr(instance, |
+ "vkCreateAndroidSurfaceKHR"); |
+ } |
+ |
+ if (!platformData) { |
+ return VK_NULL_HANDLE; |
+ } |
ContextPlatformData_android* androidPlatformData = |
reinterpret_cast<ContextPlatformData_android*>(platformData); |
VkSurfaceKHR surface; |
@@ -25,13 +32,12 @@ VkSurfaceKHR VulkanTestContext::createVkSurface(void* platformData) { |
surfaceCreateInfo.flags = 0; |
surfaceCreateInfo.window = androidPlatformData->fNativeWindow; |
- VkResult res = GR_VK_CALL(fBackendContext->fInterface, |
- CreateAndroidSurfaceKHR(fBackendContext->fInstance, |
- &surfaceCreateInfo, |
- nullptr, &surface)); |
+ VkResult res = createAndroidSurfaceKHR(fBackendContext->fInstance, &surfaceCreateInfo, |
+ nullptr, &surface); |
return (VK_SUCCESS == res) ? surface : VK_NULL_HANDLE; |
} |
-bool VulkanTestContext::canPresent(uint32_t queueFamilyIndex) { |
+bool VulkanTestContext::canPresent(VkInstance instance, VkPhysicalDevice physDev, |
+ uint32_t queueFamilyIndex) { |
return true; |
} |