render: introduce wlr_renderer_bind_buffer

master
Simon Ser 4 years ago
parent 0b40d09a21
commit c88c54fb38

@ -0,0 +1,8 @@
#ifndef RENDER_WLR_RENDERER_H
#define RENDER_WLR_RENDERER_H
#include <wlr/render/wlr_renderer.h>
bool wlr_renderer_bind_buffer(struct wlr_renderer *r, struct wlr_buffer *buffer);
#endif

@ -30,6 +30,8 @@
#include <wlr/render/dmabuf.h> #include <wlr/render/dmabuf.h>
struct wlr_renderer_impl { struct wlr_renderer_impl {
bool (*bind_buffer)(struct wlr_renderer *renderer,
struct wlr_buffer *buffer);
void (*begin)(struct wlr_renderer *renderer, uint32_t width, void (*begin)(struct wlr_renderer *renderer, uint32_t width,
uint32_t height); uint32_t height);
void (*end)(struct wlr_renderer *renderer); void (*end)(struct wlr_renderer *renderer);

@ -21,6 +21,7 @@ enum wlr_renderer_read_pixels_flags {
struct wlr_renderer_impl; struct wlr_renderer_impl;
struct wlr_drm_format_set; struct wlr_drm_format_set;
struct wlr_buffer;
struct wlr_renderer { struct wlr_renderer {
const struct wlr_renderer_impl *impl; const struct wlr_renderer_impl *impl;

@ -7,6 +7,7 @@
#include <wlr/types/wlr_matrix.h> #include <wlr/types/wlr_matrix.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h" #include "util/signal.h"
#include "render/wlr_renderer.h"
void wlr_renderer_init(struct wlr_renderer *renderer, void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl) { const struct wlr_renderer_impl *impl) {
@ -37,6 +38,15 @@ void wlr_renderer_destroy(struct wlr_renderer *r) {
} }
} }
bool wlr_renderer_bind_buffer(struct wlr_renderer *r,
struct wlr_buffer *buffer) {
assert(!r->rendering);
if (!r->impl->bind_buffer) {
return false;
}
return r->impl->bind_buffer(r, buffer);
}
void wlr_renderer_begin(struct wlr_renderer *r, uint32_t width, uint32_t height) { void wlr_renderer_begin(struct wlr_renderer *r, uint32_t width, uint32_t height) {
assert(!r->rendering); assert(!r->rendering);

Loading…
Cancel
Save