diff -r 8433c87c0f51 -r 78ce93fb46e5 src/glcontext.c --- a/src/glcontext.c Tue Apr 22 19:36:27 2025 +0200 +++ b/src/glcontext.c Wed Apr 23 23:43:45 2025 +0200 @@ -37,15 +37,13 @@ GLsizei length, const GLchar* message, const void* userParam ) { - cxmutstr buf = cx_asprintf( - "source = %d, id = %u, type = %d, severity= %d, message = %.*s", + if (type == GL_DEBUG_TYPE_ERROR) { + asc_error("OpenGL source = %d, id = %u, type = %d, severity= %d, message = %.*s", source, id, type, severity, length, message); - if (type == GL_DEBUG_TYPE_ERROR) { - asc_error(buf.ptr); } else { - asc_dprintf("GL debug: %.*s", (int)buf.length, buf.ptr); + asc_dprintf("OpenGL source = %d, id = %u, type = %d, severity= %d, message = %.*s", + source, id, type, severity, length, message); } - cx_strfree(&buf); } static int asc_primitives_init(AscGLContext *context) { @@ -83,9 +81,7 @@ 0, 1, 1, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); if (white1x1 == NULL) { - // TODO: merge error messages once asc_error allows formatting - asc_error("Failed to create surface"); - asc_error(SDL_GetError()); + asc_error("Failed to create surface: %s", SDL_GetError()); return 1; } SDL_FillRect(white1x1, NULL, 0xFFFFFFFF); @@ -144,7 +140,7 @@ return true; } else { - asc_error(glewGetErrorString(err)); + asc_error("glewInit failed: %s", glewGetErrorString(err)); SDL_GL_DeleteContext(ctx->glctx); return false; }