From 90a480a1001fdec2d4258f56d688fe9049e171e3 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 8 Sep 2022 05:44:39 +0200 Subject: [PATCH] Fixed bug #6199 - Broken clip behaviour on a render target (metal) --- src/render/metal/SDL_render_metal.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index b17bb4548..fdd0438aa 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -1227,7 +1227,13 @@ SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_Met /* Set Scissor Rect Validation: w/h must be <= render pass */ SDL_zero(output); - METAL_GetOutputSize(renderer, &output.w, &output.h); + + if (renderer->target) { + output.w = renderer->target->w; + output.h = renderer->target->h; + } else { + METAL_GetOutputSize(renderer, &output.w, &output.h); + } if (SDL_IntersectRect(&output, &clip, &clip)) { MTLScissorRect mtlrect;