Home -> PlatformBindings
Description
The PlatformBindings.pkg header provides the platform-specific pieces that are deliberately kept out of the core renderer interfaces. These pieces describe native window systems, native windows, SDL3 integration helpers, and renderer plugin loading helpers.
The core renderer APIs accept base structures such as IRenderer.WindowSystemInfoBase and IFrameBuffer.WindowInfoBase. The concrete structures documented in this section fill those base structures for Win32, Xlib, XCB, Wayland, AppKit, SDL3, and headless operation.
Important
If COBALT_RENDERER_MANUAL_PLATFORM_BINDINGS is not defined, PlatformBindings.pkg auto-selects bindings for the current platform. Windows enables Win32 bindings, Linux enables Wayland, XCB, and Xlib bindings, and macOS enables AppKit bindings.
Important
Headless window system and framebuffer window information structures are included on all platforms. They are used when rendering without a native operating system window or presentation surface.
Important
SDL3 helpers are enabled only when COBALT_RENDERER_SDL3_SUPPORT is defined. Automatic SDL3 detection is performed when COBALT_RENDERER_NO_SDL_DETECTION is not defined and <SDL3/SDL.h> is available.
Warning
The RenderPluginEnumerator helper is included by PlatformBindings.pkg only for C++17 or newer builds, because it uses std::filesystem.
Platform selection macros
- COBALT_RENDERER_WIN32_SUPPORT: exposes Win32 window and module-handle bindings. Automatically enabled on Windows.
- COBALT_RENDERER_XLIB_SUPPORT: exposes Xlib window bindings. Automatically enabled on Linux.
- COBALT_RENDERER_XCB_SUPPORT: exposes XCB window bindings. Automatically enabled on Linux.
- COBALT_RENDERER_WAYLAND_SUPPORT: exposes Wayland window bindings. Automatically enabled on Linux.
- COBALT_RENDERER_APPKIT_SUPPORT: exposes AppKit window bindings. Automatically enabled on macOS.
- COBALT_RENDERER_SDL3_SUPPORT: exposes SDL3 window binding helpers when SDL3 support is selected or detected.
- COBALT_RENDERER_MANUAL_PLATFORM_BINDINGS: disables automatic platform selection so the application can define the binding macros it wants before including the package.
- COBALT_RENDERER_STRIP_X11_PREPROCESSOR_MACROS: controls whether X11 preprocessor macros are undefined after their values are copied to the wrapped constants in X11Constants. Defaults to enabled.
Usage
#include <Cobalt/RendererInterface/PlatformBindings.pkg>Types
Renderer Plugins
| Name | Description | |
|---|---|---|
| IRendererPlugin |
Interface filled by renderer plugins to describe an available renderer implementation before it is wrapped by a RendererPlugin.
|
|
| RendererPlugin |
Strong owning renderer plugin object used by applications and plugin loading helpers.
|
|
| RenderPluginEnumerator |
Helper for finding renderer plugin libraries, reading renderer plugin records, and selecting a preferred plugin.
|
|
| IModuleHandle |
Reference-counted module handle interface used to keep renderer plugin libraries loaded.
|
|
| ModuleHandleWin32 |
Windows module handle implementation used to keep renderer plugin DLLs loaded.
|
|
| ModuleHandlePosix |
POSIX module handle implementation used to keep renderer plugin shared libraries loaded.
|
Window System Info
| Name | Description | |
|---|---|---|
| WindowSystemInfoHeadless |
Window system information for renderer initialization with no native window system.
|
|
| WindowSystemInfoWin32 |
Window system information for Win32 renderer initialization.
|
|
| WindowSystemInfoXlib |
Window system information for Xlib renderer initialization.
|
|
| WindowSystemInfoXCB |
Window system information for XCB renderer initialization.
|
|
| WindowSystemInfoWayland |
Window system information for Wayland renderer initialization.
|
|
| WindowSystemInfoAppKit |
Window system information for AppKit renderer initialization on macOS.
|
Window Info
| Name | Description | |
|---|---|---|
| WindowInfoHeadless |
Window-sized framebuffer binding information for headless rendering.
|
|
| WindowInfoWin32 |
Native Win32 window information for framebuffer window binding.
|
|
| WindowInfoXlib |
Native Xlib window information for framebuffer window binding.
|
|
| X11Constants |
Wrapped constants for selected X11 macro values retained by the Xlib wrapper header.
|
|
| WindowInfoXCB |
Native XCB window information for framebuffer window binding.
|
|
| WindowInfoWayland |
Native Wayland window information for framebuffer window binding.
|
|
| WindowInfoAppKit |
Native AppKit view information for framebuffer window binding on macOS.
|
SDL3 Helpers
| Name | Description | |
|---|---|---|
| WindowSystemInfoSDL3 |
SDL3 helper that builds the appropriate renderer window system information structure.
|
|
| WindowInfoSDL3 |
SDL3 helper that builds the appropriate framebuffer window information structure.
|
Functions
Renderer Plugins
| Name | Description | |
|---|---|---|
| GetCobaltAPIVersion |
Renderer plugin export used to check Cobalt Renderer API compatibility before renderer plugin records are queried.
|
|
| GetRendererPlugin |
Renderer plugin export used to retrieve a renderer plugin record from a loaded plugin library.
|
SDL3 Helpers
| Name | Description | |
|---|---|---|
| CobaltSDLCreateWindow |
Creates an SDL3 window configured for use with Cobalt-managed graphics contexts.
|