aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-08-15 07:58:07 -0400
committerTony Crisci <tony@dubstepdish.com>2017-08-15 07:58:07 -0400
commit4f2b1cc930b3f805358571e809ccba4bf6d6272c (patch)
treec794708b41dbb7b70bbf6c16917c880ea779adc5
parent2bf2dbb2bd85d9cd471d784c25ad6a21d1c7a6a5 (diff)
implement get_buffer_size for egl buffers
-rw-r--r--render/gles2/texture.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 1f4ae22c..4eb79374 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -222,7 +222,19 @@ 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");
+ struct wlr_gles2_texture *tex = (struct wlr_gles2_texture *)texture;
+ if (!glEGLImageTargetTexture2DOES) {
+ return;
+ }
+ if (!wlr_egl_query_buffer(tex->egl, resource, EGL_WIDTH,
+ (EGLint*)&width)) {
+ wlr_log(L_ERROR, "could not get size of the buffer "
+ "(no buffer found)");
+ return;
+ };
+ wlr_egl_query_buffer(tex->egl, resource, EGL_HEIGHT,
+ (EGLint*)&height);
+
return;
}