diff options
author | David96 <david@hameipe.de> | 2022-09-09 13:30:10 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-10-07 15:59:39 +0000 |
commit | f885aa0fbe89828101d65ad7a1336319c5d6bf47 (patch) | |
tree | f0a9161a6fa82fd2b17de2b84966ac19869ccb44 | |
parent | dce1372e35f113b20e85fbb6a624a979ff9f6452 (diff) |
render/vulkan: implement vulkan_preferred_read_format
-rw-r--r-- | render/vulkan/renderer.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index e520fd47..075f76d3 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -909,9 +909,14 @@ static const struct wlr_drm_format_set *vulkan_get_render_formats( static uint32_t vulkan_preferred_read_format( struct wlr_renderer *wlr_renderer) { - // TODO: implement! - wlr_log(WLR_ERROR, "vulkan_preferred_read_format not implemented"); - return DRM_FORMAT_XBGR8888; + struct wlr_vk_renderer *renderer = vulkan_get_renderer(wlr_renderer); + struct wlr_dmabuf_attributes dmabuf = {0}; + if (!wlr_buffer_get_dmabuf(renderer->current_render_buffer->wlr_buffer, + &dmabuf)) { + wlr_log(WLR_ERROR, "vulkan_preferred_read_format: Failed to get dmabuf of current render buffer"); + return DRM_FORMAT_INVALID; + } + return dmabuf.format; } static void vulkan_destroy(struct wlr_renderer *wlr_renderer) { |