Fixed runtime errors on iOS

This commit is contained in:
Sam Lantinga 2017-12-07 18:08:51 -08:00
parent ba9c336e04
commit 104decd16d
1 changed files with 4 additions and 2 deletions

View File

@ -343,7 +343,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
MakePipelineStates(data, data.mtlpipelinecopy, @"SDL_RenderCopy pipeline", @"SDL_Copy_vertex", @"SDL_Copy_fragment"); 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 }; 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"; 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. // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed.
@ -480,8 +480,10 @@ METAL_UpdateClipRect(SDL_Renderer * renderer)
mtlrect.width = renderer->viewport.w; mtlrect.width = renderer->viewport.w;
mtlrect.height = renderer->viewport.h; mtlrect.height = renderer->viewport.h;
} }
if (mtlrect.width > 0 && mtlrect.height > 0) {
[data.mtlcmdencoder setScissorRect:mtlrect]; [data.mtlcmdencoder setScissorRect:mtlrect];
} }
}
return 0; return 0;
} }