Stop if shader compilation fails

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2022-07-19 20:58:32 +02:00
parent e58028ae18
commit 6bfa914582

View file

@ -209,6 +209,7 @@ int main(int argc, char **argv)
if (!shader_program_get_build_status(prog)) { if (!shader_program_get_build_status(prog)) {
shader_program_print_info_log(prog); shader_program_print_info_log(prog);
goto fail_vao;
} }
glUseProgram(prog); glUseProgram(prog);
@ -278,19 +279,20 @@ int main(int argc, char **argv)
} }
/******************** cleanup ********************/ /******************** cleanup ********************/
glUseProgram(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &vbo);
glBindVertexArray(0);
glDeleteVertexArrays(1, &vao);
glDeleteProgram(prog);
if (to_stdout) { if (to_stdout) {
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &fbo); glDeleteFramebuffers(1, &fbo);
glDeleteTextures(1, &fbo_tex); glDeleteTextures(1, &fbo_tex);
} }
glUseProgram(0);
glDeleteProgram(prog);
fail_vao:
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &vbo);
glBindVertexArray(0);
glDeleteVertexArrays(1, &vao);
window_make_current(NULL); window_make_current(NULL);
free(fb32); free(fb32);
free(fb24); free(fb24);