File tree Expand file tree Collapse file tree 5 files changed +27
-1
lines changed
source/gameanalytics/Platform Expand file tree Collapse file tree 5 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ elseif(APPLE)
190190 "-framework Foundation"
191191 "-framework CoreServices"
192192 "-framework SystemConfiguration"
193+ "-framework Metal"
194+ "-framework MetalKit"
193195 )
194196
195197 create_source_groups(MACOS_SOURCES)
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const char* getOSXVersion();
99const char * getConnectionType ();
1010int getNumCpuCores ();
1111int64_t getTotalDeviceMemory ();
12+ const char * getGPUName ();
1213
1314#endif
1415
Original file line number Diff line number Diff line change 1616#import < SystemConfiguration/SystemConfiguration.h>
1717#import < netinet/in.h>
1818
19+ #import < IOKit/IOKitLib.h>
20+
21+ #include < Metal/Metal.h>
22+
1923typedef struct {
2024 NSInteger majorVersion;
2125 NSInteger minorVersion;
@@ -103,4 +107,17 @@ int64_t getTotalDeviceMemory()
103107 return (uint64_t )info.physicalMemory ;
104108}
105109
110+ const char * getGPUName ()
111+ {
112+ NSArray * devices = MTLCopyAllDevices ();
113+ if (devices && [devices count ])
114+ {
115+ id device = devices[0 ];
116+ NSString * name = [device name ];
117+ return [name UTF8String ];
118+ }
119+
120+ return " " ;
121+ }
122+
106123#endif // IS_MAC
Original file line number Diff line number Diff line change @@ -193,7 +193,12 @@ std::string gameanalytics::GAPlatformMacOS::getCpuModel() const
193193
194194std::string gameanalytics::GAPlatformMacOS::getGpuModel () const
195195{
196- return " Apple" ;
196+ if (_gpuModel.empty ())
197+ {
198+ _gpuModel = ::getGPUName ();
199+ }
200+
201+ return _gpuModel;
197202}
198203
199204int gameanalytics::GAPlatformMacOS::getNumCpuCores () const
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ namespace gameanalytics
3838
3939 private:
4040
41+ mutable std::string _gpuModel;
4142 static void signalHandler (int sig, siginfo_t * info, void * context);
4243 };
4344}
You can’t perform that action at this time.
0 commit comments