changeset 28070:9c1fdc6420be

100l, forgot setting GL_UNPACK_CLIENT_STORAGE_APPLE for mesa-buffer mode.
author reimar
date Sat, 06 Dec 2008 06:18:57 +0000
parents 74b62cf052af
children c7b912b0cbc2
files libvo/gl_common.h libvo/vo_gl.c
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.h	Fri Dec 05 23:35:32 2008 +0000
+++ b/libvo/gl_common.h	Sat Dec 06 06:18:57 2008 +0000
@@ -225,6 +225,9 @@
 #ifndef GL_FLOAT_RGB32_NV
 #define GL_FLOAT_RGB32_NV 0x8889
 #endif
+#ifndef GL_UNPACK_CLIENT_STORAGE_APPLE
+#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
+#endif
 #ifndef GL_FRAGMENT_PROGRAM
 #define GL_FRAGMENT_PROGRAM 0x8804
 #endif
--- a/libvo/vo_gl.c	Fri Dec 05 23:35:32 2008 +0000
+++ b/libvo/vo_gl.c	Sat Dec 06 06:18:57 2008 +0000
@@ -702,6 +702,7 @@
     mpi->width = texture_width;
     mpi->height = texture_height;
   }
+  if (mesa_buffer) mpi->width = (mpi->width + 63) & ~63;
   mpi->stride[0] = mpi->width * mpi->bpp / 8;
   needed_size = mpi->stride[0] * mpi->height;
   if (mesa_buffer) {
@@ -793,7 +794,9 @@
   stride[0] = mpi->stride[0]; stride[1] = mpi->stride[1]; stride[2] = mpi->stride[2];
   planes[0] = mpi->planes[0]; planes[1] = mpi->planes[1]; planes[2] = mpi->planes[2];
   mpi_flipped = stride[0] < 0;
-  if (!mesa_buffer && mpi->flags & MP_IMGFLAG_DIRECT) {
+  if (mpi->flags & MP_IMGFLAG_DIRECT) {
+    if (mesa_buffer) glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 1);
+    else {
     intptr_t base = (intptr_t)planes[0];
     if (mpi_flipped)
       base += (mpi->h - 1) * stride[0];
@@ -805,9 +808,9 @@
     gl_bufferptr = NULL;
     if (!(mpi->flags & MP_IMGFLAG_COMMON_PLANE))
       planes[0] = planes[1] = planes[2] = NULL;
+    }
+    slice = 0; // always "upload" full texture
   }
-  if (mpi->flags & MP_IMGFLAG_DIRECT)
-    slice = 0; // always "upload" full texture
   glUploadTex(gl_target, gl_format, gl_type, planes[0], stride[0],
               mpi->x, mpi->y, w, h, slice);
   if (mpi->imgfmt == IMGFMT_YV12) {
@@ -829,8 +832,10 @@
                 mpi->x / 2, mpi->y / 2, w / 2, h / 2, slice);
     ActiveTexture(GL_TEXTURE0);
   }
-  if (!mesa_buffer && mpi->flags & MP_IMGFLAG_DIRECT)
-    BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+  if (mpi->flags & MP_IMGFLAG_DIRECT) {
+    if (mesa_buffer) glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 0);
+    else BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+  }
 skip_upload:
   if (vo_doublebuffering) do_render();
   return VO_TRUE;