metal: Clear bogus pointer if we fail to get a new drawable.

Reference Issue #16232.
This commit is contained in:
Ryan C. Gordon
2026-09-04 15:50:05 -04:00
parent f034d594a8
commit ea74d3b018

View File

@@ -483,6 +483,8 @@ static bool METAL_ActivateRenderCommandEncoder(SDL_Renderer *renderer, MTLLoadAc
}
}
data.mtlpassdesc.colorAttachments[0].texture = mtltexture;
/* mtltexture can be nil here if macOS refused to give us a drawable,
which apparently can happen for minimized windows, etc. */
if (mtltexture == nil) {
@@ -495,7 +497,6 @@ static bool METAL_ActivateRenderCommandEncoder(SDL_Renderer *renderer, MTLLoadAc
}
data.mtlpassdesc.colorAttachments[0].loadAction = load;
data.mtlpassdesc.colorAttachments[0].texture = mtltexture;
data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer];
data.mtlcmdencoder = [data.mtlcmdbuffer renderCommandEncoderWithDescriptor:data.mtlpassdesc];