add shader compilation error logging

This commit is contained in:
2025-06-06 12:49:35 +02:00
parent c5d3449abc
commit ed7a157ee3
2 changed files with 22 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
#include "../util/vec/float2.h"
#include "shader.h"
#include "../error.h"
#define VERTC 6
GLuint pipe;
@@ -36,6 +37,15 @@ int render_init(void) {
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW);
int len;
glGetProgramiv(pipe, GL_INFO_LOG_LENGTH, &len);
if (len > 0) {
char log[len];
glGetProgramInfoLog(pipe, len, &len, log);
log[len - 1] = '\0'; // terminate the string one character sooner since the log includes a newline
fatal("error whilst linking the pipe: '%s'", log);
}
// init the VAO
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);