diff options
author | wm4 <wm4@nowhere> | 2016-05-23 19:57:29 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-05-23 21:27:18 +0200 |
commit | 66079048eaebdb03caea81d610fd1457ceaaa507 (patch) | |
tree | df657c0c3446df45040ba276d68b47674834dad6 /video/out/opengl/utils.c | |
parent | 049e3ccb6551ad37beb091c72a9ef70920cdea80 (diff) | |
download | mpv-66079048eaebdb03caea81d610fd1457ceaaa507.tar.bz2 mpv-66079048eaebdb03caea81d610fd1457ceaaa507.tar.xz |
vo_opengl: unify PBO and normal OSD texture upload path
The main change is actually that e first copy to a "staging" memory
frame, and then upload this at once. The old non-PBO code called
glTexsubImage2D for each OSD sub-bitmap.
The new non-PBO code path is a bit faster now if there are many small
sub-bitmaps (on Linux/nVidia). It's also a bit simpler, so this is a
win.
(Although I don't particularly appreciate the mixed normal/PBO texture
code.)
Diffstat (limited to 'video/out/opengl/utils.c')
-rw-r--r-- | video/out/opengl/utils.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c index f8ed6eebaf..76e119b8f7 100644 --- a/video/out/opengl/utils.c +++ b/video/out/opengl/utils.c @@ -103,31 +103,6 @@ void glUploadTex(GL *gl, GLenum target, GLenum format, GLenum type, gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4); } -// Like glUploadTex, but upload a byte array with all elements set to val. -// If scratch is not NULL, points to a resizeable talloc memory block than can -// be freely used by the function (for avoiding temporary memory allocations). -void glClearTex(GL *gl, GLenum target, GLenum format, GLenum type, - int x, int y, int w, int h, uint8_t val, void **scratch) -{ - int bpp = gl_bytes_per_pixel(format, type); - int stride = w * bpp; - int size = h * stride; - if (size < 1 || !bpp) - return; - void *data = scratch ? *scratch : NULL; - if (talloc_get_size(data) < size) - data = talloc_realloc(NULL, data, char *, size); - memset(data, val, size); - gl->PixelStorei(GL_UNPACK_ALIGNMENT, get_alignment(stride)); - gl->TexSubImage2D(target, 0, x, y, w, h, format, type, data); - gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4); - if (scratch) { - *scratch = data; - } else { - talloc_free(data); - } -} - mp_image_t *glGetWindowScreenshot(GL *gl) { if (gl->es) |