2012-01-26 10:21:54 -08:00
|
|
|
#include "e.h"
|
2013-01-09 03:34:07 -08:00
|
|
|
#include "e_comp.h"
|
2012-01-31 08:36:07 -08:00
|
|
|
#ifdef HAVE_WAYLAND_CLIENTS
|
2013-01-09 03:34:07 -08:00
|
|
|
# include "e_comp_wl.h"
|
|
|
|
# include "e_comp_wl_buffer.h"
|
|
|
|
# include "e_comp_wl_comp.h"
|
2012-01-26 10:21:54 -08:00
|
|
|
#endif
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
void
|
2013-01-09 03:34:07 -08:00
|
|
|
e_comp_wl_buffer_post_release(struct wl_buffer *buffer)
|
2012-01-26 10:21:54 -08:00
|
|
|
{
|
|
|
|
if (--buffer->busy_count > 0) return;
|
|
|
|
if (buffer->resource.client)
|
|
|
|
wl_resource_queue_event(&buffer->resource, WL_BUFFER_RELEASE);
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
void
|
2013-01-09 03:34:07 -08:00
|
|
|
e_comp_wl_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
|
2012-01-26 10:21:54 -08:00
|
|
|
{
|
|
|
|
Wayland_Surface *ws;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ws = (Wayland_Surface *)surface;
|
|
|
|
|
2012-01-31 06:16:48 -08:00
|
|
|
if (!ws->texture)
|
|
|
|
{
|
|
|
|
glGenTextures(1, &ws->texture);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, ws->texture);
|
2012-06-28 00:03:44 -07:00
|
|
|
glTexParameteri(GL_TEXTURE_2D,
|
2012-01-31 06:16:48 -08:00
|
|
|
GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
2012-06-28 00:03:44 -07:00
|
|
|
glTexParameteri(GL_TEXTURE_2D,
|
2012-01-31 06:16:48 -08:00
|
|
|
GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
// ws->shader = &ws->texture_shader;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
glBindTexture(GL_TEXTURE_2D, ws->texture);
|
|
|
|
|
|
|
|
/* if (ws->saved_texture != 0) */
|
|
|
|
/* ws->texture = ws->saved_texture; */
|
|
|
|
|
|
|
|
/* glBindTexture(GL_TEXTURE_2D, ws->texture); */
|
2012-01-26 10:21:54 -08:00
|
|
|
|
|
|
|
if (wl_buffer_is_shm(buffer))
|
2012-04-11 10:23:19 -07:00
|
|
|
ws->pitch = wl_shm_buffer_get_stride(buffer) / 4;
|
2012-06-28 00:03:44 -07:00
|
|
|
else
|
2012-01-26 10:21:54 -08:00
|
|
|
{
|
|
|
|
Wayland_Compositor *comp;
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
comp = e_comp_wl_comp_get();
|
2012-01-26 10:21:54 -08:00
|
|
|
if (ws->image != EGL_NO_IMAGE_KHR)
|
|
|
|
comp->destroy_image(comp->egl.display, ws->image);
|
2012-06-28 00:03:44 -07:00
|
|
|
ws->image = comp->create_image(comp->egl.display, NULL,
|
2012-01-26 10:21:54 -08:00
|
|
|
EGL_WAYLAND_BUFFER_WL, buffer, NULL);
|
|
|
|
comp->image_target_texture_2d(GL_TEXTURE_2D, ws->image);
|
|
|
|
ws->visual = WAYLAND_ARGB_VISUAL;
|
|
|
|
ws->pitch = ws->w;
|
|
|
|
}
|
|
|
|
}
|
2012-06-28 00:03:44 -07:00
|
|
|
|