referenceWindow & Native surface
Window & Native surface
The concept
A window or native surface is a abstraction provided by the OS to reserve display space on the screen and capture user interactions.
In game engine
The window fulfills three essential roles:
- The render target: The GPU cannot draw "into thin air". To display pixels to
the user, the graphics API needs a bridge to the OS. The window provides the
native handle (e.g.,
HWNDon Windows,Windowon X11/Linux,CAMetalLayeron macOS) that allows the API to create the Swapchain. - Event handling (Event Pump): The window intercepts signals from the OS (mouse movement, key presses, window closure, loss of focus) and forwards them to the engine’s input system.
- Resolution and aspect ratio management (Framebuffer Extent): This defines the display buffer’s size in pixels and indicates when that size changes (resizing).
Swapchain
Relation with other engine concepts
- Swapchain: The Swapchain is window-dependent. If the window size changes, the Swapchain must be destroyed and then reallocated to accommodate the new resolution.
- Input Manager: The Input Manager reads the events captured by the window for each frame via an interrogation request.
- Main Loop: This window controls the application's lifetime. If the user clicks the X, the main loop stops.
Linked references 3
notes that point at this one
Swapchainengine
If that surface changes — most commonly a Window & Native surface resize — the images no longer match and the swapchain must be torn down and rebuilt at the new reso…
Vulkan surfacevulkan
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.
Architecturegamegine
In order: Window — a Window & Native surface is created and shown (GLFW).