Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
geode_embed_surface_macos.mm File Reference

macOS (Cocoa/Metal) implementation of CreateSurfaceFromGlfwWindow. More...

#include "examples/geode_embed_surface.h"
import <Cocoa/Cocoa.h>
import <QuartzCore/CAMetalLayer.h>
#include "GLFW/glfw3.h"
#include "GLFW/glfw3native.h"
Include dependency graph for geode_embed_surface_macos.mm:

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

wgpu::Surface donner::example::CreateSurfaceFromGlfwWindow (const wgpu::Instance &instance, GLFWwindow *window)
 Create a wgpu::Surface backed by the platform-native handle of window. Returns an invalid wgpu::Surface when the platform is unsupported or window-handle extraction failed.

Detailed Description

macOS (Cocoa/Metal) implementation of CreateSurfaceFromGlfwWindow.

wgpu-native's Metal backend expects a CAMetalLayer, not an NSWindow. GLFW gives us an NSWindow* via glfwGetCocoaWindow; we install a CAMetalLayer on its content view if one isn't already there, then hand the layer pointer to webgpu via SurfaceSourceMetalLayer.