From 104decd16d0896f28c953006a4b2714e4179006a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 7 Dec 2017 18:08:51 -0800 Subject: [PATCH] Fixed runtime errors on iOS --- src/render/metal/SDL_render_metal.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index 780c11da4..157eac289 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -343,7 +343,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) MakePipelineStates(data, data.mtlpipelinecopy, @"SDL_RenderCopy pipeline", @"SDL_Copy_vertex", @"SDL_Copy_fragment"); static const float clearverts[] = { -1, -1, -1, 1, 1, 1, 1, -1, -1, -1 }; - data.mtlbufclearverts = [data.mtldevice newBufferWithBytes:clearverts length:sizeof(clearverts) options:MTLResourceCPUCacheModeWriteCombined|MTLResourceStorageModePrivate]; + data.mtlbufclearverts = [data.mtldevice newBufferWithBytes:clearverts length:sizeof(clearverts) options:MTLResourceCPUCacheModeWriteCombined]; data.mtlbufclearverts.label = @"SDL_RenderClear vertices"; // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed. @@ -480,7 +480,9 @@ METAL_UpdateClipRect(SDL_Renderer * renderer) mtlrect.width = renderer->viewport.w; mtlrect.height = renderer->viewport.h; } - [data.mtlcmdencoder setScissorRect:mtlrect]; + if (mtlrect.width > 0 && mtlrect.height > 0) { + [data.mtlcmdencoder setScissorRect:mtlrect]; + } } return 0; }