# HG changeset patch # User reimar # Date 1368734252 0 # Node ID 512629a9aa21cefbc4c0b1dc332378c2c768ec61 # Parent 927dedf22ddef85319b8c3554cf2d236c7015d8d vo_gl: Extract some code into separate function. This should make it less messy to support other ways to do direct rendering. diff -r 927dedf22dde -r 512629a9aa21 libvo/vo_gl.c --- a/libvo/vo_gl.c Thu May 16 19:20:31 2013 +0000 +++ b/libvo/vo_gl.c Thu May 16 19:57:32 2013 +0000 @@ -986,26 +986,14 @@ return 0; } -static uint32_t get_image(mp_image_t *mpi) { +static int get_pbo_image(mp_image_t *mpi) { int needed_size; - dr_rejectcnt++; if (!mpglGenBuffers || !mpglBindBuffer || !mpglBufferData || !mpglMapBuffer) { if (!err_shown) mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n" "Expect a _major_ speed penalty\n"); err_shown = 1; - return VO_FALSE; - } - if (gl_bufferptr) return VO_FALSE; - if (mpi->flags & MP_IMGFLAG_READABLE) return VO_FALSE; - if (mpi->type != MP_IMGTYPE_STATIC && mpi->type != MP_IMGTYPE_TEMP && - mpi->type != MP_IMGTYPE_IPB && - mpi->type != MP_IMGTYPE_NUMBERED) - return VO_FALSE; - if (mesa_buffer) mpi->width = texture_width; - else if (ati_hack) { - mpi->width = texture_width; - mpi->height = texture_height; + return 0; } mpi->stride[0] = mpi->width * mpi->bpp / 8; needed_size = mpi->stride[0] * mpi->height + 31; @@ -1040,7 +1028,7 @@ mp_msg(MSGT_VO, MSGL_ERR, "[gl] could not acquire buffer for dr\n" "Expect a _major_ speed penalty\n"); err_shown = 1; - return VO_FALSE; + return 0; } if (is_yuv) { // planar YUV @@ -1076,6 +1064,24 @@ mpi->planes[2] = gl_bufferptr_uv[1]; } } + return 1; +} + +static uint32_t get_image(mp_image_t *mpi) { + dr_rejectcnt++; + if (gl_bufferptr) return VO_FALSE; + if (mpi->flags & MP_IMGFLAG_READABLE) return VO_FALSE; + if (mpi->type != MP_IMGTYPE_STATIC && mpi->type != MP_IMGTYPE_TEMP && + mpi->type != MP_IMGTYPE_IPB && + mpi->type != MP_IMGTYPE_NUMBERED) + return VO_FALSE; + if (mesa_buffer) mpi->width = texture_width; + else if (ati_hack) { + mpi->width = texture_width; + mpi->height = texture_height; + } + if (!get_pbo_image(mpi)) + return VO_FALSE; mpi->flags |= MP_IMGFLAG_DIRECT; dr_rejectcnt--; return VO_TRUE;