aboutsummaryrefslogtreecommitdiff
path: root/render/gles2
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-09 22:56:57 -0400
committerDrew DeVault <sir@cmpwn.com>2017-08-09 22:56:57 -0400
commite2b7712302f332de73e2527c7f58f11c72251346 (patch)
tree5b26726bcfb38c1474698f5c82bb83de29267dca /render/gles2
parent4de930542f1a3d7322e7a7c1d2dc43dc9b4a4129 (diff)
Use texture->pixel_format instead of re-scanning
Diffstat (limited to 'render/gles2')
-rw-r--r--render/gles2/texture.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index ff823fc1..f29f54a3 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -43,11 +43,7 @@ static bool gles2_texture_update_pixels(struct wlr_texture_state *texture,
return gles2_texture_upload_pixels(texture, format, stride,
width, height, pixels);
}
- const struct pixel_format *fmt = gl_format_for_wl_format(format);
- if (!fmt || !fmt->gl_format) {
- wlr_log(L_ERROR, "No supported pixel format for this texture");
- return false;
- }
+ const struct pixel_format *fmt = texture->pixel_format;
GL_CALL(glBindTexture(GL_TEXTURE_2D, texture->tex_id));
GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, stride));
GL_CALL(glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, x));
@@ -98,11 +94,7 @@ static bool gles2_texture_update_shm(struct wlr_texture_state *texture,
if (texture->wlr_texture->format != format) {
return gles2_texture_upload_shm(texture, format, buffer);
}
- const struct pixel_format *fmt = gl_format_for_wl_format(format);
- if (!fmt || !fmt->gl_format) {
- wlr_log(L_ERROR, "No supported pixel format for this texture");
- return false;
- }
+ const struct pixel_format *fmt = texture->pixel_format;
wl_shm_buffer_begin_access(buffer);
uint8_t *pixels = wl_shm_buffer_get_data(buffer);
int pitch = wl_shm_buffer_get_stride(buffer) / (fmt->bpp / 8);