From 7da43ff8b05aa5280e1b94190a8ce157a8131af4 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 10 Aug 2017 08:26:16 -0400 Subject: Implement wlr_surface_flush_damage --- render/gles2/texture.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'render/gles2') diff --git a/render/gles2/texture.c b/render/gles2/texture.c index f29f54a3..5126ec23 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -39,7 +39,9 @@ static bool gles2_texture_update_pixels(struct wlr_texture_state *texture, assert(texture && texture->wlr_texture->valid); // TODO: Test if the unpack subimage extension is supported and adjust the // upload strategy if not - if (texture->wlr_texture->format != format) { + if (!texture->wlr_texture->valid + || texture->wlr_texture->format != format + /* || unpack not supported */) { return gles2_texture_upload_pixels(texture, format, stride, width, height, pixels); } @@ -90,8 +92,10 @@ static bool gles2_texture_update_shm(struct wlr_texture_state *texture, struct wl_shm_buffer *buffer) { // TODO: Test if the unpack subimage extension is supported and adjust the // upload strategy if not - assert(texture && texture->wlr_texture->valid); - if (texture->wlr_texture->format != format) { + assert(texture); + if (!texture->wlr_texture->valid + || texture->wlr_texture->format != format + /* || unpack not supported */) { return gles2_texture_upload_shm(texture, format, buffer); } const struct pixel_format *fmt = texture->pixel_format; @@ -103,8 +107,9 @@ static bool gles2_texture_update_shm(struct wlr_texture_state *texture, GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, pitch)); GL_CALL(glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, x)); GL_CALL(glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, y)); - GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, fmt->gl_format, width, height, 0, - fmt->gl_format, fmt->gl_type, pixels)); + wlr_log(L_DEBUG, "%dx%d@%d,%d", width, height, x, y); + GL_CALL(glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, + fmt->gl_format, fmt->gl_type, pixels)); GL_CALL(glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0)); GL_CALL(glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0)); -- cgit v1.2.3