mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-30 15:31:34 +00:00
3aaea0ef40
In some cases, we were creating gigantic intermediate textures only to clip out a small section afterwards (e.g. in the listbox example in gtk4-demo). This is wasteful if we apply effects on the texture, such as blur or color-matrix. So, clip the dimensions of the intermediate texture with the current clip. To make this feasible, we move the texture coordinate computation out of the pipeline setup functions into the node_as_texture function where this clipping happens. One extra complication we encounter is that the node might get clipped away completely. Since Vulkan does not allow to create empty images, we bail out in this case and not draw anything. With these changes, the listbox example in gtk4-demo goes from 32M pixels of intermediate texture to 320000.
35 lines
2.0 KiB
C
35 lines
2.0 KiB
C
#ifndef __GSK_VULKAN_BLUR_PIPELINE_PRIVATE_H__
|
|
#define __GSK_VULKAN_BLUR_PIPELINE_PRIVATE_H__
|
|
|
|
#include <graphene.h>
|
|
|
|
#include "gskvulkanpipelineprivate.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
typedef struct _GskVulkanBlurPipelineLayout GskVulkanBlurPipelineLayout;
|
|
|
|
#define GSK_TYPE_VULKAN_BLUR_PIPELINE (gsk_vulkan_blur_pipeline_get_type ())
|
|
|
|
G_DECLARE_FINAL_TYPE (GskVulkanBlurPipeline, gsk_vulkan_blur_pipeline, GSK, VULKAN_BLUR_PIPELINE, GskVulkanPipeline)
|
|
|
|
GskVulkanPipeline * gsk_vulkan_blur_pipeline_new (GdkVulkanContext *context,
|
|
VkPipelineLayout layout,
|
|
const char *shader_name,
|
|
VkRenderPass render_pass);
|
|
|
|
gsize gsk_vulkan_blur_pipeline_count_vertex_data (GskVulkanBlurPipeline *pipeline);
|
|
void gsk_vulkan_blur_pipeline_collect_vertex_data (GskVulkanBlurPipeline *pipeline,
|
|
guchar *data,
|
|
const graphene_rect_t *rect,
|
|
const graphene_rect_t *tex_rect,
|
|
double radius);
|
|
gsize gsk_vulkan_blur_pipeline_draw (GskVulkanBlurPipeline *pipeline,
|
|
VkCommandBuffer command_buffer,
|
|
gsize offset,
|
|
gsize n_commands);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GSK_VULKAN_BLUR_PIPELINE_PRIVATE_H__ */
|