Skip to content

Commit

Permalink
Fixed setting the layer drawable size
Browse files Browse the repository at this point in the history
Without this change the drawable had a size of 0 and the metal renderer asserted because the projection matrix wasn't set.
  • Loading branch information
slouken committed Mar 2, 2018
1 parent cef1c1c commit ac2d1f6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/video/uikit/SDL_uikitmetalview.m
Expand Up @@ -60,7 +60,14 @@ - (instancetype)initWithFrame:(CGRect)frame
/* Set the size of the metal drawables when the view is resized. */
- (void)layoutSubviews
{
CGSize bounds;

[super layoutSubviews];

bounds = [self bounds].size;
bounds.width *= self.layer.contentsScale;
bounds.height *= self.layer.contentsScale;
((CAMetalLayer *) self.layer).drawableSize = bounds;
}

@end
Expand All @@ -72,9 +79,9 @@ - (void)layoutSubviews
SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view;
CGFloat scale = 1.0;

if ([view isKindOfClass:[SDL_uikitmetalview class]]) {
return (SDL_uikitmetalview *)view;
}
if ([view isKindOfClass:[SDL_uikitmetalview class]]) {
return (SDL_uikitmetalview *)view;
}

if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
/* Set the scale to the natural scale factor of the screen - then
Expand Down

0 comments on commit ac2d1f6

Please sign in to comment.