File tree Expand file tree Collapse file tree 3 files changed +14
-18
lines changed
Expand file tree Collapse file tree 3 files changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -1342,8 +1342,15 @@ endif()
13421342target_sources (${PROJECT_NAME} PRIVATE
13431343 core/wsi/context.h
13441344 core/wsi/libretro.cpp
1345- core/wsi/libretro.h
1345+ core/wsi/libretro.h)
1346+
1347+ if (USE_METAL)
1348+ target_sources (${PROJECT_NAME} PRIVATE
1349+ core/wsi/switcher.mm)
1350+ else ()
1351+ target_sources (${PROJECT_NAME} PRIVATE
13461352 core/wsi/switcher.cpp)
1353+ endif ()
13471354
13481355if (USE_OPENGL)
13491356 target_compile_definitions (${PROJECT_NAME} PRIVATE USE_OPENGL)
Original file line number Diff line number Diff line change @@ -18,10 +18,8 @@ Copyright 2024 flyinghead
1818*/
1919#pragma once
2020
21- #ifdef __OBJC__
2221#include < Metal/Metal.h>
2322#include < QuartzCore/QuartzCore.h>
24- #endif
2523
2624#include " wsi/context.h"
2725
@@ -33,19 +31,12 @@ class MetalContext : public GraphicsContext
3331
3432 bool init ();
3533 void term () override ;
34+ void resize () override ;
35+ void Present ();
3636
37- #ifdef __OBJC__
3837 id<MTLDevice> GetDevice () const { return device; }
3938 CAMetalLayer* GetLayer () const { return layer; }
4039 id<MTLCommandQueue> GetQueue () const { return queue; }
41- // Hack to make sure everything lines up when in pure C++
42- #else
43- void * GetDevice () const { return device; }
44- void * GetLayer () const { return layer; }
45- void * GetQueue () const { return queue; }
46- #endif
47- void resize () override ;
48- void Present ();
4940
5041 std::string getDriverName () override ;
5142
@@ -63,14 +54,9 @@ class MetalContext : public GraphicsContext
6354
6455 static MetalContext* Instance () { return contextInstance; }
6556private:
66- #ifdef __OBJC__
6757 id<MTLDevice> device = nil;
6858 id<MTLCommandQueue> queue = nil;
6959 CAMetalLayer* layer;
70- #else
71- void * device = nullptr ;
72- void * queue = nullptr ;
73- void * layer = nullptr ;
74- #endif
60+
7561 static MetalContext* contextInstance;
7662};
Original file line number Diff line number Diff line change 1+ // When including Metal, switcher needs to be built
2+ // with Obj-C++ to properly resolve types.
3+ #include " switcher.cpp"
You can’t perform that action at this time.
0 commit comments