Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
sdl3_surface.hpp
Go to the documentation of this file.
1#pragma once
2
3// SDL3 Native Surface Extraction
4// Extracts platform-specific window handles from SDL3 windows for Dawn/WebGPU
5// surface creation. Each platform provides the appropriate handle type:
6//
7// macOS: NSWindow → NSView → CAMetalLayer
8// Windows: HWND (direct, Dawn creates swap chain)
9// Linux/X11: Display* + Window
10// Linux/Wayland: wl_display* + wl_surface*
11
12#include <cstdint>
13
14// Forward declare SDL types to avoid SDL3 header dependency in public API
15struct SDL_Window;
16
17namespace pulp::render {
18
19// Platform-specific surface info extracted from an SDL3 window
22
24
25 // Metal (macOS/iOS)
26 void* metal_layer = nullptr; // CAMetalLayer*
27
28 // D3D12 (Windows)
29 void* hwnd = nullptr; // HWND
30 void* hinstance = nullptr; // HINSTANCE
31
32 // Vulkan/X11 (Linux)
33 void* x11_display = nullptr; // Display*
34 uint64_t x11_window = 0; // Window (X11 Window is unsigned long)
35
36 // Vulkan/Wayland (Linux)
37 void* wayland_display = nullptr; // wl_display*
38 void* wayland_surface = nullptr; // wl_surface*
39
40 bool is_valid() const { return backend != Backend::none; }
41};
42
43// Extract native surface info from an SDL3 window.
44// The window must already be created and visible.
45// Returns info with backend==none if extraction fails.
47
48} // namespace pulp::render
Definition gpu_fwd.hpp:31
Sdl3SurfaceInfo extract_sdl3_surface(SDL_Window *window)
Definition sdl3_surface.hpp:20
Backend
Definition sdl3_surface.hpp:21
@ d3d12
Definition sdl3_surface.hpp:21
@ none
Definition sdl3_surface.hpp:21
@ vulkan_wayland
Definition sdl3_surface.hpp:21
@ metal
Definition sdl3_surface.hpp:21
@ vulkan_x11
Definition sdl3_surface.hpp:21
void * wayland_display
Definition sdl3_surface.hpp:37
void * wayland_surface
Definition sdl3_surface.hpp:38
void * metal_layer
Definition sdl3_surface.hpp:26
void * hinstance
Definition sdl3_surface.hpp:30
uint64_t x11_window
Definition sdl3_surface.hpp:34
Backend backend
Definition sdl3_surface.hpp:23
void * x11_display
Definition sdl3_surface.hpp:33
void * hwnd
Definition sdl3_surface.hpp:29
bool is_valid() const
Definition sdl3_surface.hpp:40