Warn for failed shader compile or link in GUI when artist debug mode

This commit is contained in:
Benau 2018-01-26 16:02:00 +08:00
parent 313661ad07
commit 9e2d649b55
2 changed files with 18 additions and 0 deletions

View File

@ -18,9 +18,11 @@
#ifndef SERVER_ONLY
#include "graphics/shader_files_manager.hpp"
#include "config/user_config.hpp"
#include "config/stk_config.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/graphics_restrictions.hpp"
#include "guiengine/message_queue.hpp"
#include "io/file_manager.hpp"
#include "utils/log.hpp"
@ -227,6 +229,13 @@ ShaderFilesManager::SharedShader ShaderFilesManager::loadShader
glGetShaderInfoLog(*ss, info_length, NULL, error_message);
Log::error("ShaderFilesManager", error_message);
delete[] error_message;
if (UserConfigParams::m_artist_debug_mode)
{
core::stringw err = StringUtils::insertValues(L"Shader file %s"
" failed to compile, check stdout.log or console for details",
full_path.c_str());
MessageQueue::add(MessageQueue::MT_ERROR, err);
}
return NULL;
}
glGetError();

View File

@ -16,10 +16,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "graphics/sp/sp_shader.hpp"
#include "config/user_config.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/shader_files_manager.hpp"
#include "graphics/sp/sp_base.hpp"
#include "graphics/sp/sp_uniform_assigner.hpp"
#include "guiengine/message_queue.hpp"
#include "utils/string_utils.hpp"
namespace SP
@ -81,6 +83,13 @@ void SPShader::linkShaderFiles(RenderPass rp)
}
if (result == GL_FALSE)
{
if (UserConfigParams::m_artist_debug_mode)
{
core::stringw err = StringUtils::insertValues(L"Shader %s failed"
" to link, check stdout.log or console for details",
m_name.c_str());
MessageQueue::add(MessageQueue::MT_ERROR, err);
}
glDeleteProgram(m_program[rp]);
m_program[rp] = 0;
}