view src/semicongine/platform/linux/surface.nim @ 96:b9fc90de1450

add: swapchain API, more refactoring
author Sam <sam@basx.dev>
date Wed, 01 Mar 2023 23:58:39 +0700
parents f036546f5ea2
children 7f921d7d0a2b
line wrap: on
line source

import ../../vulkan/api
import ../../platform/window

proc createNativeSurface*(instance: VkInstance, window: NativeWindow): VkSurfaceKHR =
  assert instance.valid
  var surfaceCreateInfo = VkXlibSurfaceCreateInfoKHR(
    sType: VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
    dpy: cast[ptr api.Display](window.display),
    window: cast[api.Window](window.window),
  )
  checkVkResult vkCreateXlibSurfaceKHR(instance, addr(surfaceCreateInfo), nil, addr(result))