aboutsummaryrefslogtreecommitdiff
path: root/render/gles2/texture.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-10 13:19:39 -0400
committerDrew DeVault <sir@cmpwn.com>2017-08-10 13:19:39 -0400
commit7095274a9ed02d60aebc8fdd7cdf9fc0754330d3 (patch)
tree757053a0bc8e50e6a16f952192f0e7ef17923bc6 /render/gles2/texture.c
parent31d78ff497865f5b0442f14adeac8987e1b7273d (diff)
parentea63f9e53f9672e72d73856de26d7354ab93bb45 (diff)
Merge branch 'master' into drm_buffer
Diffstat (limited to 'render/gles2/texture.c')
-rw-r--r--render/gles2/texture.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index b7de65be..2a2073c6 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -61,7 +61,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);
}
@@ -112,8 +114,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;
@@ -125,8 +129,8 @@ 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));
+ 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));