summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-12 00:57:32 +0200
committerwm4 <wm4@nowhere>2013-09-12 01:34:42 +0200
commitbeb1aa59885bb84ace9a055963af0fc756e69547 (patch)
tree71ef56f983d19ef85963a0690a5bde4abb3d6454 /video
parent057407a39f160bfd2dd3911dfaa81c750f991ada (diff)
downloadmpv-beb1aa59885bb84ace9a055963af0fc756e69547.tar.bz2
mpv-beb1aa59885bb84ace9a055963af0fc756e69547.tar.xz
gl_common: complete mp_msg conversion
Hopefully this works on Wayland and Cocoa, which I didn't test.
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_cocoa.c2
-rw-r--r--video/out/gl_common.c57
-rw-r--r--video/out/gl_common.h4
-rw-r--r--video/out/gl_video.c6
-rw-r--r--video/out/gl_w32.c4
-rw-r--r--video/out/gl_wayland.c5
-rw-r--r--video/out/gl_x11.c6
7 files changed, 42 insertions, 42 deletions
diff --git a/video/out/gl_cocoa.c b/video/out/gl_cocoa.c
index 7f3b38a422..f9acffb2fb 100644
--- a/video/out/gl_cocoa.c
+++ b/video/out/gl_cocoa.c
@@ -30,7 +30,7 @@ static bool config_window_cocoa(struct MPGLContext *ctx, uint32_t d_width,
if (rv != 0)
return false;
- mpgl_load_functions(ctx->gl, (void *)vo_cocoa_glgetaddr, NULL);
+ mpgl_load_functions(ctx->gl, (void *)vo_cocoa_glgetaddr, NULL, ctx->vo->log);
ctx->depth_r = vo_cocoa_cgl_color_size(ctx->vo);
ctx->depth_g = vo_cocoa_cgl_color_size(ctx->vo);
diff --git a/video/out/gl_common.c b/video/out/gl_common.c
index 589491f2d7..648d4462e8 100644
--- a/video/out/gl_common.c
+++ b/video/out/gl_common.c
@@ -63,14 +63,14 @@ static const char *gl_error_to_string(GLenum error)
}
}
-void glCheckError(GL *gl, const char *info)
+void glCheckError(GL *gl, struct mp_log *log, const char *info)
{
for (;;) {
GLenum error = gl->GetError();
if (error == GL_NO_ERROR)
break;
- mp_msg(MSGT_VO, MSGL_ERR, "[gl] %s: OpenGL error %s.\n", info,
- gl_error_to_string(error));
+ mp_msg_log(log, MSGL_ERR, "%s: OpenGL error %s.\n", info,
+ gl_error_to_string(error));
}
}
@@ -121,13 +121,13 @@ static const struct feature features[] = {
{0},
};
-static void list_features(int set, int msgl, bool invert)
+static void list_features(int set, struct mp_log *log, int msgl, bool invert)
{
for (const struct feature *f = &features[0]; f->id; f++) {
if (invert == !(f->id & set))
- mp_msg(MSGT_VO, msgl, " [%s]", f->name);
+ mp_msg_log(log, msgl, " [%s]", f->name);
}
- mp_msg(MSGT_VO, msgl, "\n");
+ mp_msg_log(log, msgl, "\n");
}
// This guesses if the current GL context is a suspected software renderer.
@@ -457,10 +457,11 @@ struct gl_functions gl_functions[] = {
// GL context. Called by the backend.
// getProcAddress: function to resolve function names, may be NULL
// ext2: an extra extension string
+// log: used to output messages
// Note: if you create a CONTEXT_FORWARD_COMPATIBLE_BIT_ARB with OpenGL 3.0,
// you must append "GL_ARB_compatibility" to ext2.
void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),
- const char *ext2)
+ const char *ext2, struct mp_log *log)
{
talloc_free_children(gl);
*gl = (GL) {
@@ -478,12 +479,12 @@ void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),
const char *version = gl->GetString(GL_VERSION);
sscanf(version, "%d.%d", &major, &minor);
gl->version = MPGL_VER(major, minor);
- mp_msg(MSGT_VO, MSGL_V, "[gl] Detected OpenGL %d.%d.\n", major, minor);
+ mp_msg_log(log, MSGL_V, "Detected OpenGL %d.%d.\n", major, minor);
- mp_msg(MSGT_VO, MSGL_V, "GL_VENDOR='%s'\n", gl->GetString(GL_VENDOR));
- mp_msg(MSGT_VO, MSGL_V, "GL_RENDERER='%s'\n", gl->GetString(GL_RENDERER));
- mp_msg(MSGT_VO, MSGL_V, "GL_VERSION='%s'\n", gl->GetString(GL_VERSION));
- mp_msg(MSGT_VO, MSGL_V, "GL_SHADING_LANGUAGE_VERSION='%s'\n",
+ mp_msg_log(log, MSGL_V, "GL_VENDOR='%s'\n", gl->GetString(GL_VENDOR));
+ mp_msg_log(log, MSGL_V, "GL_RENDERER='%s'\n", gl->GetString(GL_RENDERER));
+ mp_msg_log(log, MSGL_V, "GL_VERSION='%s'\n", gl->GetString(GL_VERSION));
+ mp_msg_log(log, MSGL_V, "GL_SHADING_LANGUAGE_VERSION='%s'\n",
gl->GetString(GL_SHADING_LANGUAGE_VERSION));
// Note: This code doesn't handle CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
@@ -520,9 +521,9 @@ void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),
}
if (has_legacy)
- mp_msg(MSGT_VO, MSGL_V, "[gl] OpenGL legacy compat. found.\n");
- mp_msg(MSGT_VO, MSGL_DBG2, "[gl] Combined OpenGL extensions string:\n%s\n",
- gl->extensions);
+ mp_msg_log(log, MSGL_V, "OpenGL legacy compat. found.\n");
+ mp_msg_log(log, MSGL_DBG2, "Combined OpenGL extensions string:\n%s\n",
+ gl->extensions);
for (int n = 0; n < sizeof(gl_functions) / sizeof(gl_functions[0]); n++) {
struct gl_functions *section = &gl_functions[n];
@@ -566,11 +567,11 @@ void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),
if (!ptr) {
all_loaded = false;
if (!section->partial_ok) {
- mp_msg(MSGT_VO, MSGL_V, "[gl] Required function '%s' not "
- "found for %s/%d.%d.\n", fn->funcnames[0],
- section->extension ? section->extension : "native",
- MPGL_VER_GET_MAJOR(section->ver_core),
- MPGL_VER_GET_MINOR(section->ver_core));
+ mp_msg_log(log, MSGL_V, "Required function '%s' not "
+ "found for %s/%d.%d.\n", fn->funcnames[0],
+ section->extension ? section->extension : "native",
+ MPGL_VER_GET_MAJOR(section->ver_core),
+ MPGL_VER_GET_MINOR(section->ver_core));
break;
}
}
@@ -604,8 +605,8 @@ void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),
if (!is_software_gl(gl))
gl->mpgl_caps |= MPGL_CAP_NO_SW;
- mp_msg(MSGT_VO, MSGL_V, "[gl] Detected OpenGL features:");
- list_features(gl->mpgl_caps, MSGL_V, false);
+ mp_msg_log(log, MSGL_V, "Detected OpenGL features:");
+ list_features(gl->mpgl_caps, log, MSGL_V, false);
}
/**
@@ -936,15 +937,13 @@ bool mpgl_config_window(struct MPGLContext *ctx, int gl_caps, uint32_t d_width,
if (!missing)
return true;
- mp_msg(MSGT_VO, MSGL_WARN, "[gl] Missing OpenGL features:");
- list_features(missing, MSGL_WARN, false);
- if (missing & MPGL_CAP_NO_SW) {
- mp_msg(MSGT_VO, MSGL_WARN, "[gl] Rejecting suspected software "
- "OpenGL renderer.\n");
- }
+ MP_WARN(ctx->vo, "Missing OpenGL features:");
+ list_features(missing, ctx->vo->log, MSGL_WARN, false);
+ if (missing & MPGL_CAP_NO_SW)
+ MP_WARN(ctx->vo, "Rejecting suspected software OpenGL renderer.\n");
}
- mp_msg(MSGT_VO, MSGL_ERR, "[gl] OpenGL context creation failed!\n");
+ MP_ERR(ctx->vo, "OpenGL context creation failed!\n");
return false;
}
diff --git a/video/out/gl_common.h b/video/out/gl_common.h
index 3e3bb8a8e8..beb18fb10d 100644
--- a/video/out/gl_common.h
+++ b/video/out/gl_common.h
@@ -64,7 +64,7 @@ void glClearTex(GL *gl, GLenum target, GLenum format, GLenum type,
int x, int y, int w, int h, uint8_t val, void **scratch);
void glDownloadTex(GL *gl, GLenum target, GLenum format, GLenum type,
void *dataptr, int stride);
-void glCheckError(GL *gl, const char *info);
+void glCheckError(GL *gl, struct mp_log *log, const char *info);
mp_image_t *glGetWindowScreenshot(GL *gl);
#define GL_3D_RED_CYAN 1
@@ -167,7 +167,7 @@ void mpgl_set_backend_wayland(MPGLContext *ctx);
void *mp_getdladdr(const char *s);
void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),
- const char *ext2);
+ const char *ext2, struct mp_log *log);
// print a multi line string with line numbers (e.g. for shader sources)
// log, lev: module and log level, as in mp_msg()
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 083c1f40e9..363c6a634e 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -343,7 +343,7 @@ static void default_tex_params(struct GL *gl, GLenum target, GLint filter)
static void debug_check_gl(struct gl_video *p, const char *msg)
{
if (p->gl_debug)
- glCheckError(p->gl, msg);
+ glCheckError(p->gl, p->log, msg);
}
void gl_video_set_debug(struct gl_video *p, bool enable)
@@ -1685,11 +1685,11 @@ static bool test_fbo(struct gl_video *p, GLenum format)
MP_VERBOSE(p, " %s: %a\n", val_names[i], val - pixel);
}
gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
- glCheckError(gl, "after FBO read");
+ glCheckError(gl, p->log, "after FBO read");
success = true;
}
fbotex_uninit(p, &fbo);
- glCheckError(gl, "FBO test");
+ glCheckError(gl, p->log, "FBO test");
gl->ClearColor(0.0f, 0.0f, 0.0f, 1.0f);
return success;
}
diff --git a/video/out/gl_w32.c b/video/out/gl_w32.c
index 8b21e25277..10e2ff9df8 100644
--- a/video/out/gl_w32.c
+++ b/video/out/gl_w32.c
@@ -67,7 +67,7 @@ static bool create_context_w32_old(struct MPGLContext *ctx)
*context = new_context;
- mpgl_load_functions(ctx->gl, w32gpa, NULL);
+ mpgl_load_functions(ctx->gl, w32gpa, NULL, ctx->vo->log);
res = true;
out:
@@ -149,7 +149,7 @@ static bool create_context_w32_gl3(struct MPGLContext *ctx)
}
/* update function pointers */
- mpgl_load_functions(ctx->gl, w32gpa, NULL);
+ mpgl_load_functions(ctx->gl, w32gpa, NULL, ctx->vo->log);
int pfmt = GetPixelFormat(windc);
PIXELFORMATDESCRIPTOR pfd;
diff --git a/video/out/gl_wayland.c b/video/out/gl_wayland.c
index c4bca1ce4c..c361861d78 100644
--- a/video/out/gl_wayland.c
+++ b/video/out/gl_wayland.c
@@ -139,9 +139,10 @@ static bool egl_create_context(struct vo_wayland_state *wl,
eglstr = eglQueryString(egl_ctx->egl.dpy, EGL_EXTENSIONS);
- mpgl_load_functions(gl, (void*(*)(const GLubyte*))eglGetProcAddress, eglstr);
+ mpgl_load_functions(gl, (void*(*)(const GLubyte*))eglGetProcAddress, eglstr,
+ wl->vo->log);
if (!gl->BindProgram)
- mpgl_load_functions(gl, NULL, eglstr);
+ mpgl_load_functions(gl, NULL, eglstr, wl->vo->log);
return true;
}
diff --git a/video/out/gl_x11.c b/video/out/gl_x11.c
index 8624746625..a3b3176987 100644
--- a/video/out/gl_x11.c
+++ b/video/out/gl_x11.c
@@ -68,13 +68,13 @@ static bool create_context_x11_old(struct MPGLContext *ctx)
if (glXExtStr)
glxstr = glXExtStr(display, ctx->vo->x11->screen);
- mpgl_load_functions(gl, getProcAddress, glxstr);
+ mpgl_load_functions(gl, getProcAddress, glxstr, vo->log);
if (!gl->GenPrograms && gl->GetString &&
gl->version < MPGL_VER(3, 0) &&
strstr(gl->GetString(GL_EXTENSIONS), "GL_ARB_vertex_program"))
{
MP_WARN(vo, "Broken glXGetProcAddress detected, trying workaround\n");
- mpgl_load_functions(gl, NULL, glxstr);
+ mpgl_load_functions(gl, NULL, glxstr, vo->log);
}
glx_ctx->context = new_context;
@@ -136,7 +136,7 @@ static bool create_context_x11_gl3(struct MPGLContext *ctx, bool debug)
glx_ctx->context = context;
- mpgl_load_functions(ctx->gl, (void *)glXGetProcAddress, glxstr);
+ mpgl_load_functions(ctx->gl, (void *)glXGetProcAddress, glxstr, vo->log);
if (!glXIsDirect(vo->x11->display, context))
ctx->gl->mpgl_caps &= ~MPGL_CAP_NO_SW;