diff options
Diffstat (limited to 'video/out/gl_common.c')
-rw-r--r-- | video/out/gl_common.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/video/out/gl_common.c b/video/out/gl_common.c index 685258406a..67b373d9c3 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -259,6 +259,7 @@ struct gl_functions gl_functions[] = { DEF_FN(Uniform2f), DEF_FN(Uniform3f), DEF_FN(Uniform1i), + DEF_FN(UniformMatrix2fv), DEF_FN(UniformMatrix3fv), DEF_FN(TexImage3D), {0}, @@ -829,10 +830,10 @@ mp_image_t *glGetWindowScreenshot(GL *gl) gl->GetIntegerv(GL_VIEWPORT, vp); mp_image_t *image = mp_image_alloc(IMGFMT_RGB24, vp[2], vp[3]); gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - gl->PixelStorei(GL_PACK_ALIGNMENT, 0); + gl->PixelStorei(GL_PACK_ALIGNMENT, 1); gl->PixelStorei(GL_PACK_ROW_LENGTH, 0); gl->ReadBuffer(GL_FRONT); - //flip image while reading + //flip image while reading (and also avoid stride-related trouble) for (int y = 0; y < vp[3]; y++) { gl->ReadPixels(vp[0], vp[1] + vp[3] - y - 1, vp[2], 1, GL_RGB, GL_UNSIGNED_BYTE, @@ -940,6 +941,33 @@ void mpgl_uninit(MPGLContext *ctx) talloc_free(ctx); } +void mpgl_set_context(MPGLContext *ctx) +{ + if (ctx->set_current) + ctx->set_current(ctx, true); +} + +void mpgl_unset_context(MPGLContext *ctx) +{ + if (ctx->set_current) + ctx->set_current(ctx, false); +} + +void mpgl_lock(MPGLContext *ctx) +{ + mpgl_set_context(ctx); +} + +void mpgl_unlock(MPGLContext *ctx) +{ + mpgl_unset_context(ctx); +} + +bool mpgl_is_thread_safe(MPGLContext *ctx) +{ + return !!ctx->set_current; +} + void mp_log_source(int mod, int lev, const char *src) { int line = 1; |