diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-08-03 18:29:54 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-08-03 18:29:54 +0000 |
commit | e58803eddec72c32b354670d3f1a68e9756bfb4a (patch) | |
tree | 685d4f54eff0325445ee0c38fa8f110015d4382e /libvo | |
parent | b95caec861f58076853075d223e41f5f8be7a132 (diff) |
Handle case where get_image is called twice without a draw_image in-between
(-vc ffmpeg12 seems to do this sometimes).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24007 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_gl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 3007b93021..a81c783365 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -88,6 +88,7 @@ static GLenum gl_format; static GLenum gl_type; static GLuint gl_buffer; static int gl_buffersize; +static void *gl_bufferptr; static GLuint fragprog; static GLuint default_texs[22]; static char *custom_prog; @@ -371,6 +372,7 @@ static void uninitGl(void) { if (DeleteBuffers && gl_buffer) DeleteBuffers(1, &gl_buffer); gl_buffer = 0; gl_buffersize = 0; + gl_bufferptr = NULL; err_shown = 0; } @@ -677,7 +679,9 @@ static uint32_t get_image(mp_image_t *mpi) { NULL, GL_DYNAMIC_DRAW); gl_buffersize = mpi->stride[0] * mpi->h; } - mpi->planes[0] = MapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); + if (!gl_bufferptr) + gl_bufferptr = MapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); + mpi->planes[0] = gl_bufferptr; BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); if (mpi->planes[0] == NULL) { if (!err_shown) @@ -715,6 +719,7 @@ static uint32_t draw_image(mp_image_t *mpi) { planes[2] -= base; BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer); UnmapBuffer(GL_PIXEL_UNPACK_BUFFER); + gl_bufferptr = NULL; slice = 0; // always "upload" full texture } glUploadTex(gl_target, gl_format, gl_type, planes[0], stride[0], |