Fixed runtime errors on iOS
authorSam Lantinga <slouken@libsdl.org>
Thu, 07 Dec 2017 18:08:51 -0800
changeset 117346d6dc7d2a704
parent 11733 490588c02a65
child 11735 1d81fcb6edd5
Fixed runtime errors on iOS
src/render/metal/SDL_render_metal.m
     1.1 --- a/src/render/metal/SDL_render_metal.m	Thu Dec 07 17:47:01 2017 -0800
     1.2 +++ b/src/render/metal/SDL_render_metal.m	Thu Dec 07 18:08:51 2017 -0800
     1.3 @@ -343,7 +343,7 @@
     1.4      MakePipelineStates(data, data.mtlpipelinecopy, @"SDL_RenderCopy pipeline", @"SDL_Copy_vertex", @"SDL_Copy_fragment");
     1.5  
     1.6      static const float clearverts[] = { -1, -1, -1, 1, 1, 1, 1, -1, -1, -1 };
     1.7 -    data.mtlbufclearverts = [data.mtldevice newBufferWithBytes:clearverts length:sizeof(clearverts) options:MTLResourceCPUCacheModeWriteCombined|MTLResourceStorageModePrivate];
     1.8 +    data.mtlbufclearverts = [data.mtldevice newBufferWithBytes:clearverts length:sizeof(clearverts) options:MTLResourceCPUCacheModeWriteCombined];
     1.9      data.mtlbufclearverts.label = @"SDL_RenderClear vertices";
    1.10  
    1.11      // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed.
    1.12 @@ -480,7 +480,9 @@
    1.13              mtlrect.width = renderer->viewport.w;
    1.14              mtlrect.height = renderer->viewport.h;
    1.15          }
    1.16 -        [data.mtlcmdencoder setScissorRect:mtlrect];
    1.17 +        if (mtlrect.width > 0 && mtlrect.height > 0) {
    1.18 +            [data.mtlcmdencoder setScissorRect:mtlrect];
    1.19 +        }
    1.20      }
    1.21      return 0;
    1.22  }