aboutsummaryrefslogtreecommitdiff
path: root/render/gles2/texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'render/gles2/texture.c')
-rw-r--r--render/gles2/texture.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 1e80a8d6..1f4ae22c 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -218,6 +218,18 @@ static void gles2_texture_get_matrix(struct wlr_texture *_texture,
wlr_matrix_mul(projection, matrix, matrix);
}
+static void gles2_texture_get_buffer_size(struct wlr_texture *texture, struct
+ wl_resource *resource, int *width, int *height) {
+ struct wl_shm_buffer *buffer = wl_shm_buffer_get(resource);
+ if (!buffer) {
+ wlr_log(L_ERROR, "getting buffer size is only implemented for shm buffers");
+ return;
+ }
+
+ *width = wl_shm_buffer_get_width(buffer);
+ *height = wl_shm_buffer_get_height(buffer);
+}
+
static void gles2_texture_bind(struct wlr_texture *_texture) {
struct wlr_gles2_texture *texture = (struct wlr_gles2_texture *)_texture;
GL_CALL(glBindTexture(GL_TEXTURE_2D, texture->tex_id));
@@ -247,6 +259,7 @@ static struct wlr_texture_impl wlr_texture_impl = {
.update_shm = gles2_texture_update_shm,
.upload_drm = gles2_texture_upload_drm,
.get_matrix = gles2_texture_get_matrix,
+ .get_buffer_size = gles2_texture_get_buffer_size,
.bind = gles2_texture_bind,
.destroy = gles2_texture_destroy,
};