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 bad51cdb52 is constrained to just macOS versions before macOS 12 (Monterey).
This commit is contained in:
Lukáš Hejl 2021-11-08 11:13:07 +01:00
parent 8bc074f5f2
commit ce1fbbfa7c

View File

@ -79,7 +79,9 @@ std::pair<bool, std::string> 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"});