1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-28 19:30:44 +00:00

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
This commit is contained in:
reimar 2007-08-03 18:29:54 +00:00
parent b95caec861
commit e58803edde

View File

@ -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],