Fix cases where GL_INFO_LOG_LENGTH returns 0.

This commit is contained in:
Dr. Chat 2015-12-22 20:15:07 -06:00
parent b49114bad6
commit 990a8baf1b
1 changed files with 5 additions and 2 deletions

View File

@ -140,8 +140,11 @@ bool GL4Shader::CompileProgram() {
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); if (log_length > 0) {
glGetProgramInfoLog(program_, log_length, &log_length, &info_log[0]); info_log.resize(log_length - 1);
glGetProgramInfoLog(program_, log_length, &log_length, &info_log[0]);
}
if (!info_log.empty()) { if (!info_log.empty()) {
XELOGD("Shader log: %s", info_log.c_str()); XELOGD("Shader log: %s", info_log.c_str());
} }