From b7a4fdd31828b7fc5beefd3b0ecd1bc3b344f4e2 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 17 Jul 2020 11:16:35 -0400 Subject: [PATCH] metal: Make sure we have a command buffer available before trying to present. This fixes a case where you render to the backbuffer, then render to a render target, set the current target back to the backbuffer, and then present without drawing anything else; in this circumstance, the Present command would never happen. Fixes Bugzilla #5011. --- src/render/metal/SDL_render_metal.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index ba31b6e66..04616e374 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -1518,6 +1518,8 @@ METAL_RenderPresent(SDL_Renderer * renderer) { @autoreleasepool { METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad, NULL, nil); + if (data.mtlcmdencoder != nil) { [data.mtlcmdencoder endEncoding]; }