MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / createVulkanSurface

Method createVulkanSurface

platform/sdl/kvulkanSDL.cpp:35–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33};
34
35void* KVulkdanSDLImpl::createVulkanSurface(const XWindowPtr& wnd, void* instance) {
36 VkSurfaceKHR result = {0};
37
38#ifdef __MACH__
39 // if SDL_Vulkan_CreateSurface isn't on the main there, then it won't draw on Mac
40 DISPATCH_MAIN_THREAD_BLOCK_THIS_BEGIN_WITH_ARG2(=, &result)
41 if (!screen->additionalSDLWindowFlags) {
42 screen->additionalSDLWindowFlags = SDL_WINDOW_VULKAN;
43 screen->recreateMainWindow();
44 }
45 screen->setScreenSize(wnd->width(), wnd->height());
46 screen->showWindow(true);
47
48 if (!SDL_Vulkan_CreateSurface(screen->window, (VkInstance)instance, &result)) {
49 result = 0;
50 }
51 DISPATCH_MAIN_THREAD_BLOCK_END
52#else
53 DISPATCH_MAIN_THREAD_BLOCK_THIS_BEGIN
54 if (!screen->additionalSDLWindowFlags) {
55 screen->additionalSDLWindowFlags = SDL_WINDOW_VULKAN;
56 screen->recreateMainWindow();
57 }
58 screen->setScreenSize(wnd->width(), wnd->height());
59 screen->showWindow(true);
60 DISPATCH_MAIN_THREAD_BLOCK_END
61
62 if (!SDL_Vulkan_CreateSurface(screen->window, (VkInstance)instance, &result)) {
63 result = 0;
64 }
65#endif
66 if (!result) {
67 kwarn_fmt("Failed to create vulkan surface: %s\n", SDL_GetError());
68 }
69 return (void*)result;
70}
71
72KVulkanPtr KVulkanSDL::create(const KNativeScreenSDLPtr& screen) {
73 return std::make_shared<KVulkdanSDLImpl>(screen);

Callers 1

Calls 8

SDL_Vulkan_CreateSurfaceFunction · 0.85
kwarn_fmtFunction · 0.85
SDL_GetErrorFunction · 0.85
recreateMainWindowMethod · 0.80
heightMethod · 0.80
setScreenSizeMethod · 0.45
widthMethod · 0.45
showWindowMethod · 0.45

Tested by

no test coverage detected