gpu: Use GskGpuShaderImage for blur ops

This commit is contained in:
Benjamin Otte 2024-07-19 12:21:28 +02:00
parent 52db54e803
commit 68baa93460
3 changed files with 55 additions and 54 deletions

View File

@ -53,17 +53,15 @@ static const GskGpuShaderOpClass GSK_GPU_BLUR_OP_CLASS = {
};
static void
gsk_gpu_blur_op_full (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
guint32 variation,
GskGpuDescriptors *desc,
guint32 descriptor,
const graphene_rect_t *rect,
const graphene_point_t *offset,
const graphene_rect_t *tex_rect,
const graphene_vec2_t *blur_direction,
float blur_color[4])
gsk_gpu_blur_op_full (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
guint32 variation,
GskGpuDescriptors *desc,
const graphene_point_t *offset,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction,
float blur_color[4])
{
GskGpuBlurInstance *instance;
@ -75,58 +73,50 @@ gsk_gpu_blur_op_full (GskGpuFrame *frame,
desc,
&instance);
gsk_gpu_rect_to_float (rect, offset, instance->rect);
gsk_gpu_rect_to_float (tex_rect, offset, instance->tex_rect);
gsk_gpu_rect_to_float (image->coverage, offset, instance->rect);
gsk_gpu_rect_to_float (image->bounds, offset, instance->tex_rect);
graphene_vec2_to_float (blur_direction, instance->blur_direction);
gsk_gpu_color_to_float (blur_color, instance->blur_color);
instance->tex_id = descriptor;
instance->tex_id = image->descriptor;
}
void
gsk_gpu_blur_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
GskGpuDescriptors *desc,
guint32 descriptor,
const graphene_rect_t *rect,
const graphene_point_t *offset,
const graphene_rect_t *tex_rect,
const graphene_vec2_t *blur_direction)
gsk_gpu_blur_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
GskGpuDescriptors *desc,
const graphene_point_t *offset,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction)
{
gsk_gpu_blur_op_full (frame,
clip,
color_states,
0,
desc,
descriptor,
rect,
offset,
tex_rect,
image,
blur_direction,
(float[4]) { 1, 1, 1, 1 });
}
void
gsk_gpu_blur_shadow_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
GskGpuDescriptors *desc,
guint32 descriptor,
const graphene_rect_t *rect,
const graphene_point_t *offset,
const graphene_rect_t *tex_rect,
const graphene_vec2_t *blur_direction,
float shadow_color[4])
gsk_gpu_blur_shadow_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
GskGpuDescriptors *desc,
const graphene_point_t *offset,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction,
float shadow_color[4])
{
gsk_gpu_blur_op_full (frame,
clip,
color_states,
VARIATION_COLORIZE,
desc,
descriptor,
rect,
offset,
tex_rect,
image,
blur_direction,
shadow_color);
}

View File

@ -10,20 +10,16 @@ void gsk_gpu_blur_op (GskGpuF
GskGpuShaderClip clip,
GskGpuColorStates color_states,
GskGpuDescriptors *desc,
guint32 descriptor,
const graphene_rect_t *rect,
const graphene_point_t *offset,
const graphene_rect_t *tex_rect,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction);
void gsk_gpu_blur_shadow_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuColorStates color_states,
GskGpuDescriptors *desc,
guint32 descriptor,
const graphene_rect_t *rect,
const graphene_point_t *offset,
const graphene_rect_t *tex_rect,
const GskGpuShaderImage *image,
const graphene_vec2_t *blur_direction,
float shadow_color[4]);

View File

@ -766,6 +766,7 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
float blur_radius,
const GdkRGBA *shadow_color,
GskGpuDescriptors *source_desc,
GskGpuImage *source_image,
guint32 source_descriptor,
GdkMemoryDepth source_depth,
const graphene_rect_t *source_rect)
@ -804,10 +805,14 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
gsk_gpu_clip_get_shader_clip (&other.clip, &other.offset, &intermediate_rect),
gsk_gpu_node_processor_color_states_self (&other),
source_desc,
source_descriptor,
&intermediate_rect,
&other.offset,
source_rect,
&(GskGpuShaderImage) {
source_image,
GSK_GPU_SAMPLER_TRANSPARENT,
source_descriptor,
&intermediate_rect,
source_rect
},
&direction);
gsk_gpu_node_processor_finish_draw (&other, intermediate);
@ -822,10 +827,14 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
gsk_gpu_clip_get_shader_clip (&self->clip, &real_offset, rect),
gsk_gpu_node_processor_color_states_for_rgba (self),
self->desc,
intermediate_descriptor,
rect,
&real_offset,
&intermediate_rect,
&(GskGpuShaderImage) {
intermediate,
GSK_GPU_SAMPLER_TRANSPARENT,
intermediate_descriptor,
rect,
&intermediate_rect,
},
&direction,
GSK_RGBA_TO_VEC4 (shadow_color));
}
@ -835,10 +844,14 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
gsk_gpu_clip_get_shader_clip (&self->clip, &real_offset, rect),
gsk_gpu_node_processor_color_states_self (self),
self->desc,
intermediate_descriptor,
rect,
&real_offset,
&intermediate_rect,
&(GskGpuShaderImage) {
intermediate,
GSK_GPU_SAMPLER_TRANSPARENT,
intermediate_descriptor,
rect,
&intermediate_rect,
},
&direction);
}
@ -2483,6 +2496,7 @@ gsk_gpu_node_processor_add_blur_node (GskGpuNodeProcessor *self,
blur_radius,
NULL,
self->desc,
image,
descriptor,
gdk_memory_format_get_depth (gsk_gpu_image_get_format (image),
gsk_gpu_image_get_flags (image) & GSK_GPU_IMAGE_SRGB),
@ -2553,6 +2567,7 @@ gsk_gpu_node_processor_add_shadow_node (GskGpuNodeProcessor *self,
shadow->radius,
&shadow->color,
desc,
image,
descriptor,
gdk_memory_format_get_depth (gsk_gpu_image_get_format (image),
gsk_gpu_image_get_flags (image) & GSK_GPU_IMAGE_SRGB),