sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Metal

Description

Functions to creating Metal layers and views on SDL windows.

This provides some platform-specific glue for Apple platforms. Most macOS and iOS apps can use SDL without these functions, but this API they can be useful for specific OS-level integration tasks. A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).

FFI conventions

Unsuffixed aliases are unsafe foreign imports; aliases suffixed Safe are safe. Functions whose callbacks fire during the call export only the Safe alias (the genuine unsafe import stays reachable under SDL3.Sys.Bindgen.Metal.Unsafe); functions curated unsafe-only export only the unsuffixed one. Each alias's documentation records its flavor and rationale.

Full conventions: SDL3.Sys.

Since: 3.2.0

Synopsis

Documentation

Function aliases

metalCreateView Source #

Arguments

:: Ptr SDL_Window
window
the window.
-> IO SDL_MetalView 

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 metalGetLayer.

Returns
handle NSView or UIView.
Thread safety
This function should only be called on the main thread.
See also
metalDestroyView, metalGetLayer

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_Metal_CreateView. The safe flavor is metalCreateViewSafe .
C declaration
SDL_Metal_CreateView, defined at SDL3/SDL_metal.h 75:43

Since: 3.2.0

metalCreateViewSafe Source #

Arguments

:: Ptr SDL_Window
window
the window.
-> IO SDL_MetalView 

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 metalGetLayer.

Returns
handle NSView or UIView.
Thread safety
This function should only be called on the main thread.
See also
metalDestroyView, metalGetLayer

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_Metal_CreateView. The unsafe flavor is metalCreateView .
C declaration
SDL_Metal_CreateView, defined at SDL3/SDL_metal.h 75:43

Since: 3.2.0

metalDestroyView Source #

Arguments

:: SDL_MetalView
view
the SDL_MetalView object.
-> IO () 

Destroy an existing SDL_MetalView object.

This should be called before destroyWindow, if metalCreateView was called after createWindow.

Thread safety
This function should only be called on the main thread.
See also
metalCreateView

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_Metal_DestroyView. The safe flavor is metalDestroyViewSafe .
C declaration
SDL_Metal_DestroyView, defined at SDL3/SDL_metal.h 91:34

Since: 3.2.0

metalDestroyViewSafe Source #

Arguments

:: SDL_MetalView
view
the SDL_MetalView object.
-> IO () 

Destroy an existing SDL_MetalView object.

This should be called before destroyWindow, if metalCreateView was called after createWindow.

Thread safety
This function should only be called on the main thread.
See also
metalCreateView

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_Metal_DestroyView. The unsafe flavor is metalDestroyView .
C declaration
SDL_Metal_DestroyView, defined at SDL3/SDL_metal.h 91:34

Since: 3.2.0

metalGetLayer Source #

Arguments

:: SDL_MetalView
view
the SDL_MetalView object.
-> IO (Ptr Void) 

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

Returns
a pointer.
Thread safety
This function should only be called on the main thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_Metal_GetLayer. The safe flavor is metalGetLayerSafe .
C declaration
SDL_Metal_GetLayer, defined at SDL3/SDL_metal.h 103:36

Since: 3.2.0

metalGetLayerSafe Source #

Arguments

:: SDL_MetalView
view
the SDL_MetalView object.
-> IO (Ptr Void) 

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

Returns
a pointer.
Thread safety
This function should only be called on the main thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_Metal_GetLayer. The unsafe flavor is metalGetLayer .
C declaration
SDL_Metal_GetLayer, defined at SDL3/SDL_metal.h 103:36

Since: 3.2.0