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') 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 From 888986b03858a28eace4ded39034eaa001321976 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 10 Aug 2017 08:36:45 -0400 Subject: Remove excess logging --- render/gles2/texture.c | 1 - types/wlr_surface.c | 1 - 2 files changed, 2 deletions(-) (limited to 'render') diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 5126ec23..7a030f25 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -107,7 +107,6 @@ 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)); - 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)); diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 06495703..7891a55c 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -135,7 +135,6 @@ void wlr_surface_flush_damage(struct wlr_surface *surface) { uint32_t format = wl_shm_buffer_get_format(buffer); for (int i = 0; i < n; ++i) { pixman_box32_t rect = rects[i]; - wlr_log(L_DEBUG, "%d,%d:%d,%d", rect.x1, rect.y1, rect.x2, rect.y2); if (!wlr_texture_update_shm(surface->texture, format, rect.x1, rect.y1, rect.x2 - rect.x1, -- cgit v1.2.3 From 49e97857c7f3bc4b8563ce5118a9384024f0fc56 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Thu, 10 Aug 2017 08:36:33 -0400 Subject: enable gl blending This makes transparency work correctly. fixes #56 --- render/gles2/renderer.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'render') diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 7d0db8b3..703edd46 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -83,6 +83,11 @@ static void wlr_gles2_begin(struct wlr_renderer_state *state, int32_t width = output->width; int32_t height = output->height; GL_CALL(glViewport(0, 0, width, height)); + + // enable transparency + GL_CALL(glEnable(GL_BLEND)); + GL_CALL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + // Note: maybe we should save output projection and remove some of the need // for users to sling matricies themselves } -- cgit v1.2.3