platform-glfw-vulkan
Garnet GLFW Vulkan host
require "garnet-platform-glfw-vulkan" provides Garnet::Platform::VulkanGLFWHost.open. It creates a no-API GLFW window, obtains required instance extensions, creates its Vulkan surface and owns a compatible Garnet renderer. The scoped host exposes renderer, poll_events, framebuffer_size, and present.
Window operations run on the process main thread. The renderer owns swapchain creation/recreation and presentation; teardown closes it before destroying the window. Do not nest independently managed GLFW sessions. See the complete example; build it with scripts/check-vulkan build from the workspace.
GLFW is one desktop host implementation. The standalone Vulkan API and offscreen renderer do not depend on it; mobile and console hosts remain separate future packages.
The host uses the independent glfw shard's typed window and session API. To run directly from this directory, install dependencies with shards install and run crystal run examples/primitives.cr. On macOS the Vulkan loader also needs a runtime search path. For a loader installed in /usr/local/lib, use:
crystal run examples/primitives.cr --link-flags="-L/usr/local/lib -Wl,-rpath,/usr/local/lib"
Use your SDK's lib directory instead if installed elsewhere. The workspace build script supplies these search paths automatically.
The host also reports logical_size, focused?, iconified? and closed?, and offers wait_events, matching Platform::GLFWHost. Feed input with Garnet::Platform::GLFWInput from garnet-platform-glfw/input, which works with any GLFW window.
platform-glfw-vulkan
- 0
- 0
- 0
- 1
- 2
- 1 day ago
- November 30, 2026
MIT License
Wed, 02 Dec 2026 02:09:38 GMT