This commit is contained in:
Filip Sykala - NTB T15p 2023-01-12 15:27:28 +01:00
commit c329e1084a

View File

@ -412,30 +412,19 @@ bool OpenGLManager::init_gl()
#ifdef _WIN32 #ifdef _WIN32
// Since AMD driver version 22.7.1, there is probably some bug in the driver that causes the issue with the missing // Since AMD driver version 22.7.1, there is probably some bug in the driver that causes the issue with the missing
// texture of the bed. It seems that this issue only triggers when mipmaps are generated manually // texture of the bed (see: https://github.com/prusa3d/PrusaSlicer/issues/8417).
// (combined with a texture compression) and when mipmaps are generated through OpenGL glGenerateMipmap is working. // It seems that this issue only triggers when mipmaps are generated manually
// So, for newer drivers than 22.6.1, the last working driver version, we use mipmaps generated through OpenGL. // (combined with a texture compression) with texture size not being power of two.
if (const auto gl_info = OpenGLManager::get_gl_info(); boost::contains(gl_info.get_vendor(), "ATI Technologies Inc.")) { // When mipmaps are generated through OpenGL function glGenerateMipmap() the driver works fine.
// WHQL drivers seem to have one more version number at the end besides non-WHQL drivers. // There is no an easy way to detect the driver version without using Win32 API because the strings returned by OpenGL
// WHQL: 4.6.14800 Compatibility Profile Context 22.6.1 30.0.21023.1015 // have no standardized format, only some of them contain the driver version.
// Non-WHQL: 4.6.0 Compatibility Profile Context 22.8.1.220810 // Until we do not know that driver will be fixed (if ever) we force the use of glGenerateMipmap() on all cards
std::regex version_rgx(R"(Compatibility\sProfile\sContext\s(\d+)\.(\d+)\.(\d+))"); // containing the string 'Radeon' in the string returned by glGetString(GL_RENDERER)
if (std::smatch matches; std::regex_search(gl_info.get_version_string(), matches, version_rgx) && matches.size() == 4) { const auto& gl_info = OpenGLManager::get_gl_info();
int version_major = std::stoi(matches[1].str()); if (boost::contains(gl_info.get_vendor(), "ATI Technologies Inc.") && boost::contains(gl_info.get_renderer(), "Radeon")) {
int version_minor = std::stoi(matches[2].str());
int version_patch = std::stoi(matches[3].str());
BOOST_LOG_TRIVIAL(debug) << "Found AMD driver version: " << version_major << "." << version_minor << "." << version_patch;
if (version_major > 22 || (version_major == 22 && version_minor > 6) || (version_major == 22 && version_minor == 6 && version_patch > 1)) {
m_use_manually_generated_mipmaps = false; m_use_manually_generated_mipmaps = false;
BOOST_LOG_TRIVIAL(debug) << "Mipmapping through OpenGL was enabled."; BOOST_LOG_TRIVIAL(debug) << "Mipmapping through OpenGL was enabled.";
} }
} else {
BOOST_LOG_TRIVIAL(error) << "Not recognized format of version.";
}
} else {
BOOST_LOG_TRIVIAL(error) << "Unable to parse version of AMD driver.";
}
#endif #endif
} }