Rether / docs
engine/apis/vulkan/Vulkan surface
gardenThe bridge between the window and Vulkan

Vulkan surface

updated 2026.08.29created 2026.08.29~1 min

The concept

Vulkan is an agnostic API: it does not know what a "window" is in Windows, macOS, or Linux. To draw on the screen, we need to create a bridge between the windowing system (managed here by GLFW, see Window & Native surface) and Vulkan. This bridge is called the surface (VkSurfaceKHR).

The surface is just an abstract connection to the window — it does not hold any actual pixels. It is created right after the Vulkan instance, and the Vulkan physical device is then checked against it (a GPU must be able to present to this surface, see Vulkan queue families).

In game engine

This step is handled by glfwCreateWindowSurface, which abstracts away the OS-specific complexity:

// cpp
bool VulkanContext::createSurface()
{
    VkSurfaceKHR surface;
    if (glfwCreateWindowSurface(*d_instance,
                                d_platform_p->window(),
                                nullptr,
                                &surface) != VK_SUCCESS) {
        std::cerr << "Failed to create window surface." << std::endl;
        return false;
    }
    d_surface = vk::raii::SurfaceKHR(d_instance, surface);
    return true;
}

Keyboard

search this vault⌘K / /
step the sidebarjk
open selected↵
switch browse mode123
switch vaultgv
toggle themet
close / clearesc
this help?
esc to close