gl-renderer: Test for GL_EXT_unpack_subimage not GL_UNPACK_ROW_LENGTH
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 7 Aug 2013 16:55:07 +0000 (09:55 -0700)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 7 Aug 2013 16:55:07 +0000 (09:55 -0700)
It is defined by the mesa #include, which is just a copy of the official
Khronos header.  It's just defined in a different section than the
extension tokens.  In the mean time, the extension tokens were renamed
to add a _EXT suffix (eg GL_UNPACK_ROW_LENGTH -> GL_UNPACK_ROW_LENGTH_EXT)
and we silently failed to used the subimage extension.

src/gl-renderer.c

index 0d31cb7..6653324 100644 (file)
@@ -1112,7 +1112,7 @@ gl_renderer_flush_damage(struct weston_surface *surface)
        GLenum format;
        int pixel_type;
 
-#ifdef GL_UNPACK_ROW_LENGTH
+#ifdef GL_EXT_unpack_subimage
        pixman_box32_t *rectangles;
        void *data;
        int i, n;
@@ -1162,14 +1162,13 @@ gl_renderer_flush_damage(struct weston_surface *surface)
                goto done;
        }
 
-#ifdef GL_UNPACK_ROW_LENGTH
-       /* Mesa does not define GL_EXT_unpack_subimage */
-       glPixelStorei(GL_UNPACK_ROW_LENGTH, gs->pitch);
+#ifdef GL_EXT_unpack_subimage
+       glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, gs->pitch);
        data = wl_shm_buffer_get_data(buffer->shm_buffer);
 
        if (gs->needs_full_upload) {
-               glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
-               glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+               glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
+               glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
                glTexSubImage2D(GL_TEXTURE_2D, 0,
                                0, 0, gs->pitch, buffer->height,
                                format, pixel_type, data);
@@ -1182,8 +1181,8 @@ gl_renderer_flush_damage(struct weston_surface *surface)
 
                r = weston_surface_to_buffer_rect(surface, rectangles[i]);
 
-               glPixelStorei(GL_UNPACK_SKIP_PIXELS, r.x1);
-               glPixelStorei(GL_UNPACK_SKIP_ROWS, r.y1);
+               glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, r.x1);
+               glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, r.y1);
                glTexSubImage2D(GL_TEXTURE_2D, 0, r.x1, r.y1,
                                r.x2 - r.x1, r.y2 - r.y1,
                                format, pixel_type, data);