src/shader.c

changeset 92
78ce93fb46e5
parent 88
6234b7ea48f3
--- a/src/shader.c	Tue Apr 22 19:36:27 2025 +0200
+++ b/src/shader.c	Wed Apr 23 23:43:45 2025 +0200
@@ -47,7 +47,7 @@
 static unsigned asc_shader_compile(unsigned int type, char const *code) {
     GLuint id = glCreateShader(type);
     if (id == 0) {
-        asc_error("glCreateShader failed");
+        asc_error("glCreateShader failed: %s", glGetError());
         return 0;
     }
 
@@ -63,7 +63,7 @@
         char *log = malloc(1024);
         glGetShaderInfoLog(id, 1024, NULL, log);
         glDeleteShader(id);
-        asc_error(log);
+        asc_error("Shader %u compilation failed.\n%s", id, log);
         free(log);
         return 0;
     }
@@ -82,7 +82,7 @@
     GLint success;
     GLint id = glCreateProgram();
     if (id <= 0) {
-        asc_error("glCreateProgram failed");
+        asc_error("glCreateProgram failed: %s", glGetError());
         return (AscShaderProgram) {0};
     }
     for (unsigned i = 0; i < n; i++) {
@@ -106,7 +106,7 @@
         char *log = malloc(1024);
         glGetProgramInfoLog(id, 1024, NULL, log);
         glDeleteProgram(id);
-        asc_error(log);
+        asc_error("Linking shader program %u failed.\n%s", id, log);
         free(log);
         return (AscShaderProgram) {0};
     }

mercurial