MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / initializeContext

Method initializeContext

src/VulkanContext/VulkanWindowContext.cpp:59–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void VulkanWindowContext::initializeContext() {
60 SkASSERT(!fContext);
61 // any config code here (particularly for msaa)?
62
63 PFN_vkGetInstanceProcAddr getInstanceProc = fGetInstanceProcAddr;
64 skgpu::VulkanBackendContext backendContext;
65 skgpu::VulkanExtensions extensions;
66 VkPhysicalDeviceFeatures2 features;
67 if (!sk_gpu_test::CreateVkBackendContext(getInstanceProc,
68 &backendContext,
69 &extensions,
70 &features,
71 &fDebugCallback,
72 &fPresentQueueIndex,
73 fCanPresentFn,
74 fDisplayParams->createProtectedNativeBackend())) {
75 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
76 return;
77 }
78
79 if (!extensions.hasExtension(VK_KHR_SURFACE_EXTENSION_NAME, 25) ||
80 !extensions.hasExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME, 68)) {
81 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
82 return;
83 }
84
85 fInstance = backendContext.fInstance;
86 fPhysicalDevice = backendContext.fPhysicalDevice;
87 fDevice = backendContext.fDevice;
88 fGraphicsQueueIndex = backendContext.fGraphicsQueueIndex;
89 fGraphicsQueue = backendContext.fQueue;
90
91 PFN_vkGetPhysicalDeviceProperties localGetPhysicalDeviceProperties =
92 reinterpret_cast<PFN_vkGetPhysicalDeviceProperties>(
93 backendContext.fGetProc("vkGetPhysicalDeviceProperties",
94 backendContext.fInstance,
95 VK_NULL_HANDLE));
96 if (!localGetPhysicalDeviceProperties) {
97 sk_gpu_test::FreeVulkanFeaturesStructs(&features);
98 return;
99 }
100 VkPhysicalDeviceProperties physDeviceProperties;
101 localGetPhysicalDeviceProperties(backendContext.fPhysicalDevice, &physDeviceProperties);
102 uint32_t physDevVersion = physDeviceProperties.apiVersion;
103
104 fInterface.reset(new skgpu::VulkanInterface(backendContext.fGetProc,
105 fInstance,
106 fDevice,
107 backendContext.fMaxAPIVersion,
108 physDevVersion,
109 &extensions));
110
111 GET_PROC(DestroyInstance);
112 if (fDebugCallback != VK_NULL_HANDLE) {
113 GET_PROC(DestroyDebugReportCallbackEXT);
114 }
115 GET_PROC(DestroySurfaceKHR);
116 GET_PROC(GetPhysicalDeviceSurfaceSupportKHR);

Callers 2

setDisplayParamsMethod · 0.95
VulkanWindowContextMethod · 0.95

Calls 6

destroyContextMethod · 0.95
createSwapchainMethod · 0.95
CreateVkBackendContextFunction · 0.85
resetMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected