Moved lib_base Metal support into patches/ for portability.
Esse commit está contido em:
+1
-1
Submodule Telegram/lib_base updated: 0eff549c72...4d1a6b8a88
@@ -0,0 +1,68 @@
|
||||
diff --git a/base/platform/base_platform_info.h b/base/platform/base_platform_info.h
|
||||
index 7b29721..261ee24 100644
|
||||
--- a/base/platform/base_platform_info.h
|
||||
+++ b/base/platform/base_platform_info.h
|
||||
@@ -60,6 +60,7 @@ enum class OutdateReason {
|
||||
[[nodiscard]] bool IsMac10_15OrGreater();
|
||||
[[nodiscard]] bool IsMac11_0OrGreater();
|
||||
[[nodiscard]] bool IsMac26_0OrGreater();
|
||||
+[[nodiscard]] bool MetalSupported();
|
||||
|
||||
[[nodiscard]] constexpr bool IsLinux();
|
||||
[[nodiscard]] bool IsX11();
|
||||
diff --git a/base/platform/linux/base_info_linux.h b/base/platform/linux/base_info_linux.h
|
||||
index 80c3d65..aa28bf1 100644
|
||||
--- a/base/platform/linux/base_info_linux.h
|
||||
+++ b/base/platform/linux/base_info_linux.h
|
||||
@@ -36,5 +36,6 @@ inline bool IsMac10_14OrGreater() { return false; }
|
||||
inline bool IsMac10_15OrGreater() { return false; }
|
||||
inline bool IsMac11_0OrGreater() { return false; }
|
||||
inline bool IsMac26_0OrGreater() { return false; }
|
||||
+inline bool MetalSupported() { return false; }
|
||||
|
||||
} // namespace Platform
|
||||
diff --git a/base/platform/mac/base_info_mac.mm b/base/platform/mac/base_info_mac.mm
|
||||
index 53fbfe2..47a89de 100644
|
||||
--- a/base/platform/mac/base_info_mac.mm
|
||||
+++ b/base/platform/mac/base_info_mac.mm
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <QtCore/QOperatingSystemVersion>
|
||||
#include <sys/sysctl.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
+#include <Metal/Metal.h>
|
||||
#import <IOKit/hidsystem/IOHIDLib.h>
|
||||
|
||||
@interface WakeUpObserver : NSObject {
|
||||
@@ -246,6 +247,20 @@ bool IsMac26_0OrGreater() {
|
||||
return IsMacThatOrGreater<26, 0>();
|
||||
}
|
||||
|
||||
+bool MetalSupported() {
|
||||
+ static const auto result = [] {
|
||||
+ if (@available(macOS 10.15, *)) {
|
||||
+ auto device = MTLCreateSystemDefaultDevice();
|
||||
+ if (device) {
|
||||
+ [device release];
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }();
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
void Start(QJsonObject settings) {
|
||||
Expects(GlobalWakeUpObserver == nil);
|
||||
|
||||
diff --git a/base/platform/win/base_info_win.h b/base/platform/win/base_info_win.h
|
||||
index 0ec8688..4f5c0ff 100644
|
||||
--- a/base/platform/win/base_info_win.h
|
||||
+++ b/base/platform/win/base_info_win.h
|
||||
@@ -58,6 +58,7 @@ inline bool IsMac10_14OrGreater() { return false; }
|
||||
inline bool IsMac10_15OrGreater() { return false; }
|
||||
inline bool IsMac11_0OrGreater() { return false; }
|
||||
inline bool IsMac26_0OrGreater() { return false; }
|
||||
+inline bool MetalSupported() { return false; }
|
||||
inline constexpr bool IsLinux() { return false; }
|
||||
inline bool IsX11() { return false; }
|
||||
inline bool IsWayland() { return false; }
|
||||
Referência em uma Nova Issue
Bloquear um usuário