changeset 36128:e51b909bdd8e

Add hack to support strides with GLES. Reuse existing feature to upload texture line by line.
author reimar
date Sat, 04 May 2013 15:20:43 +0000
parents 18c289284727
children 4129ba181ad7
files libvo/gl_common.c libvo/vo_gl.c
diffstat 2 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Sat May 04 15:20:42 2013 +0000
+++ b/libvo/gl_common.c	Sat May 04 15:20:43 2013 +0000
@@ -769,6 +769,7 @@
 void glUploadTex(GLenum target, GLenum format, GLenum type,
                  const void *dataptr, int stride,
                  int x, int y, int w, int h, int slice) {
+  int bpp;
   const uint8_t *data = dataptr;
   int y_max = y + h;
   if (w <= 0 || h <= 0) return;
@@ -782,9 +783,15 @@
     format = l16_format;
     if (l16_format == GL_LUMINANCE_ALPHA) type = GL_UNSIGNED_BYTE;
   }
-  // this is not always correct, but should work for MPlayer
-  glAdjustAlignment(stride);
-  mpglPixelStorei(GL_UNPACK_ROW_LENGTH, stride / glFmt2bpp(format, type));
+  bpp = glFmt2bpp(format, type);
+  if (!mpglBegin) {
+    // we have to copy line-by-line for GLES
+    if (stride != w*bpp) slice = 1;
+  } else {
+    // this is not always correct, but should work for MPlayer
+    glAdjustAlignment(stride);
+    mpglPixelStorei(GL_UNPACK_ROW_LENGTH, stride / bpp);
+  }
   if (slice < 0) {
     mpglPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
     mpglTexImage2D(target, 0, GL_RGB, w, h, 0, format, type, data);
--- a/libvo/vo_gl.c	Sat May 04 15:20:42 2013 +0000
+++ b/libvo/vo_gl.c	Sat May 04 15:20:43 2013 +0000
@@ -1185,13 +1185,8 @@
 {
     int depth;
     int caps = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
-               VFCAP_FLIP |
+               VFCAP_FLIP | VFCAP_ACCEPT_STRIDE |
                VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
-    // TODO: This assumes backend auto-detection was run
-    // before this code.
-    // In addition strides might not work with X11 GLES either.
-    if (glctx.type != GLTYPE_EGL_ANDROID)
-      caps |= VFCAP_ACCEPT_STRIDE;
     if (use_osd)
       caps |= VFCAP_OSD | VFCAP_EOSD | (scaled_osd ? 0 : VFCAP_EOSD_UNSCALED);
     if (format == IMGFMT_RGB24 || format == IMGFMT_RGBA)