aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/shader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/shader.c')
-rw-r--r--src/graphics/shader.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/graphics/shader.c b/src/graphics/shader.c
index 8f44f0f..83c8407 100644
--- a/src/graphics/shader.c
+++ b/src/graphics/shader.c
@@ -25,7 +25,7 @@ static void print_compile_log(mgl_context *context, unsigned int shader_id, cons
if(log_length > 0) {
char *log_str = malloc(log_length + 1);
if(!log_str) {
- fprintf(stderr, "Error: failed to allocate memory for shader compile log\n");
+ fprintf(stderr, "mgl error: failed to allocate memory for shader compile log\n");
return;
}
@@ -47,7 +47,7 @@ static int mgl_shader_load_from_memory(mgl_shader *self, const unsigned char *sh
mgl_context *context = mgl_get_context();
self->id = context->gl.glCreateShader(mgl_shader_type_to_gl_shader_type(shader_type));
if(self->id == 0) {
- fprintf(stderr, "Error: failed to load shader, error: glCreateShader failed\n");
+ fprintf(stderr, "mgl error: failed to load shader, error: glCreateShader failed\n");
return -1;
}
@@ -57,12 +57,12 @@ static int mgl_shader_load_from_memory(mgl_shader *self, const unsigned char *sh
int compiled_successfully = GL_FALSE;
context->gl.glGetShaderiv(self->id, GL_COMPILE_STATUS, &compiled_successfully);
if(compiled_successfully == GL_FALSE) {
- print_compile_log(context, self->id, "Error");
+ print_compile_log(context, self->id, "mgl error");
mgl_shader_unload(self);
return -1;
}
- print_compile_log(context, self->id, "Warning");
+ print_compile_log(context, self->id, "mgl warning");
return 0;
}
@@ -72,12 +72,12 @@ static int mgl_shader_load_from_file(mgl_shader *self, const char *filepath, mgl
mgl_filedata filedata;
if(mgl_load_file(filepath, &filedata, NULL) != 0) {
- fprintf(stderr, "Error: failed to load shader %s, error: mgl_load_file failed\n", filepath);
+ fprintf(stderr, "mgl error: failed to load shader %s, error: mgl_load_file failed\n", filepath);
return -1;
}
if(filedata.size > INT32_MAX) {
- fprintf(stderr, "Error: failed to load shader %s, error: shader size is too large\n", filepath);
+ fprintf(stderr, "mgl error: failed to load shader %s, error: shader size is too large\n", filepath);
return -1;
}
@@ -100,7 +100,7 @@ int mgl_shader_program_init(mgl_shader_program *self) {
mgl_context *context = mgl_get_context();
self->id = context->gl.glCreateProgram();
if(self->id == 0) {
- fprintf(stderr, "Error: failed to create shader program: error glCreateProgram failed\n");
+ fprintf(stderr, "mgl error: failed to create shader program: error glCreateProgram failed\n");
return -1;
}
@@ -143,7 +143,7 @@ static void print_link_log(mgl_context *context, unsigned int shader_id, const c
if(log_length > 0) {
char *log_str = malloc(log_length + 1);
if(!log_str) {
- fprintf(stderr, "Error: failed to allocate memory for shader link log\n");
+ fprintf(stderr, "mgl error: failed to allocate memory for shader link log\n");
return;
}
@@ -163,11 +163,11 @@ int mgl_shader_program_finalize(mgl_shader_program *self) {
int is_linked = GL_TRUE;
context->gl.glGetProgramiv(self->id, GL_LINK_STATUS, &is_linked);
if(is_linked == GL_FALSE) {
- print_link_log(context, self->id, "Error");
+ print_link_log(context, self->id, "mgl error");
return -1;
}
- print_link_log(context, self->id, "Warning");
+ print_link_log(context, self->id, "mgl warning");
return 0;
}
@@ -179,7 +179,7 @@ int mgl_shader_program_set_uniform_float(mgl_shader_program *self, const char *u
mgl_context *context = mgl_get_context();
int uniform_location = context->gl.glGetUniformLocation(self->id, uniform_name);
if(uniform_location == -1) {
- fprintf(stderr, "Error: no uniform by the name %s was found in the shader\n", uniform_name);
+ fprintf(stderr, "mgl error: no uniform by the name %s was found in the shader\n", uniform_name);
return -1;
}
@@ -193,7 +193,7 @@ int mgl_shader_program_set_uniform_vec2f(mgl_shader_program *self, const char *u
mgl_context *context = mgl_get_context();
int uniform_location = context->gl.glGetUniformLocation(self->id, uniform_name);
if(uniform_location == -1) {
- fprintf(stderr, "Error: no uniform by the name %s was found in the shader\n", uniform_name);
+ fprintf(stderr, "mgl error: no uniform by the name %s was found in the shader\n", uniform_name);
return -1;
}