Skip to content

Commit

Permalink
Fixed runtime errors on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 8, 2017
1 parent ba9c336 commit 104decd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/render/metal/SDL_render_metal.m
Expand Up @@ -343,7 +343,7 @@ @implementation METAL_RenderData
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.
Expand Down Expand Up @@ -480,7 +480,9 @@ @implementation METAL_RenderData
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;
}
Expand Down

0 comments on commit 104decd

Please sign in to comment.