SDL_GETRENDERMETALCOMMANDENCODER(3)

✨ SDL_GetRenderMetalCommandEncoder ✨

okay so bestie, we're in the SDL3 FUNCTIONS section of the manual and today's main character is SDL_GetRenderMetalCommandEncoder πŸ’…

πŸŽ€ NAME πŸŽ€

SDL_GetRenderMetalCommandEncoder β€” grab the Metal command encoder for the current frame. that's it, that's the vibe πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_render.h>

void * SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);

πŸ’– DESCRIPTION πŸ’–

so like, this function hands you back a void * β€” and yes that's on purpose, because SDL doesn't want to have to include Metal's headers 😌 but ngl you can safely cast that thing to an id<MTLRenderCommandEncoder>. no cap.

It will return NULL if Metal refuses to give SDL a drawable to render to 😭 which, lowkey, can happen if the window is hidden, minimized, or offscreen. literally the worst.

⚠️ heads up: this doesn't apply to command encoders for render targets, just the window's backbuffer. and CHECK YOUR RETURN VALUES! like fr fr, don't be out here dereferencing NULL, bestie πŸ’€

🫢 FUNCTION PARAMETERS 🫢

  • renderer β€” the renderer to query. that's the one, that's the only one ✨

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns an id<MTLRenderCommandEncoder> on success πŸŽ‰ or NULL if the renderer isn't a Metal renderer, or if there was an error πŸ™ˆ


🌈 THREAD SAFETY 🌈

This function should only be called on the main thread. no side quests, no background threads, stay in your lane 🧚


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. iconic behavior, honestly πŸ“


πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie, you ate that πŸŽ€βœ¨ this was brought to you by Simple Directmedia Layer, version SDL 3.4.18, and the page SDL_GetRender...ommandEncoder(3) β€” go forth and render, mwah πŸ’…πŸ¦‹

πŸ“¦ where this page comes from