Skip to content

Commit 1ad8702

Browse files
committed
Add Metal functions in sdlrenderer.inc
1 parent 0e24c14 commit 1ad8702

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

units/sdlrenderer.inc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,30 @@ function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat)
10181018
*}
10191019
function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF};
10201020

1021+
{**
1022+
* Get the CAMetalLayer associated with the given Metal renderer.
1023+
*
1024+
* This function returns a raw Pointer, so SDL doesn't have to include Metal's headers,
1025+
* but it can be safely cast to a pointer to `CAMetalLayer`.
1026+
*
1027+
*}
1028+
function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl;
1029+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalLayer' {$ENDIF} {$ENDIF};
1030+
1031+
{**
1032+
* Get the Metal command encoder for the current frame
1033+
*
1034+
* This function returns a raw Pointer, so SDL doesn't have to include Metal's headers,
1035+
* but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
1036+
*
1037+
* Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
1038+
* SDL a drawable to render to, which might happen if the window is
1039+
* hidden/minimized/offscreen. This doesn't apply to command encoders for
1040+
* render targets, just the window's backbacker. Check your return values!
1041+
*}
1042+
function SDL_RenderGetMetalCommandEncoder(renderer: PSDL_Renderer): Pointer; cdecl;
1043+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalCommandEncoder' {$ENDIF} {$ENDIF};
1044+
10211045
{**
10221046
* Toggle VSync of the given renderer.
10231047
*}

0 commit comments

Comments
 (0)