Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: tools/vulkan/android/VulkanTestContext_android.cpp

Issue 1903253003: VulkanViewer on Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: gyp Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/vulkan/android/VulkanTestContext_android.h ('k') | tools/vulkan/android/Window_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/vulkan/android/VulkanTestContext_android.cpp
diff --git a/tools/vulkan/android/VulkanTestContext_android.cpp b/tools/vulkan/android/VulkanTestContext_android.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..522b8399e580dabcf6e9294dbedc17593e9118e0
--- /dev/null
+++ b/tools/vulkan/android/VulkanTestContext_android.cpp
@@ -0,0 +1,37 @@
+
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "VulkanTestContext_android.h"
+
+#include "vk/GrVkInterface.h"
+#include "../../src/gpu/vk/GrVkUtil.h"
+
+VkSurfaceKHR VulkanTestContext::createVkSurface(void* platformData) {
+ // need better error handling here
+ SkASSERT(platformData);
+ ContextPlatformData_android* androidPlatformData =
+ reinterpret_cast<ContextPlatformData_android*>(platformData);
+ VkSurfaceKHR surface;
+
+ VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo;
+ memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR));
+ surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
+ surfaceCreateInfo.pNext = nullptr;
+ surfaceCreateInfo.flags = 0;
+ surfaceCreateInfo.window = androidPlatformData->fNativeWindow;
+
+ VkResult res = GR_VK_CALL(fBackendContext->fInterface,
+ CreateAndroidSurfaceKHR(fBackendContext->fInstance,
+ &surfaceCreateInfo,
+ nullptr, &surface));
+ return (VK_SUCCESS == res) ? surface : VK_NULL_HANDLE;
+}
+
+bool VulkanTestContext::canPresent(uint32_t queueFamilyIndex) {
+ return true;
+}
« no previous file with comments | « tools/vulkan/android/VulkanTestContext_android.h ('k') | tools/vulkan/android/Window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698