mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
backend/drm: use new rendering API
This commit is contained in:
parent
93a6acae9f
commit
8fe29e6bd1
1 changed files with 22 additions and 15 deletions
|
@ -99,29 +99,36 @@ struct wlr_buffer *drm_surface_blit(struct wlr_drm_surface *surf,
|
||||||
struct wlr_buffer *dst = wlr_swapchain_acquire(surf->swapchain, NULL);
|
struct wlr_buffer *dst = wlr_swapchain_acquire(surf->swapchain, NULL);
|
||||||
if (!dst) {
|
if (!dst) {
|
||||||
wlr_log(WLR_ERROR, "Failed to acquire multi-GPU swapchain buffer");
|
wlr_log(WLR_ERROR, "Failed to acquire multi-GPU swapchain buffer");
|
||||||
wlr_texture_destroy(tex);
|
goto error_tex;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float mat[9];
|
struct wlr_render_pass *pass = wlr_renderer_begin_buffer_pass(renderer, dst);
|
||||||
wlr_matrix_identity(mat);
|
if (pass == NULL) {
|
||||||
wlr_matrix_scale(mat, surf->swapchain->width, surf->swapchain->height);
|
wlr_log(WLR_ERROR, "Failed to begin render pass with multi-GPU destination buffer");
|
||||||
|
goto error_dst;
|
||||||
if (!wlr_renderer_begin_with_buffer(renderer, dst)) {
|
|
||||||
wlr_log(WLR_ERROR, "Failed to bind multi-GPU destination buffer");
|
|
||||||
wlr_buffer_unlock(dst);
|
|
||||||
wlr_texture_destroy(tex);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 });
|
wlr_render_pass_add_rect(pass, &(struct wlr_render_rect_options){
|
||||||
wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f);
|
.box = { .width = dst->width, .height = dst->height },
|
||||||
|
.blend_mode = WLR_RENDER_BLEND_MODE_NONE,
|
||||||
wlr_renderer_end(renderer);
|
});
|
||||||
|
wlr_render_pass_add_texture(pass, &(struct wlr_render_texture_options){
|
||||||
|
.texture = tex,
|
||||||
|
});
|
||||||
|
if (!wlr_render_pass_submit(pass)) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to submit multi-GPU render pass");
|
||||||
|
goto error_dst;
|
||||||
|
}
|
||||||
|
|
||||||
wlr_texture_destroy(tex);
|
wlr_texture_destroy(tex);
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
|
|
||||||
|
error_dst:
|
||||||
|
wlr_buffer_unlock(dst);
|
||||||
|
error_tex:
|
||||||
|
wlr_texture_destroy(tex);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue