mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-13 08:22:16 -04:00
render: introduce wlr_render_rect_pass
Split rectangle rendering out of wlr_render_pass and add a dedicated wlr_render_rect_pass interface. Remove the add_rect hook from wlr_render_pass_impl and implement rectangle rendering separately in the pixman, GLES2 and Vulkan renderers.
This commit is contained in:
parent
fd870f6d27
commit
33a27b055c
13 changed files with 258 additions and 9 deletions
|
|
@ -173,4 +173,12 @@ struct wlr_gles2_render_pass *begin_gles2_buffer_pass(struct wlr_gles2_buffer *b
|
|||
struct wlr_egl_context *prev_ctx, struct wlr_gles2_render_timer *timer,
|
||||
struct wlr_drm_syncobj_timeline *signal_timeline, uint64_t signal_point);
|
||||
|
||||
struct wlr_gles2_render_rect_pass {
|
||||
struct wlr_render_rect_pass base;
|
||||
};
|
||||
|
||||
bool wlr_render_rect_pass_is_gles2(const struct wlr_render_rect_pass *rect_pass);
|
||||
struct wlr_gles2_render_rect_pass *wlr_gles2_render_rect_pass_from_pass(
|
||||
struct wlr_render_rect_pass *rect_pass);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -61,4 +61,12 @@ bool begin_pixman_data_ptr_access(struct wlr_buffer *buffer, pixman_image_t **im
|
|||
struct wlr_pixman_render_pass *begin_pixman_render_pass(
|
||||
struct wlr_pixman_buffer *buffer);
|
||||
|
||||
struct wlr_pixman_render_rect_pass {
|
||||
struct wlr_render_rect_pass base;
|
||||
};
|
||||
|
||||
bool wlr_render_rect_pass_is_pixman(const struct wlr_render_rect_pass *rect_pass);
|
||||
struct wlr_pixman_render_rect_pass *wlr_pixman_render_rect_pass_from_pass(
|
||||
struct wlr_render_rect_pass *rect_pass);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -592,4 +592,12 @@ void vulkan_change_layout(VkCommandBuffer cb, VkImage img,
|
|||
|
||||
#endif
|
||||
|
||||
struct wlr_vk_render_rect_pass {
|
||||
struct wlr_render_rect_pass base;
|
||||
};
|
||||
|
||||
bool wlr_render_rect_pass_is_vk(const struct wlr_render_rect_pass *rect_pass);
|
||||
struct wlr_vk_render_rect_pass *wlr_vk_render_rect_pass_from_pass(
|
||||
struct wlr_render_rect_pass *rect_pass);
|
||||
|
||||
#endif // RENDER_VULKAN_H
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ void wlr_texture_init(struct wlr_texture *texture, struct wlr_renderer *rendener
|
|||
|
||||
struct wlr_render_pass {
|
||||
const struct wlr_render_pass_impl *impl;
|
||||
struct wlr_renderer *renderer;
|
||||
};
|
||||
|
||||
void wlr_render_pass_init(struct wlr_render_pass *pass,
|
||||
|
|
@ -59,9 +60,6 @@ struct wlr_render_pass_impl {
|
|||
bool (*submit)(struct wlr_render_pass *pass);
|
||||
void (*add_texture)(struct wlr_render_pass *pass,
|
||||
const struct wlr_render_texture_options *options);
|
||||
/* Implementers are also guaranteed that options->box is nonempty */
|
||||
void (*add_rect)(struct wlr_render_pass *pass,
|
||||
const struct wlr_render_rect_options *options);
|
||||
};
|
||||
|
||||
struct wlr_render_timer {
|
||||
|
|
@ -87,4 +85,29 @@ void wlr_texture_read_pixels_options_get_src_box(
|
|||
void *wlr_texture_read_pixel_options_get_data(
|
||||
const struct wlr_texture_read_pixels_options *options);
|
||||
|
||||
struct wlr_render_rect_pass;
|
||||
|
||||
struct wlr_render_rect_pass_impl {
|
||||
void (*destroy)(struct wlr_render_rect_pass *pass);
|
||||
void (*render)(struct wlr_render_pass *pass,
|
||||
const struct wlr_render_rect_options *options);
|
||||
};
|
||||
|
||||
struct wlr_render_rect_pass {
|
||||
const struct wlr_render_rect_pass_impl *impl;
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
};
|
||||
|
||||
void wlr_render_rect_pass_init(struct wlr_render_rect_pass *pass,
|
||||
const struct wlr_render_rect_pass_impl *impl);
|
||||
void wlr_render_rect_pass_destroy(struct wlr_render_rect_pass *pass);
|
||||
|
||||
struct wlr_render_rect_pass *get_or_create_render_rect_pass(
|
||||
struct wlr_renderer *renderer);
|
||||
struct wlr_render_rect_pass *wlr_pixman_render_rect_pass_create(void);
|
||||
struct wlr_render_rect_pass *wlr_gles2_render_rect_pass_create(void);
|
||||
struct wlr_render_rect_pass *wlr_vk_render_rect_pass_create(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ struct wlr_fbox;
|
|||
* A renderer for basic 2D operations.
|
||||
*/
|
||||
struct wlr_renderer {
|
||||
struct wlr_render_rect_pass *rect_pass;
|
||||
|
||||
void *data;
|
||||
|
||||
// Capabilities required for the buffer used as a render target (bitmask of
|
||||
// enum wlr_buffer_cap)
|
||||
uint32_t render_buffer_caps;
|
||||
|
|
|
|||
|
|
@ -250,6 +250,8 @@ struct wlr_output {
|
|||
struct wl_signal description;
|
||||
struct wl_signal request_state; // struct wlr_output_event_request_state
|
||||
struct wl_signal destroy;
|
||||
// Emitted when the output's rendering subsystem is initialized or reinitialized
|
||||
struct wl_signal render_inited;
|
||||
} events;
|
||||
|
||||
struct wl_event_source *idle_frame;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue