From db952f9ffd5eef714de1b94719a39cacbff09013 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 27 Feb 2023 13:15:02 +0100 Subject: tests: use gl2-functions for logs glGetInfoLogARB is only available in ARB_shader_objects, which we don't really use. So let's use the GL2 equivialents instead. Reviewed-by: Hoe Hao Cheng --- src/tests/shader_api.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/tests/shader_api.c b/src/tests/shader_api.c index 3da001a9..efc100ae 100644 --- a/src/tests/shader_api.c +++ b/src/tests/shader_api.c @@ -42,30 +42,33 @@ static void assert_error_test(const char *file, int line, GLenum expect) #define assert_error(err) assert_error_test(__FILE__, __LINE__, (err)) -static void check_status(GLuint id, GLenum pname, void (GLAPIENTRY *query)(GLuint, GLenum, GLint *)) -{ - GLint status; - - query(id, pname, &status); - if (!status) - { - char info[65536]; - - fprintf(stderr, "Compilation/link failure:\n"); - glGetInfoLogARB(id, sizeof(info), NULL, info); - fprintf(stderr, "%s\n", info); - exit(1); - } -} - static void check_compile_status(GLuint id) { - check_status(id, GL_COMPILE_STATUS, glGetShaderiv); + GLint status; + + glGetShaderiv(id, GL_COMPILE_STATUS, &status); + if (!status) { + char info[65536]; + fprintf(stderr, "Compilation failure:\n"); + glGetShaderInfoLog(id, sizeof(info), NULL, info); + fprintf(stderr, "%s\n", info); + exit(1); + } } static void check_link_status(GLuint id) { - check_status(id, GL_LINK_STATUS, glGetProgramiv); + GLint status; + + glGetProgramiv(id, GL_LINK_STATUS, &status); + if (!status) { + char info[65536]; + + fprintf(stderr, "Compilation/link failure:\n"); + glGetProgramInfoLog(id, sizeof(info), NULL, info); + fprintf(stderr, "%s\n", info); + exit(1); + } } static GLuint make_shader(GLenum type, const char *src) -- cgit v1.2.1