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.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 6626d0af..b6b8ba57 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -234,81 +234,6 @@ static struct wlr_texture *gles2_texture_from_pixels(
return &texture->wlr_texture;
}
-struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer,
- struct wl_resource *resource) {
- struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
-
- if (!renderer->procs.glEGLImageTargetTexture2DOES) {
- return NULL;
- }
-
- struct wlr_egl_context prev_ctx;
- wlr_egl_save_context(&prev_ctx);
- wlr_egl_make_current(renderer->egl);
-
- EGLint fmt;
- int width, height;
- bool inverted_y;
- EGLImageKHR image = wlr_egl_create_image_from_wl_drm(renderer->egl, resource,
- &fmt, &width, &height, &inverted_y);
- if (image == EGL_NO_IMAGE_KHR) {
- wlr_log(WLR_ERROR, "Failed to create EGL image from wl_drm resource");
- goto error_ctx;
- }
-
- struct wlr_gles2_texture *texture =
- gles2_texture_create(renderer, width, height);
- if (texture == NULL) {
- goto error_image;
- }
- wlr_texture_init(&texture->wlr_texture, &texture_impl, width, height);
- texture->renderer = renderer;
-
- texture->drm_format = DRM_FORMAT_INVALID; // texture can't be written anyways
- texture->image = image;
- texture->inverted_y = inverted_y;
-
- switch (fmt) {
- case EGL_TEXTURE_RGB:
- texture->has_alpha = false;
- break;
- case EGL_TEXTURE_RGBA:
- case EGL_TEXTURE_EXTERNAL_WL:
- texture->has_alpha = true;
- break;
- default:
- wlr_log(WLR_ERROR, "Invalid or unsupported EGL buffer format");
- goto error_texture;
- }
-
- texture->target = GL_TEXTURE_EXTERNAL_OES;
-
- push_gles2_debug(renderer);
-
- glGenTextures(1, &texture->tex);
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->tex);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- renderer->procs.glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES,
- texture->image);
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
-
- pop_gles2_debug(renderer);
-
- wlr_egl_restore_context(&prev_ctx);
-
- return &texture->wlr_texture;
-
-error_texture:
- wl_list_remove(&texture->link);
- free(texture);
-error_image:
- wlr_egl_destroy_image(renderer->egl, image);
-error_ctx:
- wlr_egl_restore_context(&prev_ctx);
- return NULL;
-}
-
static struct wlr_texture *gles2_texture_from_dmabuf(
struct wlr_renderer *wlr_renderer,
struct wlr_dmabuf_attributes *attribs) {