SDL_Metal_CreateView(3)
π SDL_Metal_CreateView π
okay bestie, so this is a page from the SDL3 functions manual, and today's main character is SDL_Metal_CreateView. she makes a CAMetalLayer-backed NSView/UIView and attaches it to the window you hand her. that's the whole vibe. β¨
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_metal.h>
SDL_MetalView SDL_Metal_CreateView(SDL_Window *window);
π¦ DESCRIPTION π¦
So like, on macOS? this does not associate a MTLDevice with the CAMetalLayer on its own. it's literally not her job, she said no thank you π«Ά. it is up to user code to do that. yes queen, that's you.
the handle she hands back can be casted directly to a NSView or a UIView β no extra steps, no drama. and if you wanna get to the backing CAMetalLayer underneath all that? just call SDL_Metal_GetLayer(). iykyk π
π FUNCTION PARAMETERS π
windowβ the window. that's it. that's the parameter. she's lowkey uncomplicated like that π
β RETURN VALUE β
she returns a handle β either an NSView or a UIView. iconic. no cap.
π THREAD SAFETY π
β οΈ bestie listen to me: this function should only be called on the main thread. don't try to be sneaky and call her from some background thread, she will simply not be having it. main character energy only π
β¨ AVAILABILITY β¨
this function has been available since SDL 3.2.0 π
π SEE ALSO π
SDL_Metal_DestroyView(3)β for when you're done and need to say bye πSDL_Metal_GetLayer(3)β to grab that backing layer, as mentioned above π
and that's the tea, bestie π§π this page comes to you from the Simple Directmedia Layer crew, SDL 3.4.18 era β go forth and metal, periodt β¨π πΈ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms