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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1
2 /*
3 * Copyright 2015 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9 #include "VulkanTestContext_win.h"
10
11 #include "vk/GrVkInterface.h"
12 #include "../../src/gpu/vk/GrVkUtil.h"
13
14 // Platform dependant call
15 VkSurfaceKHR VulkanTestContext::createVkSurface(void* platformData) {
16 // need better error handling here
17 SkASSERT(platformData);
18 ContextPlatformData_win* winPlatformData =
19 reinterpret_cast<ContextPlatformData_ win*>(platformData);
20 VkSurfaceKHR surface;
21
22 VkWin32SurfaceCreateInfoKHR surfaceCreateInfo;
23 memset(&surfaceCreateInfo, 0, sizeof(VkWin32SurfaceCreateInfoKHR));
24 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
25 surfaceCreateInfo.pNext = nullptr;
26 surfaceCreateInfo.flags = 0;
27 surfaceCreateInfo.hinstance = winPlatformData->fHInstance;
28 surfaceCreateInfo.hwnd = winPlatformData->fHWnd;
29
30 VkResult res = GR_VK_CALL(fBackendContext->fInterface,
31 CreateWin32SurfaceKHR(fBackendContext->fInstance, &surfaceCreateInfo,
32 nullptr, &surface));
33 if (VK_SUCCESS != res) {
34 return VK_NULL_HANDLE;
35 }
36
37 return surface;
38 }
39
40 // Platform dependant call
41 bool VulkanTestContext::canPresent(uint32_t queueFamilyIndex) {
42 VkBool32 check = GR_VK_CALL(fBackendContext->fInterface,
43 GetPhysicalDeviceWin32PresentationSupportKHR(
44 fBackendConte xt->fPhysicalDevice,
45 queueFamilyIn dex));
46 return (VK_FALSE != check);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698