mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 09:40:10 +00:00
gpu: Use existing frame in render_texture()
Instead of recreating frames from scratch every time, use an existing one. This ensures that renderers don't need to recreate GPU resources every time (like buffers and everything else that frames manage). It also speeds up occasional render_texture() calls in default renderers. This speeds up in particular the Vulkan renderer.
This commit is contained in:
parent
c3d9f4a9ac
commit
fa86bfcb55
@ -152,7 +152,7 @@ gsk_gpu_renderer_dmabuf_downloader_download (GdkDmabufDownloader *downloader,
|
||||
|
||||
gsk_gpu_renderer_make_current (self);
|
||||
|
||||
frame = gsk_gpu_renderer_create_frame (self);
|
||||
frame = gsk_gpu_renderer_get_frame (self);
|
||||
|
||||
gsk_gpu_frame_download_texture (frame,
|
||||
g_get_monotonic_time (),
|
||||
@ -162,7 +162,7 @@ gsk_gpu_renderer_dmabuf_downloader_download (GdkDmabufDownloader *downloader,
|
||||
data,
|
||||
stride);
|
||||
|
||||
g_object_unref (frame);
|
||||
gsk_gpu_frame_wait (frame);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -310,7 +310,7 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self,
|
||||
gsk_gpu_image_get_width (image),
|
||||
gsk_gpu_image_get_height (image)
|
||||
});
|
||||
frame = gsk_gpu_renderer_create_frame (self);
|
||||
frame = gsk_gpu_renderer_get_frame (self);
|
||||
gsk_gpu_frame_render (frame,
|
||||
g_get_monotonic_time (),
|
||||
image,
|
||||
@ -322,7 +322,7 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self,
|
||||
image_width,
|
||||
image_height),
|
||||
&texture);
|
||||
g_object_unref (frame);
|
||||
gsk_gpu_frame_wait (frame);
|
||||
|
||||
g_assert (texture);
|
||||
gdk_texture_downloader_init (&downloader, texture);
|
||||
@ -381,7 +381,7 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
|
||||
else
|
||||
color_state = GDK_COLOR_STATE_SRGB;
|
||||
|
||||
frame = gsk_gpu_renderer_create_frame (self);
|
||||
frame = gsk_gpu_renderer_get_frame (self);
|
||||
|
||||
clip_region = cairo_region_create_rectangle (&(cairo_rectangle_int_t) {
|
||||
0, 0,
|
||||
@ -399,7 +399,7 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
|
||||
&rounded_viewport,
|
||||
&texture);
|
||||
|
||||
g_object_unref (frame);
|
||||
gsk_gpu_frame_wait (frame);
|
||||
g_object_unref (image);
|
||||
|
||||
gsk_gpu_device_queue_gc (priv->device);
|
||||
|
Loading…
Reference in New Issue
Block a user