diff --git a/MobileGL/MG_Backend/DirectGLES/Managers.cpp b/MobileGL/MG_Backend/DirectGLES/Managers.cpp index 04acd607..1d8afb28 100644 --- a/MobileGL/MG_Backend/DirectGLES/Managers.cpp +++ b/MobileGL/MG_Backend/DirectGLES/Managers.cpp @@ -899,41 +899,41 @@ namespace MobileGL::MG_Backend::DirectGLES { source = ForceSupporterOutput(source); // TODO: probably a patch system? - String findStr = "if (distance_weight_sum == 0.0)"; - String replaceStr = "if (distance_weight_sum <= 0.0001)"; - auto pos = source.find(findStr); - while (pos != String::npos) { - MGLOG_D("Applying patch #1 to Photon..."); - source.replace(pos, findStr.length(), replaceStr); - pos = source.find(findStr, pos); - } + // String findStr = "if (distance_weight_sum == 0.0)"; + // String replaceStr = "if (distance_weight_sum <= 0.0001)"; + // auto pos = source.find(findStr); + // while (pos != String::npos) { + // MGLOG_D("Applying patch #1 to Photon..."); + // source.replace(pos, findStr.length(), replaceStr); + // pos = source.find(findStr, pos); + // } - findStr = "1000000.0"; - replaceStr = "65500.0"; - pos = source.find(findStr); + String findStr = "1000000.0"; + String replaceStr = "65500.0"; + auto pos = source.find(findStr); while (pos != String::npos) { MGLOG_D("Applying patch #2 to Photon..."); source.replace(pos, findStr.length(), replaceStr); 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); - } + // 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); + // } - findStr = "== 0.0"; - replaceStr = "<= 0.00001"; - pos = source.find(findStr); - while (pos != String::npos) { - MGLOG_D("Applying patch #4 to Photon..."); - source.replace(pos, findStr.length(), replaceStr); - pos = source.find(findStr, pos); - } + // findStr = "== 0.0"; + // replaceStr = "<= 0.00001"; + // pos = source.find(findStr); + // while (pos != String::npos) { + // MGLOG_D("Applying patch #4 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); diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp b/MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp index 79110c6b..ec258a35 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp @@ -453,11 +453,13 @@ namespace MobileGL { MGLOG_D("ProgramObject %u: GenerateBinary - generated %zu SPIR-V modules", m_externalIndex, m_generatedSpirv.size()); - for (SizeT i = 0; i < m_generatedSpirv.size(); i++) { - auto& spv = m_generatedSpirv[i]; - + for (auto& spv: m_generatedSpirv) { auto success = ShaderCompiler::SanitizeBinary(spv, spv); MOBILEGL_ASSERT(success, "SanitizeBinary failed"); + } + + for (SizeT i = 0; i < m_generatedSpirv.size(); i++) { + auto& spv = m_generatedSpirv[i]; auto shaderType = shaderTypes[i]; MGLOG_D("ProgramObject %u: GenerateBinary - parsing SPIR-V meta data for module %zu " diff --git a/MobileGL/MG_Util/ShaderTranspiler/SpirvPasses/FloatEqualsZeroEliminationPass.cpp b/MobileGL/MG_Util/ShaderTranspiler/SpirvPasses/FloatEqualsZeroEliminationPass.cpp index 0b8cde95..c454652a 100644 --- a/MobileGL/MG_Util/ShaderTranspiler/SpirvPasses/FloatEqualsZeroEliminationPass.cpp +++ b/MobileGL/MG_Util/ShaderTranspiler/SpirvPasses/FloatEqualsZeroEliminationPass.cpp @@ -72,6 +72,7 @@ namespace MobileGL { } // --- Found it, continue to patch it --- + MGLOG_D("Found 1 occurrence of `FloatEqualsZero`, patching"); // 1. Get var type (Float) and result type (Bool) uint32_t float_type_id = def_use_mgr->GetDef(var_id)->type_id();