Always output the shader info log if it's not empty.

This commit is contained in:
Dr. Chat 2015-12-22 14:41:18 -06:00
parent 30eda6909f
commit 59bee898f7
1 changed files with 11 additions and 8 deletions

View File

@ -135,18 +135,21 @@ bool GL4Shader::CompileProgram() {
return false; return false;
} }
// Get error log, if we failed to link. // Output info log.
GLint link_status = 0;
glGetProgramiv(program_, GL_LINK_STATUS, &link_status);
if (!link_status) {
// log_length includes the null character. // log_length includes the null character.
GLint log_length = 0; GLint log_length = 0;
glGetProgramiv(program_, GL_INFO_LOG_LENGTH, &log_length); glGetProgramiv(program_, GL_INFO_LOG_LENGTH, &log_length);
std::string info_log; std::string info_log;
info_log.resize(log_length - 1); info_log.resize(log_length - 1);
glGetProgramInfoLog(program_, log_length, &log_length, glGetProgramInfoLog(program_, log_length, &log_length, &info_log[0]);
const_cast<char*>(info_log.data())); if (!info_log.empty()) {
XELOGE("Unable to link program: %s", info_log.c_str()); XELOGD("Shader log: %s", info_log.c_str());
}
// Get error log, if we failed to link.
GLint link_status = 0;
glGetProgramiv(program_, GL_LINK_STATUS, &link_status);
if (!link_status) {
host_error_log_ = std::move(info_log); host_error_log_ = std::move(info_log);
assert_always("Unable to link generated shader"); assert_always("Unable to link generated shader");
return false; return false;