backend: automatically create allocator

Introduce a new backend_get_allocator function that automatically
creates an allocator for the backend if the backend has a renderer.
This commit is contained in:
Simon Ser 2021-04-28 23:39:36 +02:00 committed by Kenny Levinsen
parent bcabe34a2e
commit 4dae12890f
3 changed files with 26 additions and 0 deletions

View file

@ -10,4 +10,10 @@
*/
uint32_t backend_get_buffer_caps(struct wlr_backend *backend);
/**
* Get the backend's allocator. Automatically creates the allocator if
* necessary.
*/
struct wlr_allocator *backend_get_allocator(struct wlr_backend *backend);
#endif

View file

@ -29,6 +29,7 @@ struct wlr_backend {
// Private state
struct wlr_renderer *renderer;
struct wlr_allocator *allocator;
};
/**