view src/zamikongine/platform/linux/vulkan.nim @ 38:c3c963e7c1a6

did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
author Sam <sam@basx.dev>
date Wed, 18 Jan 2023 09:52:03 +0700
parents
children
line wrap: on
line source

# included in zamikongine/vulkan_helpers
const REQUIRED_PLATFORM_EXTENSIONS = @["VK_KHR_xlib_surface".cstring]

proc load_platform_extensions() =
  loadVK_KHR_xlib_surface()

proc createVulkanSurface*(instance: VkInstance, window: NativeWindow): VkSurfaceKHR =
  var surfaceCreateInfo = VkXlibSurfaceCreateInfoKHR(
    sType: VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
    dpy: window.display,
    window: window.window,
  )
  checkVkResult vkCreateXlibSurfaceKHR(instance, addr(surfaceCreateInfo), nil, addr(result))