Skip to content

Commit

Permalink
metal: Make sure we have a command buffer available before trying to …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
icculus committed Jul 17, 2020
1 parent b5affd1 commit b7a4fdd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/render/metal/SDL_render_metal.m
Expand Up @@ -1518,6 +1518,8 @@ - (void)dealloc
{ @autoreleasepool {
METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;

METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad, NULL, nil);

if (data.mtlcmdencoder != nil) {
[data.mtlcmdencoder endEncoding];
}
Expand Down

0 comments on commit b7a4fdd

Please sign in to comment.