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

Unified Diff: tools/vulkan/win/VulkanTestContext_win.cpp

Issue 1848833005: First pass at VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments, plus add GM rendering 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
Index: tools/vulkan/win/VulkanTestContext_win.cpp
diff --git a/tools/vulkan/win/VulkanTestContext_win.cpp b/tools/vulkan/win/VulkanTestContext_win.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a4f49e3a209617ee6ea17906708a7feb2a5c2db8
--- /dev/null
+++ b/tools/vulkan/win/VulkanTestContext_win.cpp
@@ -0,0 +1,47 @@
+
+/*
+ * 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_win.h"
+
+#include "vk/GrVkInterface.h"
+#include "../../src/gpu/vk/GrVkUtil.h"
+
+// Platform dependant call
+VkSurfaceKHR VulkanTestContext::createVkSurface(void* platformData) {
+ // need better error handling here
+ SkASSERT(platformData);
+ ContextPlatformData_win* winPlatformData =
+ reinterpret_cast<ContextPlatformData_win*>(platformData);
+ VkSurfaceKHR surface;
+
+ VkWin32SurfaceCreateInfoKHR surfaceCreateInfo;
+ memset(&surfaceCreateInfo, 0, sizeof(VkWin32SurfaceCreateInfoKHR));
+ surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
+ surfaceCreateInfo.pNext = nullptr;
+ surfaceCreateInfo.flags = 0;
+ surfaceCreateInfo.hinstance = winPlatformData->fHInstance;
+ surfaceCreateInfo.hwnd = winPlatformData->fHWnd;
+
+ VkResult res = GR_VK_CALL(fBackendContext->fInterface,
+ CreateWin32SurfaceKHR(fBackendContext->fInstance, &surfaceCreateInfo,
+ nullptr, &surface));
+ if (VK_SUCCESS != res) {
+ return VK_NULL_HANDLE;
+ }
+
+ return surface;
+}
+
+// Platform dependant call
+bool VulkanTestContext::canPresent(uint32_t queueFamilyIndex) {
+ VkBool32 check = GR_VK_CALL(fBackendContext->fInterface,
+ GetPhysicalDeviceWin32PresentationSupportKHR(
+ fBackendContext->fPhysicalDevice,
+ queueFamilyIndex));
+ return (VK_FALSE != check);
+}

Powered by Google App Engine
This is Rietveld 408576698