From a051e5194688565a1192f29721ec6ac98ffcdc45 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Sat, 10 Jan 2026 21:59:03 +0800 Subject: [PATCH] [Fix] (MG_Backend/DirectGLES): patches for Photon (3rd patch) --- MobileGL/MG_Backend/DirectGLES/Managers.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MobileGL/MG_Backend/DirectGLES/Managers.cpp b/MobileGL/MG_Backend/DirectGLES/Managers.cpp index 58e48611..d5219c79 100644 --- a/MobileGL/MG_Backend/DirectGLES/Managers.cpp +++ b/MobileGL/MG_Backend/DirectGLES/Managers.cpp @@ -915,6 +915,15 @@ namespace MobileGL::MG_Backend::DirectGLES { pos = source.find(findStr, pos); } + findStr = "if (gtao.w == 0.0)"; + replaceStr = "if (abs(gtao.w) <= 0.00001)"; + pos = source.find(findStr); + while (pos != String::npos) { + MGLOG_D("Applying patch #3 to Photon..."); + source.replace(pos, findStr.length(), replaceStr); + pos = source.find(findStr, pos); + } + const char* sourceCStr = source.c_str(); MGLOG_D("Setting shader source for backend shader ID: %u\nsrc:\n%s", backendShaderId, sourceCStr); MG_External::GLES::glShaderSource(backendShaderId, 1, &sourceCStr, nullptr);