mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 16:40:41 -05:00
wayland/egl-stream: Cache texture snippet
While it's not very relevant now, as we would rarely create it anyway
since the buffer nor texture never changes for a surface, it will be in
the future, as the actor state (including its content,
MetaShapedTexture) will be synchronized by the MetaWaylandActorSurface
at a later point in time, and not by MetaWaylandSurface, at state
application time.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
(cherry picked from commit 76ee026caa
)
This commit is contained in:
parent
78a45e1813
commit
f52c0a3bf7
@ -456,7 +456,7 @@ meta_wayland_buffer_create_snippet (MetaWaylandBuffer *buffer)
|
|||||||
if (!buffer->egl_stream.stream)
|
if (!buffer->egl_stream.stream)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return meta_wayland_egl_stream_create_snippet ();
|
return meta_wayland_egl_stream_create_snippet (buffer->egl_stream.stream);
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif /* HAVE_WAYLAND_EGLSTREAM */
|
#endif /* HAVE_WAYLAND_EGLSTREAM */
|
||||||
|
@ -134,6 +134,7 @@ struct _MetaWaylandEglStream
|
|||||||
MetaWaylandBuffer *buffer;
|
MetaWaylandBuffer *buffer;
|
||||||
CoglTexture2D *texture;
|
CoglTexture2D *texture;
|
||||||
gboolean is_y_inverted;
|
gboolean is_y_inverted;
|
||||||
|
CoglSnippet *snippet;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaWaylandEglStream, meta_wayland_egl_stream,
|
G_DEFINE_TYPE (MetaWaylandEglStream, meta_wayland_egl_stream,
|
||||||
@ -289,7 +290,9 @@ meta_wayland_egl_stream_is_y_inverted (MetaWaylandEglStream *stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglSnippet *
|
CoglSnippet *
|
||||||
meta_wayland_egl_stream_create_snippet (void)
|
meta_wayland_egl_stream_create_snippet (MetaWaylandEglStream *stream)
|
||||||
|
{
|
||||||
|
if (!stream->snippet)
|
||||||
{
|
{
|
||||||
CoglSnippet *snippet;
|
CoglSnippet *snippet;
|
||||||
|
|
||||||
@ -299,8 +302,10 @@ meta_wayland_egl_stream_create_snippet (void)
|
|||||||
cogl_snippet_set_replace (snippet,
|
cogl_snippet_set_replace (snippet,
|
||||||
"cogl_texel = texture2D (tex_external,\n"
|
"cogl_texel = texture2D (tex_external,\n"
|
||||||
" cogl_tex_coord.xy);");
|
" cogl_tex_coord.xy);");
|
||||||
|
stream->snippet = snippet;
|
||||||
|
}
|
||||||
|
|
||||||
return snippet;
|
return cogl_object_ref (stream->snippet);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -341,6 +346,8 @@ meta_wayland_egl_stream_finalize (GObject *object)
|
|||||||
|
|
||||||
meta_egl_destroy_stream (egl, egl_display, stream->egl_stream, NULL);
|
meta_egl_destroy_stream (egl, egl_display, stream->egl_stream, NULL);
|
||||||
|
|
||||||
|
cogl_clear_object (&stream->snippet);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_wayland_egl_stream_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_wayland_egl_stream_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ gboolean meta_wayland_egl_stream_attach (MetaWaylandEglStream *stream,
|
|||||||
|
|
||||||
CoglTexture2D * meta_wayland_egl_stream_create_texture (MetaWaylandEglStream *stream,
|
CoglTexture2D * meta_wayland_egl_stream_create_texture (MetaWaylandEglStream *stream,
|
||||||
GError **error);
|
GError **error);
|
||||||
CoglSnippet * meta_wayland_egl_stream_create_snippet (void);
|
CoglSnippet * meta_wayland_egl_stream_create_snippet (MetaWaylandEglStream *stream);
|
||||||
|
|
||||||
gboolean meta_wayland_egl_stream_is_y_inverted (MetaWaylandEglStream *stream);
|
gboolean meta_wayland_egl_stream_is_y_inverted (MetaWaylandEglStream *stream);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user