From 876b36ac1cf18dff51fd3e2c51b103c94a46cb72 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 27 Mar 2020 17:26:51 +0300 Subject: [PATCH] More crash fixes, restore Metal support --- Cocoa/GBOpenGLView.m | 14 ++++++++------ Cocoa/GBViewMetal.m | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cocoa/GBOpenGLView.m b/Cocoa/GBOpenGLView.m index fd845e1..8831b62 100644 --- a/Cocoa/GBOpenGLView.m +++ b/Cocoa/GBOpenGLView.m @@ -13,12 +13,14 @@ double scale = self.window.backingScaleFactor; glViewport(0, 0, self.bounds.size.width * scale, self.bounds.size.height * scale); - [self.shader renderBitmap:gbview.currentBuffer - previous:gbview.frameBlendingMode? gbview.previousBuffer : NULL - sized:NSMakeSize(GB_get_screen_width(gbview.gb), GB_get_screen_height(gbview.gb)) - inSize:self.bounds.size - scale:scale - withBlendingMode:gbview.frameBlendingMode]; + if (gbview.gb) { + [self.shader renderBitmap:gbview.currentBuffer + previous:gbview.frameBlendingMode? gbview.previousBuffer : NULL + sized:NSMakeSize(GB_get_screen_width(gbview.gb), GB_get_screen_height(gbview.gb)) + inSize:self.bounds.size + scale:scale + withBlendingMode:gbview.frameBlendingMode]; + } glFlush(); } diff --git a/Cocoa/GBViewMetal.m b/Cocoa/GBViewMetal.m index 093ed2a..4c8a5d5 100644 --- a/Cocoa/GBViewMetal.m +++ b/Cocoa/GBViewMetal.m @@ -23,7 +23,7 @@ static const vector_float2 rect[] = + (bool)isSupported { if (MTLCopyAllDevices) { - return false; //[MTLCopyAllDevices() count]; + return [MTLCopyAllDevices() count]; } return false; }