Skip to content

Commit 3dd6940

Browse files
committed
BUildfix
1 parent dfa9620 commit 3dd6940

5 files changed

Lines changed: 45 additions & 17 deletions

File tree

gfx/common/metal_view.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* RetroArch - A frontend for libretro.
2+
* Copyright (C) 2018-2019 - Stuart Carnie
3+
* Copyright (C) 2011-2017 - Daniel De Matteis
4+
*
5+
* RetroArch is free software: you can redistribute it and/or modify it under the terms
6+
* of the GNU General Public License as published by the Free Software Found-
7+
* ation, either version 3 of the License, or (at your option) any later version.
8+
*
9+
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11+
* PURPOSE. See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with RetroArch.
14+
* If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
/* MetalView is the MTKView subclass owned by the Metal driver
18+
* (gfx/drivers/metal.m). Its full @implementation lives there.
19+
*
20+
* This header exists because the @interface needs to be visible to:
21+
* - gfx/drivers/metal.m (the file that defines it)
22+
* - ui/drivers/ui_cocoa.m (instantiates it as the render view)
23+
* - ui/drivers/ui_cocoatouch.m (ditto, plus calls setDrawableSize:)
24+
*
25+
* On Apple platforms all three of those .m files end up in a single
26+
* translation unit via griffin/griffin_objc.m, so a sharable header
27+
* with include guards is the only way to declare MetalView once
28+
* without an Obj-C duplicate-class error. Keep this file minimal --
29+
* the bulk of what used to live in gfx/common/metal_common.h is now
30+
* inlined into metal.m where it belongs. */
31+
32+
#ifndef METAL_VIEW_H__
33+
#define METAL_VIEW_H__
34+
35+
#import <MetalKit/MetalKit.h>
36+
37+
@interface MetalView : MTKView
38+
@end
39+
40+
#endif

gfx/drivers/metal.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,7 @@ - (void)updateFrame:(void const *)src pitch:(NSUInteger)pitch;
326326

327327
#pragma mark - Driver Classes
328328

329-
@interface MetalView : MTKView
330-
@end
329+
#include "../common/metal_view.h"
331330

332331
@interface FrameView : NSObject
333332

pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@
339339
05A8C71320DB72F000FF7857 /* video_filter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = video_filter.h; sourceTree = "<group>"; };
340340
05A8C73920DB72F100FF7857 /* font_driver.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = font_driver.c; sourceTree = "<group>"; };
341341
05A8C73C20DB72F100FF7857 /* vulkan_common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vulkan_common.c; sourceTree = "<group>"; };
342+
DEAD000000000000DEADBEE1 /* metal_view.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = metal_view.h; sourceTree = "<group>"; };
342343
05A8C74E20DB72F100FF7857 /* Shaders.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Shaders.metal; sourceTree = "<group>"; };
343344
05A8C75120DB72F100FF7857 /* metal_shader_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = metal_shader_types.h; sourceTree = "<group>"; };
344345
05A8C75D20DB72F100FF7857 /* gl_common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gl_common.c; sourceTree = "<group>"; };
@@ -983,6 +984,7 @@
983984
0538874E20DDD5C600769232 /* dxgi_common.h */,
984985
05A8C75D20DB72F100FF7857 /* gl_common.c */,
985986
05A8C76F20DB72F100FF7857 /* gl_common.h */,
987+
DEAD000000000000DEADBEE1 /* metal_view.h */,
986988
05A8C73C20DB72F100FF7857 /* vulkan_common.c */,
987989
05A8C76820DB72F100FF7857 /* vulkan_common.h */,
988990
);

ui/drivers/ui_cocoa.m

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@
4646
#include <IOKit/hidsystem/IOLLEvent.h>
4747

4848
#if defined(HAVE_COCOA_METAL)
49-
/* MetalView is the MTKView subclass owned by the Metal driver
50-
* (gfx/drivers/metal.m). This UI file only needs to instantiate it as
51-
* the render view; the full class lives in metal.m. Declared inline
52-
* here to avoid pulling in the entire Metal driver header surface. */
53-
#import <MetalKit/MetalKit.h>
54-
@interface MetalView : MTKView
55-
@end
49+
#include "../../gfx/common/metal_view.h"
5650
#endif
5751

5852
#include "../ui_companion_driver.h"

ui/drivers/ui_cocoatouch.m

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@
3030
#include "cocoa/apple_platform.h"
3131

3232
#if defined(HAVE_COCOA_METAL)
33-
/* MetalView is the MTKView subclass owned by the Metal driver
34-
* (gfx/drivers/metal.m). This UI file only needs to instantiate it as
35-
* the render view and call setDrawableSize: on it; the full class
36-
* lives in metal.m. Declared inline here to avoid pulling in the
37-
* entire Metal driver header surface. */
38-
#import <MetalKit/MetalKit.h>
39-
@interface MetalView : MTKView
40-
@end
33+
#include "../../gfx/common/metal_view.h"
4134
#endif
4235

4336
#include "../ui_companion_driver.h"

0 commit comments

Comments
 (0)