From e9374cde7e471b0150140b37e5bd7cd5a0d720d9 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 26 Oct 2016 18:16:34 +0300 Subject: [PATCH] Always print shader and program info logs in debug mode They may contain useful warnings even if the code was accepted. --- source/program.cpp | 7 +++++++ source/shader.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/source/program.cpp b/source/program.cpp index 021b2348..82308b34 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "buffer.h" #include "error.h" @@ -115,6 +116,12 @@ void Program::link() if(!linked) throw compile_error(get_info_log()); +#ifdef DEBUG + std::string info_log = get_info_log(); + if(!info_log.empty()) + IO::print("Program link info log:\n%s", info_log); +#endif + unsigned count = get_program_i(id, GL_ACTIVE_UNIFORMS); vector uniforms_by_index(count); for(unsigned i=0; i #include #include +#include #include "error.h" #include "misc.h" #include "shader.h" @@ -64,6 +65,12 @@ void Shader::compile() compiled = get_shader_i(id, GL_COMPILE_STATUS); if(!compiled) throw compile_error(get_info_log()); + +#ifdef DEBUG + string info_log = get_info_log(); + if(!info_log.empty()) + IO::print("Shader compile info log:\n%s", info_log); +#endif } string Shader::get_info_log() const -- 2.45.2