weston-egl-ext.h: add GL_EXT_unpack_subimage definitions

... and use it in gl-renderer.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Emil Velikov 2016-07-04 15:27:17 +01:00 committed by Daniel Stone
parent af5bd5da63
commit b56c5b48ce
2 changed files with 7 additions and 9 deletions

View File

@ -869,11 +869,9 @@ draw_output_border_texture(struct gl_output_state *go,
}
if (go->border_status & (1 << side)) {
#ifdef GL_EXT_unpack_subimage
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
#endif
glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
img->tex_width, img->height, 0,
GL_BGRA_EXT, GL_UNSIGNED_BYTE, img->data);
@ -1226,12 +1224,9 @@ gl_renderer_flush_damage(struct weston_surface *surface)
struct weston_buffer *buffer = gs->buffer_ref.buffer;
struct weston_view *view;
bool texture_used;
#ifdef GL_EXT_unpack_subimage
pixman_box32_t *rectangles;
void *data;
int i, n;
#endif
pixman_region32_union(&gs->texture_damage,
&gs->texture_damage, &surface->damage);
@ -1271,7 +1266,6 @@ gl_renderer_flush_damage(struct weston_surface *surface)
goto done;
}
#ifdef GL_EXT_unpack_subimage
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, gs->pitch);
data = wl_shm_buffer_get_data(buffer->shm_buffer);
@ -1300,7 +1294,6 @@ gl_renderer_flush_damage(struct weston_surface *surface)
gs->gl_format, gs->gl_pixel_type, data);
}
wl_shm_buffer_end_access(buffer->shm_buffer);
#endif
done:
pixman_region32_fini(&gs->texture_damage);
@ -3152,10 +3145,8 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
else
ec->read_format = PIXMAN_a8b8g8r8;
#ifdef GL_EXT_unpack_subimage
if (check_extension(extensions, "GL_EXT_unpack_subimage"))
gr->has_unpack_subimage = 1;
#endif
if (check_extension(extensions, "GL_OES_EGL_image_external"))
gr->has_egl_image_external = 1;

View File

@ -90,6 +90,13 @@ typedef struct wl_buffer * (EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (
#define EGL_WAYLAND_Y_INVERTED_WL 0x31DB /* eglQueryWaylandBufferWL attribute */
#endif
#ifndef GL_EXT_unpack_subimage
#define GL_EXT_unpack_subimage 1
#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
#endif /* GL_EXT_unpack_subimage */
/* Mesas gl2ext.h and probably Khronos upstream defined
* GL_EXT_unpack_subimage with non _EXT suffixed GL_UNPACK_* tokens.
* In case we're using that mess, manually define the _EXT versions