summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorOatmealDome <OatmealDome@users.noreply.github.com>2026-04-02 23:55:16 -0400
committerGitHub <noreply@github.com>2026-04-02 23:55:16 -0400
commit5e95d5e7f56aa4b758f4e758dabf8a716a20cc85 (patch)
tree25bc1799049bc3ded7810ee6d16975d6925d7238 /Source/Core/Common
parent0531286906ec65edf3736813517496c95bf87ada (diff)
parent26e58ea3492d0bb3004359b9a72f3a738f3c2134 (diff)
Merge pull request #14492 from OatmealDome/apple-discard-bug-fixed-3
VideoBackends/Vulkan: Drop BUG_BROKEN_DISCARD_WITH_EARLY_Z workaround
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/CMakeLists.txt2
-rw-r--r--Source/Core/Common/CommonFuncs.h17
-rw-r--r--Source/Core/Common/CommonFuncsObjC.mm15
3 files changed, 34 insertions, 0 deletions
diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt
index e134acabd3..fe7aa9f72b 100644
--- a/Source/Core/Common/CMakeLists.txt
+++ b/Source/Core/Common/CMakeLists.txt
@@ -204,6 +204,7 @@ if (APPLE)
PRIVATE
${APPKIT_LIBRARY}
${COREFOUNDATION_LIBRARY}
+ ${FOUNDATION_LIBRARY}
${IOK_LIBRARY}
)
elseif(WIN32)
@@ -239,6 +240,7 @@ elseif(WIN32)
)
elseif(APPLE)
target_sources(common PRIVATE
+ CommonFuncsObjC.mm
Logging/ConsoleListenerNix.cpp
MemArenaDarwin.cpp
)
diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h
index a2c20c67e3..b9238dad1c 100644
--- a/Source/Core/Common/CommonFuncs.h
+++ b/Source/Core/Common/CommonFuncs.h
@@ -8,6 +8,10 @@
#endif
#include <string>
+#ifdef __APPLE__
+#include "Common/CommonTypes.h"
+#endif
+
#ifndef _WIN32
// go to debugger mode
@@ -61,4 +65,17 @@ std::string GetWin32ErrorString(unsigned long error_code);
// Obtains a full path to the specified module.
std::optional<std::wstring> GetModuleName(void* hInstance);
#endif
+
+#ifdef __APPLE__
+struct MacOSVersion // NSOperatingSystemVersion
+{
+ s64 major; // NSInteger majorVersion
+ s64 minor; // NSInteger minorVersion
+ s64 patch; // NSInteger patchVersion
+};
+
+// Helper function to get the current macOS version, which is easy to do with
+// from Objective-C code, but a little harder from C++.
+MacOSVersion GetMacOSVersion();
+#endif
} // namespace Common
diff --git a/Source/Core/Common/CommonFuncsObjC.mm b/Source/Core/Common/CommonFuncsObjC.mm
new file mode 100644
index 0000000000..fdc7f48ce2
--- /dev/null
+++ b/Source/Core/Common/CommonFuncsObjC.mm
@@ -0,0 +1,15 @@
+// Copyright 2026 Dolphin Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "Common/CommonFuncs.h"
+
+#include <Foundation/Foundation.h>
+
+namespace Common
+{
+MacOSVersion GetMacOSVersion()
+{
+ const NSOperatingSystemVersion ver = [[NSProcessInfo processInfo] operatingSystemVersion];
+ return {ver.majorVersion, ver.minorVersion, ver.patchVersion};
+}
+} // namespace Common