Only warn for possible undeleted opengl stuff when debug build

Happens when you press close button in stk window.
This commit is contained in:
Benau 2018-01-23 16:18:48 +08:00
parent 9ecf952057
commit d8511956f5
3 changed files with 12 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#define HEADER_SHADER_FILES_MANAGER_HPP #define HEADER_SHADER_FILES_MANAGER_HPP
#include "graphics/gl_headers.hpp" #include "graphics/gl_headers.hpp"
#include "utils/log.hpp"
#include "utils/no_copy.hpp" #include "utils/no_copy.hpp"
#include "utils/singleton.hpp" #include "utils/singleton.hpp"
@ -60,7 +61,13 @@ public:
void removeAllShaderFiles() void removeAllShaderFiles()
{ {
removeUnusedShaderFiles(); removeUnusedShaderFiles();
assert(m_shader_files_loaded.empty()); if (!m_shader_files_loaded.empty())
{
#ifdef DEBUG
Log::error("ShaderFilesManager", "Some shader file > 1 ref_count");
#endif
m_shader_files_loaded.clear();
}
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void removeUnusedShaderFiles() void removeUnusedShaderFiles()

View File

@ -139,10 +139,12 @@ SPShaderManager::~SPShaderManager()
{ {
m_official_shaders.clear(); m_official_shaders.clear();
removeUnusedShaders(); removeUnusedShaders();
#ifdef DEBUG
for (auto p : m_shaders) for (auto p : m_shaders)
{ {
Log::error("SPShaderManager", "%s > 1 ref_count", p.first.c_str()); Log::error("SPShaderManager", "%s > 1 ref_count", p.first.c_str());
} }
#endif
} // ~SPShaderManager } // ~SPShaderManager
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -89,10 +89,12 @@ SPTextureManager::~SPTextureManager()
} }
m_threaded_load_obj.clear(); m_threaded_load_obj.clear();
removeUnusedTextures(); removeUnusedTextures();
#ifdef DEBUG
for (auto p : m_textures) for (auto p : m_textures)
{ {
Log::error("SPTextureManager", "%s > 1 ref_count", p.first.c_str()); Log::error("SPTextureManager", "%s > 1 ref_count", p.first.c_str());
} }
#endif
} // ~SPTextureManager } // ~SPTextureManager
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------