mirror of https://github.com/bsnes-emu/bsnes.git
OpenGL fallback
This commit is contained in:
parent
a068b7b09f
commit
1c1cddb53e
|
@ -26,7 +26,10 @@
|
|||
+ (instancetype)allocWithZone:(struct _NSZone *)zone
|
||||
{
|
||||
if (self == [GBView class]) {
|
||||
return [GBViewMetal allocWithZone: zone];
|
||||
if ([GBViewMetal isSupported]) {
|
||||
return [GBViewMetal allocWithZone: zone];
|
||||
}
|
||||
return [GBViewGL allocWithZone: zone];
|
||||
}
|
||||
return [super allocWithZone:zone];
|
||||
}
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
#import "GBView.h"
|
||||
|
||||
@interface GBViewMetal : GBView<MTKViewDelegate>
|
||||
|
||||
+ (bool) isSupported;
|
||||
@end
|
||||
|
|
|
@ -29,6 +29,14 @@ static const vector_float2 rect[] =
|
|||
vector_float2 output_resolution;
|
||||
}
|
||||
|
||||
+ (bool)isSupported
|
||||
{
|
||||
if (MTLCopyAllDevices) {
|
||||
return [MTLCopyAllDevices() count];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
- (void)createInternalView
|
||||
{
|
||||
MTKView *view = [[MTKView alloc] initWithFrame:self.frame device:(device = MTLCreateSystemDefaultDevice())];
|
||||
|
|
2
Makefile
2
Makefile
|
@ -61,7 +61,7 @@ ifeq ($(PLATFORM),Darwin)
|
|||
SYSROOT := $(shell xcodebuild -sdk macosx -version Path 2> /dev/null)
|
||||
CFLAGS += -F/Library/Frameworks
|
||||
OCFLAGS += -x objective-c -fobjc-arc -Wno-deprecated-declarations -isysroot $(SYSROOT) -mmacosx-version-min=10.9
|
||||
LDFLAGS += -framework AppKit -framework PreferencePanes -framework Carbon -framework QuartzCore -framework Metal -framework MetalKit
|
||||
LDFLAGS += -framework AppKit -framework PreferencePanes -framework Carbon -framework QuartzCore -weak_framework Metal -weak_framework MetalKit
|
||||
SDL_LDFLAGS := -F/Library/Frameworks -framework SDL2 -framework OpenGL
|
||||
endif
|
||||
CFLAGS += -Wno-deprecated-declarations
|
||||
|
|
Loading…
Reference in New Issue