citra-emu
/
citra-canary
Archived
1
0
Fork 0

Print broken shader code to log

This commit is contained in:
Jannik Vogel 2016-12-04 12:44:29 +01:00
parent 100f5f4131
commit 0edc986861
1 changed files with 9 additions and 3 deletions

View File

@ -31,7 +31,7 @@ GLuint LoadProgram(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> vertex_shader_error(info_log_length); std::vector<char> vertex_shader_error(info_log_length);
glGetShaderInfoLog(vertex_shader_id, info_log_length, nullptr, &vertex_shader_error[0]); glGetShaderInfoLog(vertex_shader_id, info_log_length, nullptr, &vertex_shader_error[0]);
if (result) { if (result == GL_TRUE) {
LOG_DEBUG(Render_OpenGL, "%s", &vertex_shader_error[0]); LOG_DEBUG(Render_OpenGL, "%s", &vertex_shader_error[0]);
} else { } else {
LOG_ERROR(Render_OpenGL, "Error compiling vertex shader:\n%s", &vertex_shader_error[0]); LOG_ERROR(Render_OpenGL, "Error compiling vertex shader:\n%s", &vertex_shader_error[0]);
@ -51,7 +51,7 @@ GLuint LoadProgram(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> fragment_shader_error(info_log_length); std::vector<char> fragment_shader_error(info_log_length);
glGetShaderInfoLog(fragment_shader_id, info_log_length, nullptr, &fragment_shader_error[0]); glGetShaderInfoLog(fragment_shader_id, info_log_length, nullptr, &fragment_shader_error[0]);
if (result) { if (result == GL_TRUE) {
LOG_DEBUG(Render_OpenGL, "%s", &fragment_shader_error[0]); LOG_DEBUG(Render_OpenGL, "%s", &fragment_shader_error[0]);
} else { } else {
LOG_ERROR(Render_OpenGL, "Error compiling fragment shader:\n%s", LOG_ERROR(Render_OpenGL, "Error compiling fragment shader:\n%s",
@ -75,13 +75,19 @@ GLuint LoadProgram(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> program_error(info_log_length); std::vector<char> program_error(info_log_length);
glGetProgramInfoLog(program_id, info_log_length, nullptr, &program_error[0]); glGetProgramInfoLog(program_id, info_log_length, nullptr, &program_error[0]);
if (result) { if (result == GL_TRUE) {
LOG_DEBUG(Render_OpenGL, "%s", &program_error[0]); LOG_DEBUG(Render_OpenGL, "%s", &program_error[0]);
} else { } else {
LOG_ERROR(Render_OpenGL, "Error linking shader:\n%s", &program_error[0]); LOG_ERROR(Render_OpenGL, "Error linking shader:\n%s", &program_error[0]);
} }
} }
// If the program linking failed at least one of the shaders was probably bad
if (result == GL_FALSE) {
LOG_ERROR(Render_OpenGL, "Vertex shader:\n%s", vertex_shader);
LOG_ERROR(Render_OpenGL, "Fragment shader:\n%s", fragment_shader);
}
glDeleteShader(vertex_shader_id); glDeleteShader(vertex_shader_id);
glDeleteShader(fragment_shader_id); glDeleteShader(fragment_shader_id);