diff --git a/CHANGELOG.md b/CHANGELOG.md index 01339f6e6..1897dea73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ - Resolve accidental CPU renaming with RestrictEvents - Resolve backlight and internal display support for AMD Navi MXM GPUs - Credit to [@Ausdauersportler](https://github.com/Ausdauersportler) for bug fix +- Resolve 3rd Party Apps erroring on Metal with macOS 13.3 + - Applicable Software: Applications directly using Metal (ex. Blender, Parallels Desktop) + - Applicable Hardware: 3802-based GPUs (ie. Intel Ivy Bridge and Haswell iGPUs, Nvidia Kepler dGPUs) - Backend changes: - Use `.AppleSystemUIFont` for wxPython text rendering (thanks [@jazzzny](https://github.com/Jazzzny)) - Add extra error handling for network errors: @@ -25,7 +28,7 @@ - Implemented Object-Oriented design - Reduced disk I/O and main thread monopolization - Increment Binaries: - - PatcherSupportPkg 0.9.2 - release + - PatcherSupportPkg 0.9.3 - release - OpenCorePkg 0.9.1 - release - AirPortBrcmFixup 2.1.7 - release - RestrictEvents 1.1.0 - release diff --git a/resources/constants.py b/resources/constants.py index 67d2b42e7..419018865 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -13,7 +13,7 @@ class Constants: def __init__(self) -> None: # Patcher Versioning self.patcher_version: str = "0.6.3" # OpenCore-Legacy-Patcher - self.patcher_support_pkg_version: str = "0.9.2" # PatcherSupportPkg + self.patcher_support_pkg_version: str = "0.9.3" # PatcherSupportPkg self.copyright_date: str = "Copyright © 2020-2023 Dortania" # URLs diff --git a/resources/sys_patch/sys_patch.py b/resources/sys_patch/sys_patch.py index 163ebdbba..769c167f4 100644 --- a/resources/sys_patch/sys_patch.py +++ b/resources/sys_patch/sys_patch.py @@ -721,6 +721,8 @@ class PatchSysVolume: sys_patch_helpers.SysPatchHelpers(self.constants).disable_window_server_caching() if any(x in required_patches for x in ["Intel Ivy Bridge", "Intel Haswell"]): sys_patch_helpers.SysPatchHelpers(self.constants).remove_news_widgets() + if "Metal 3802 Common Extended" in required_patches: + sys_patch_helpers.SysPatchHelpers(self.constants).patch_gpu_compiler_libraries(mount_point=self.mount_location) self._write_patchset(required_patches) diff --git a/resources/sys_patch/sys_patch_helpers.py b/resources/sys_patch/sys_patch_helpers.py index ad4e4ef2c..871ed45bc 100644 --- a/resources/sys_patch/sys_patch_helpers.py +++ b/resources/sys_patch/sys_patch_helpers.py @@ -210,4 +210,66 @@ class SysPatchHelpers: logging.info("- Installing Kernel Collection syncing utility") result = utilities.elevated([self.constants.rsrrepair_userspace_path, "--install"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if result.returncode != 0: - logging.info(f" - Failed to install RSRRepair: {result.stdout.decode()}") \ No newline at end of file + logging.info(f" - Failed to install RSRRepair: {result.stdout.decode()}") + + + def patch_gpu_compiler_libraries(self, mount_point: str | Path): + """ + Fix GPUCompiler.framework's libraries to resolve linking issues + + On 13.3 with 3802 GPUs, OCLP will downgrade GPUCompiler to resolve + graphics support. However the binary hardcodes the library names, + and thus we need to adjust the libraries to match (31001.669) + + Important portions of the library will be downgraded to 31001.669, + and the remaining bins will be copied over (via CoW to reduce waste) + + Primary folders to merge: + - 31001.XXX: (current OS version) + - include: + - module.modulemap + - opencl-c.h + - lib (entire directory) + + Parameters: + mount_point: The mount point of the target volume + """ + + if self.constants.detected_os < os_data.os_data.ventura: + return + if self.constants.detected_os == os_data.os_data.ventura: + if self.constants.detected_os_minor < 4: + return + + LIBRARY_DIR = f"{mount_point}/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/31001/Libraries/lib/clang" + GPU_VERSION = "31001.669" + + DEST_DIR = f"{LIBRARY_DIR}/{GPU_VERSION}" + + if not Path(DEST_DIR).exists(): + return + + for file in Path(LIBRARY_DIR).iterdir(): + if file.is_file(): + continue + if file.name == GPU_VERSION: + continue + + # Partial match as each OS can increment the version + if not file.name.startswith("31001."): + continue + + logging.info(f"- Merging GPUCompiler.framework libraries to match binary") + + src_dir = f"{LIBRARY_DIR}/{file.name}" + for file in ["module.modulemap", "opencl-c.h"]: + # Copy on Write to reduce disk usage + dst_path = f"{DEST_DIR}/include/{file}" + if Path(dst_path).exists(): + continue + utilities.process_status(utilities.elevated(["cp", "-c", dst_path, f"{DEST_DIR}/include/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)) + + if not Path(f"{DEST_DIR}/lib").exists(): + utilities.process_status(utilities.elevated(["cp", "-cR", f"{src_dir}/lib", f"{DEST_DIR}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)) + + break \ No newline at end of file