Fixed generation of texture mipmap using glGenerateMipMap (added also for png)

Fix mipmap of compressed textures on AMD Radeon graphics cards by forcing the use of squared power of two textures

(cherry picked from commit prusa3d/PrusaSlicer@971f2a08e2)
(cherry picked from commit prusa3d/PrusaSlicer@eee4453993)
This commit is contained in:
enricoturri1966 2023-11-18 10:18:49 +08:00 committed by Noisyfox
parent c0386d786c
commit 8c0cf34a6c
6 changed files with 360 additions and 168 deletions

View file

@ -1,3 +1,7 @@
///|/ Copyright (c) Prusa Research 2018 - 2023 Enrico Turri @enricoturri1966, Lukáš Matěna @lukasmatena, Lukáš Hejl @hejllukas, Vojtěch Bubník @bubnikv, Vojtěch Král @vojtechkral
///|/
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
///|/
#ifndef slic3r_OpenGLManager_hpp_
#define slic3r_OpenGLManager_hpp_
@ -81,10 +85,11 @@ private:
static OSInfo s_os_info;
#endif //__APPLE__
static bool s_compressed_textures_supported;
static bool s_force_power_of_two_textures;
static EMultisampleState s_multisample;
static EFramebufferType s_framebuffers_type;
static bool m_use_manually_generated_mipmaps;
public:
OpenGLManager() = default;
~OpenGLManager();
@ -101,7 +106,7 @@ public:
static EFramebufferType get_framebuffers_type() { return s_framebuffers_type; }
static wxGLCanvas* create_wxglcanvas(wxWindow& parent);
static const GLInfo& get_gl_info() { return s_gl_info; }
static bool use_manually_generated_mipmaps() { return m_use_manually_generated_mipmaps; }
static bool force_power_of_two_textures() { return s_force_power_of_two_textures; }
private:
static void detect_multisample(int* attribList);