vo_opengl: drop ra_gl.h from shader_cache.c

Since the GL *gl is no longer needed for the timers, we can get rid of
the sc->gl dependency. This requires moving a utility function (which is
not GL-specific anyway) out of gl_utils.h and into utils.h
This commit is contained in:
Niklas Haas 2017-08-05 19:38:43 +02:00
parent e5748e891f
commit 988d188d96
No known key found for this signature in database
GPG Key ID: 9A09076581B27402
6 changed files with 23 additions and 25 deletions

View File

@ -130,22 +130,6 @@ mp_image_t *gl_read_fbo_contents(GL *gl, int fbo, int w, int h)
return image;
}
void mp_log_source(struct mp_log *log, int lev, const char *src)
{
int line = 1;
if (!src)
return;
while (*src) {
const char *end = strchr(src, '\n');
const char *next = end + 1;
if (!end)
next = end = src + strlen(src);
mp_msg(log, lev, "[%3d] %.*s\n", line, (int)(end - src), src);
line++;
src = next;
}
}
static void gl_vao_enable_attribs(struct gl_vao *vao)
{
GL *gl = vao->gl;

View File

@ -34,10 +34,6 @@ void gl_upload_tex(GL *gl, GLenum target, GLenum format, GLenum type,
mp_image_t *gl_read_fbo_contents(GL *gl, int fbo, int w, int h);
// print a multi line string with line numbers (e.g. for shader sources)
// log, lev: module and log level, as in mp_msg()
void mp_log_source(struct mp_log *log, int lev, const char *src);
struct gl_vao {
GL *gl;
GLuint vao; // the VAO object, or 0 if unsupported by driver

View File

@ -1,6 +1,7 @@
#include <libavutil/intreadwrite.h>
#include "formats.h"
#include "utils.h"
#include "ra_gl.h"
static struct ra_fns ra_fns_gl;

View File

@ -15,7 +15,6 @@
#include "stream/stream.h"
#include "shader_cache.h"
#include "formats.h"
#include "ra_gl.h"
#include "utils.h"
// Force cache flush if more than this number of shaders is created.
@ -48,7 +47,6 @@ struct sc_entry {
struct gl_shader_cache {
struct ra *ra;
GL *gl;
struct mp_log *log;
// permanent
@ -97,7 +95,6 @@ struct gl_shader_cache *gl_sc_create(struct ra *ra, struct mpv_global *global,
struct gl_shader_cache *sc = talloc_ptrtype(NULL, sc);
*sc = (struct gl_shader_cache){
.ra = ra,
.gl = ra_gl_get(ra),
.global = global,
.log = log,
};
@ -105,8 +102,8 @@ struct gl_shader_cache *gl_sc_create(struct ra *ra, struct mpv_global *global,
return sc;
}
// Reset the previous pass. This must be called after
// Unbind all GL state managed by sc - the current program and texture units.
// Reset the previous pass. This must be called after gl_sc_generate and before
// starting a new shader.
static void gl_sc_reset(struct gl_shader_cache *sc)
{
sc->prelude_text.len = 0;

View File

@ -221,3 +221,19 @@ struct mp_pass_perf timer_pool_measure(struct timer_pool *pool)
return res;
}
void mp_log_source(struct mp_log *log, int lev, const char *src)
{
int line = 1;
if (!src)
return;
while (*src) {
const char *end = strchr(src, '\n');
const char *next = end + 1;
if (!end)
next = end = src + strlen(src);
mp_msg(log, lev, "[%3d] %.*s\n", line, (int)(end - src), src);
line++;
src = next;
}
}

View File

@ -86,3 +86,7 @@ void timer_pool_destroy(struct timer_pool *pool);
void timer_pool_start(struct timer_pool *pool);
void timer_pool_stop(struct timer_pool *pool);
struct mp_pass_perf timer_pool_measure(struct timer_pool *pool);
// print a multi line string with line numbers (e.g. for shader sources)
// log, lev: module and log level, as in mp_msg()
void mp_log_source(struct mp_log *log, int lev, const char *src);