SDL 3.0
SDL_metal.h File Reference
+ Include dependency graph for SDL_metal.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void * SDL_MetalView
 

Functions

Metal support functions
SDL_MetalView SDL_Metal_CreateView (SDL_Window *window)
 
void SDL_Metal_DestroyView (SDL_MetalView view)
 
void * SDL_Metal_GetLayer (SDL_MetalView view)
 

Detailed Description

Header file for functions to creating Metal layers and views on SDL windows.

Definition in file SDL_metal.h.

Typedef Documentation

◆ SDL_MetalView

typedef void* SDL_MetalView

A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).

Since
This datatype is available since SDL 3.0.0.

Definition at line 44 of file SDL_metal.h.

Function Documentation

◆ SDL_Metal_CreateView()

SDL_MetalView SDL_Metal_CreateView ( SDL_Window window)
extern

Create a CAMetalLayer-backed NSView/UIView and attach it to the specified window.

On macOS, this does not associate a MTLDevice with the CAMetalLayer on its own. It is up to user code to do that.

The returned handle can be casted directly to a NSView or UIView. To access the backing CAMetalLayer, call SDL_Metal_GetLayer().

Parameters
windowthe window
Returns
handle NSView or UIView
Since
This function is available since SDL 3.0.0.
See also
SDL_Metal_DestroyView
SDL_Metal_GetLayer

◆ SDL_Metal_DestroyView()

void SDL_Metal_DestroyView ( SDL_MetalView  view)
extern

Destroy an existing SDL_MetalView object.

This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was called after SDL_CreateWindow.

Parameters
viewthe SDL_MetalView object
Since
This function is available since SDL 3.0.0.
See also
SDL_Metal_CreateView

◆ SDL_Metal_GetLayer()

void * SDL_Metal_GetLayer ( SDL_MetalView  view)
extern

Get a pointer to the backing CAMetalLayer for the given view.

Parameters
viewthe SDL_MetalView object
Returns
a pointer
Since
This function is available since SDL 3.0.0.