aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-12 18:38:13 +0200
committerSimon Ser <contact@emersion.fr>2021-05-17 16:22:43 +0200
commit9d55f712e3880927bcbc39bf4da7f4166ea94a91 (patch)
tree5dcb3732a89e191416176cd0c0eed5d5d3fe4365 /include
parent9221ed7b4cf49fa2250977bede2827f323543aa2 (diff)
render: introduce wlr_texture_from_buffer
This adds a a function to create a wlr_texture from a wlr_buffer. The main motivation for this is to allow the renderer to create a single wlr_texture per wlr_buffer. This can avoid needless imports by re-using existing textures.
Diffstat (limited to 'include')
-rw-r--r--include/render/wlr_texture.h15
-rw-r--r--include/wlr/render/interface.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/include/render/wlr_texture.h b/include/render/wlr_texture.h
new file mode 100644
index 00000000..eb94824f
--- /dev/null
+++ b/include/render/wlr_texture.h
@@ -0,0 +1,15 @@
+#ifndef RENDER_WLR_TEXTURE_H
+#define RENDER_WLR_TEXTURE_H
+
+#include <wlr/render/wlr_texture.h>
+
+/**
+ * Create a new texture from a buffer.
+ *
+ * Should not be called in a rendering block like renderer_begin()/end() or
+ * between attaching a renderer to an output and committing it.
+ */
+struct wlr_texture *wlr_texture_from_buffer(struct wlr_renderer *renderer,
+ struct wlr_buffer *buffer);
+
+#endif
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index f280852c..251154d8 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -57,6 +57,8 @@ struct wlr_renderer_impl {
struct wl_display *wl_display);
int (*get_drm_fd)(struct wlr_renderer *renderer);
uint32_t (*get_render_buffer_caps)(void);
+ struct wlr_texture *(*texture_from_buffer)(struct wlr_renderer *renderer,
+ struct wlr_buffer *buffer);
};
void wlr_renderer_init(struct wlr_renderer *renderer,