Path: blob/master/thirdparty/sdl/include/SDL3/SDL_metal.h
9913 views
/*1Simple DirectMedia Layer2Copyright (C) 1997-2025 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/2021/**22* # CategoryMetal23*24* Functions to creating Metal layers and views on SDL windows.25*26* This provides some platform-specific glue for Apple platforms. Most macOS27* and iOS apps can use SDL without these functions, but this API they can be28* useful for specific OS-level integration tasks.29*/3031#ifndef SDL_metal_h_32#define SDL_metal_h_3334#include <SDL3/SDL_video.h>3536#include <SDL3/SDL_begin_code.h>37/* Set up for C function definitions, even when using C++ */38#ifdef __cplusplus39extern "C" {40#endif4142/**43* A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).44*45* \since This datatype is available since SDL 3.2.0.46*/47typedef void *SDL_MetalView;4849/**50* \name Metal support functions51*/52/* @{ */5354/**55* Create a CAMetalLayer-backed NSView/UIView and attach it to the specified56* window.57*58* On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on59* its own. It is up to user code to do that.60*61* The returned handle can be casted directly to a NSView or UIView. To access62* the backing CAMetalLayer, call SDL_Metal_GetLayer().63*64* \param window the window.65* \returns handle NSView or UIView.66*67* \since This function is available since SDL 3.2.0.68*69* \sa SDL_Metal_DestroyView70* \sa SDL_Metal_GetLayer71*/72extern SDL_DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window *window);7374/**75* Destroy an existing SDL_MetalView object.76*77* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was78* called after SDL_CreateWindow.79*80* \param view the SDL_MetalView object.81*82* \since This function is available since SDL 3.2.0.83*84* \sa SDL_Metal_CreateView85*/86extern SDL_DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);8788/**89* Get a pointer to the backing CAMetalLayer for the given view.90*91* \param view the SDL_MetalView object.92* \returns a pointer.93*94* \since This function is available since SDL 3.2.0.95*/96extern SDL_DECLSPEC void * SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);9798/* @} *//* Metal support functions */99100/* Ends C function definitions when using C++ */101#ifdef __cplusplus102}103#endif104#include <SDL3/SDL_close_code.h>105106#endif /* SDL_metal_h_ */107108109