Atlas - SDL_metal.h
Home / ext / SDL / include / SDL3 Lines: 2 | Size: 3354 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2026 Sam Lantinga <[email protected]> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21 22/** 23 * # CategoryMetal 24 * 25 * Functions to creating Metal layers and views on SDL windows. 26 * 27 * This provides some platform-specific glue for Apple platforms. Most macOS 28 * and iOS apps can use SDL without these functions, but this API they can be 29 * useful for specific OS-level integration tasks. 30 */ 31 32#ifndef SDL_metal_h_ 33#define SDL_metal_h_ 34 35#include <SDL3/SDL_video.h> 36 37#include <SDL3/SDL_begin_code.h> 38/* Set up for C function definitions, even when using C++ */ 39#ifdef __cplusplus 40extern "C" { 41#endif 42 43/** 44 * A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). 45 * 46 * \since This datatype is available since SDL 3.2.0. 47 */ 48typedef void *SDL_MetalView; 49 50/** 51 * \name Metal support functions 52 */ 53/* @{ */ 54 55/** 56 * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified 57 * window. 58 * 59 * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on 60 * its own. It is up to user code to do that. 61 * 62 * The returned handle can be casted directly to a NSView or UIView. To access 63 * the backing CAMetalLayer, call SDL_Metal_GetLayer(). 64 * 65 * \param window the window. 66 * \returns handle NSView or UIView. 67 * 68 * \threadsafety This function should only be called on the main thread. 69 * 70 * \since This function is available since SDL 3.2.0. 71 * 72 * \sa SDL_Metal_DestroyView 73 * \sa SDL_Metal_GetLayer 74 */ 75extern SDL_DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window *window); 76 77/** 78 * Destroy an existing SDL_MetalView object. 79 * 80 * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was 81 * called after SDL_CreateWindow. 82 * 83 * \param view the SDL_MetalView object. 84 * 85 * \threadsafety This function should only be called on the main thread. 86 * 87 * \since This function is available since SDL 3.2.0. 88 * 89 * \sa SDL_Metal_CreateView 90 */ 91extern SDL_DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); 92 93/** 94 * Get a pointer to the backing CAMetalLayer for the given view. 95 * 96 * \param view the SDL_MetalView object. 97 * \returns a pointer. 98 * 99 * \threadsafety This function should only be called on the main thread. 100 * 101 * \since This function is available since SDL 3.2.0. 102 */ 103extern SDL_DECLSPEC void * SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); 104 105/* @} *//* Metal support functions */ 106 107/* Ends C function definitions when using C++ */ 108#ifdef __cplusplus 109} 110#endif 111#include <SDL3/SDL_close_code.h> 112 113#endif /* SDL_metal_h_ */ 114[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.