From ce1fbbfa7c1867f651eb26aba9ea403e0b43c365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Mon, 8 Nov 2021 11:13:07 +0100 Subject: [PATCH] OSX specific: Fix of #7259 - (Darker colors of objects inside the multi-material gizmo on macOS Monterey on Arm64 CPU) Since macOS 12 (Monterey), the issue with the opposite direction on macOS running on Arm64 CPU seems to be fixed, and computed triangle normals inside fragment shader using dFdx and dFdy have the right direction. So the previous patch bad51cdb520919362100b4381b9bb03cd1830643 is constrained to just macOS versions before macOS 12 (Monterey). --- src/slic3r/GUI/GLShadersManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLShadersManager.cpp b/src/slic3r/GUI/GLShadersManager.cpp index 0214652b2..01407b09a 100644 --- a/src/slic3r/GUI/GLShadersManager.cpp +++ b/src/slic3r/GUI/GLShadersManager.cpp @@ -79,7 +79,9 @@ std::pair GLShadersManager::init() // For Apple's on Arm CPU computed triangle normals inside fragment shader using dFdx and dFdy has the opposite direction. // Because of this, objects had darker colors inside the multi-material gizmo. // Based on https://stackoverflow.com/a/66206648, the similar behavior was also spotted on some other devices with Arm CPU. - if (platform_flavor() == PlatformFlavor::OSXOnArm) + // Since macOS 12 (Monterey), this issue with the opposite direction on Apple's Arm CPU seems to be fixed, and computed + // triangle normals inside fragment shader have the right direction. + if (platform_flavor() == PlatformFlavor::OSXOnArm && wxPlatformInfo::Get().GetOSMajorVersion() < 12) valid &= append_shader("mm_gouraud", {"mm_gouraud.vs", "mm_gouraud.fs"}, {"FLIP_TRIANGLE_NORMALS"sv}); else valid &= append_shader("mm_gouraud", {"mm_gouraud.vs", "mm_gouraud.fs"});