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

Side by Side Diff: tools/viewer/sk_app/win/VulkanWindowContext_win.cpp

Issue 1944413005: More refactoring for Viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix up Android Created 4 years, 7 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
« no previous file with comments | « tools/viewer/sk_app/win/VulkanWindowContext_win.h ('k') | tools/viewer/sk_app/win/Window_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2016 Google Inc. 3 * Copyright 2016 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "VulkanTestContext_win.h" 9 #include "VulkanWindowContext_win.h"
10 10
11 #include "vk/GrVkInterface.h" 11 #include "vk/GrVkInterface.h"
12 #include "vk/GrVkUtil.h" 12 #include "vk/GrVkUtil.h"
13 13
14 namespace sk_app {
15
14 // Platform dependant call 16 // Platform dependant call
15 VkSurfaceKHR VulkanTestContext::createVkSurface(VkInstance instance, void* platf ormData) { 17 VkSurfaceKHR VulkanWindowContext::createVkSurface(VkInstance instance, void* pla tformData) {
16 static PFN_vkCreateWin32SurfaceKHR createWin32SurfaceKHR = nullptr; 18 static PFN_vkCreateWin32SurfaceKHR createWin32SurfaceKHR = nullptr;
17 if (!createWin32SurfaceKHR) { 19 if (!createWin32SurfaceKHR) {
18 createWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAd dr(instance, 20 createWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR) vkGetInstanceProcA ddr(instance,
19 "vkCrea teWin32SurfaceKHR"); 21 "vkCreat eWin32SurfaceKHR");
20 } 22 }
21 23
22 if (!platformData) { 24 if (!platformData) {
23 return VK_NULL_HANDLE; 25 return VK_NULL_HANDLE;
24 } 26 }
25 ContextPlatformData_win* winPlatformData = 27 ContextPlatformData_win* winPlatformData =
26 reinterpret_cast<ContextPlatformData_ win*>(platformData); 28 reinterpret_cast<ContextPlatformData_w in*>(platformData);
27 VkSurfaceKHR surface; 29 VkSurfaceKHR surface;
28 30
29 VkWin32SurfaceCreateInfoKHR surfaceCreateInfo; 31 VkWin32SurfaceCreateInfoKHR surfaceCreateInfo;
30 memset(&surfaceCreateInfo, 0, sizeof(VkWin32SurfaceCreateInfoKHR)); 32 memset(&surfaceCreateInfo, 0, sizeof(VkWin32SurfaceCreateInfoKHR));
31 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; 33 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
32 surfaceCreateInfo.pNext = nullptr; 34 surfaceCreateInfo.pNext = nullptr;
33 surfaceCreateInfo.flags = 0; 35 surfaceCreateInfo.flags = 0;
34 surfaceCreateInfo.hinstance = winPlatformData->fHInstance; 36 surfaceCreateInfo.hinstance = winPlatformData->fHInstance;
35 surfaceCreateInfo.hwnd = winPlatformData->fHWnd; 37 surfaceCreateInfo.hwnd = winPlatformData->fHWnd;
36 38
37 VkResult res = createWin32SurfaceKHR(instance, &surfaceCreateInfo, nullptr, &surface); 39 VkResult res = createWin32SurfaceKHR(instance, &surfaceCreateInfo, nullptr, &surface);
38 if (VK_SUCCESS != res) { 40 if (VK_SUCCESS != res) {
39 return VK_NULL_HANDLE; 41 return VK_NULL_HANDLE;
40 } 42 }
41 43
42 return surface; 44 return surface;
43 } 45 }
44 46
45 // Platform dependant call 47 // Platform dependant call
46 bool VulkanTestContext::canPresent(VkInstance instance, VkPhysicalDevice physDev , 48 bool VulkanWindowContext::canPresent(VkInstance instance, VkPhysicalDevice physD ev,
47 uint32_t queueFamilyIndex) { 49 uint32_t queueFamilyIndex) {
48 static PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR 50 static PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
49 getPhysicalDeviceWin32PresentationS upportKHR = nullptr; 51 getPhysicalDeviceWin32PresentationSu pportKHR = nullptr;
50 if (!getPhysicalDeviceWin32PresentationSupportKHR) { 52 if (!getPhysicalDeviceWin32PresentationSupportKHR) {
51 getPhysicalDeviceWin32PresentationSupportKHR = 53 getPhysicalDeviceWin32PresentationSupportKHR =
52 (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR) vkGetInstancePr ocAddr(instance, 54 (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR) vkGetInstancePr ocAddr(instance,
53 "vkGetPhysicalDeviceWin32Prese ntationSupportKHR"); 55 "vkGetPhysicalDeviceWin32Presen tationSupportKHR");
54 } 56 }
55 57
56 VkBool32 check = getPhysicalDeviceWin32PresentationSupportKHR(physDev, queue FamilyIndex); 58 VkBool32 check = getPhysicalDeviceWin32PresentationSupportKHR(physDev, queue FamilyIndex);
57 return (VK_FALSE != check); 59 return (VK_FALSE != check);
58 } 60 }
61
62 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/win/VulkanWindowContext_win.h ('k') | tools/viewer/sk_app/win/Window_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698