Rether / docs
engine/apis/vulkan/Vulkan extensions
gardenHow a platform-independent API reaches the platform

Vulkan extensions

updated 2026.08.29created 2026.08.29~2 min

The concept

Vulkan is designed to be platform-independent. By default, it does not know how to communicate with the window manager of our operating system (Windows, Linux, etc.). We therefore need to help it by providing extensions when creating the Vulkan instance.

When using the GLFW library, we can retrieve these extensions by calling the glfwGetRequiredInstanceExtensions function:

// cpp
std::vector<const char*> extensions;
uint32_t glfwExtensionCount = 0;
const char** glfwExt = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
extensions.insert(extensions.end(),
                  glfwExt,
                  glfwExt + glfwExtensionCount);

We can also add VK_EXT_DEBUG_UTILS_EXTENSION_NAME for debug utils:

// cpp
extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);

And on macOS we need another extension to communicate with the MoltenVK API:

// cpp
#if defined(__APPLE__)
    extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
#endif

As with validation layers, we also need to check that our extensions are available on this machine. This is necessary because if we try to use a Windows extension such as VK_KHR_win32_surface on Linux, it will cause a crash because the extension is invalid. The same applies to GPUs: if we use an NVIDIA extension on an AMD card, it will also crash.

// cpp
bool checkExtensionsSupport(
    const std::vector<const char*>&             requiredExtensions,
    const std::vector<vk::ExtensionProperties>& availableExtensions)
{
    for (const auto& required : requiredExtensions) {
        const bool found = std::ranges::any_of(
            availableExtensions,
            [required](const auto& prop) {
                return strcmp(prop.extensionName, required) == 0;
            });

        if (!found) {
            std::cerr << "[Error] Missing required extension: " << required
                      << std::endl;
            return false;
        }
    }
    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