summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/utils.c
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-05-12 11:27:00 +0200
committerNiklas Haas <git@nand.wakku.to>2016-05-15 20:42:02 +0200
commitdfc7b59909588985ee1be19f313f8bfb858ab8b0 (patch)
tree3f563890139c210f573312727db61d89a8e43e14 /video/out/opengl/utils.c
parent034faaa9d818bd8c1c52c879e383b8e7350d3df5 (diff)
downloadmpv-dfc7b59909588985ee1be19f313f8bfb858ab8b0.tar.bz2
mpv-dfc7b59909588985ee1be19f313f8bfb858ab8b0.tar.xz
vo_opengl: make the screen blue on shader errors
This helps visually signify that somthing went wrong, and prevents confusing shader compilation errors with other types of bugs.
Diffstat (limited to 'video/out/opengl/utils.c')
-rw-r--r--video/out/opengl/utils.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c
index d29d7b0bdb..5ef99ac599 100644
--- a/video/out/opengl/utils.c
+++ b/video/out/opengl/utils.c
@@ -485,6 +485,8 @@ struct gl_shader_cache {
struct sc_uniform uniforms[SC_UNIFORM_ENTRIES];
int num_uniforms;
+ bool error_state; // true if an error occurred
+
// temporary buffers (avoids frequent reallocations)
bstr tmp[5];
};
@@ -532,6 +534,16 @@ void gl_sc_destroy(struct gl_shader_cache *sc)
talloc_free(sc);
}
+bool gl_sc_error_state(struct gl_shader_cache *sc)
+{
+ return sc->error_state;
+}
+
+void gl_sc_reset_error(struct gl_shader_cache *sc)
+{
+ sc->error_state = false;
+}
+
void gl_sc_enable_extension(struct gl_shader_cache *sc, char *name)
{
bstr_xappend_asprintf(sc, &sc->prelude_text, "#extension %s : enable\n", name);
@@ -810,6 +822,9 @@ static void compile_attach_shader(struct gl_shader_cache *sc, GLuint program,
gl->AttachShader(program, shader);
gl->DeleteShader(shader);
+
+ if (!status)
+ sc->error_state = true;
}
static void link_shader(struct gl_shader_cache *sc, GLuint program)
@@ -828,6 +843,9 @@ static void link_shader(struct gl_shader_cache *sc, GLuint program)
MP_MSG(sc, pri, "shader link log (status=%d): %s\n", status, logstr);
talloc_free(logstr);
}
+
+ if (!status)
+ sc->error_state = true;
}
static GLuint create_program(struct gl_shader_cache *sc, const char *vertex,