gpu: Use GskGpuShaderImage for mask ops

This commit is contained in:
Benjamin Otte 2024-07-19 03:06:20 +02:00
parent 0795d86df7
commit 9644fc2e8f
3 changed files with 71 additions and 35 deletions

View File

@ -51,17 +51,15 @@ static const GskGpuShaderOpClass GSK_GPU_MASK_OP_CLASS = {
};
void
gsk_gpu_mask_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuDescriptors *desc,
const graphene_rect_t *rect,
const graphene_point_t *offset,
float opacity,
GskMaskMode mask_mode,
guint32 source_descriptor,
const graphene_rect_t *source_rect,
guint32 mask_descriptor,
const graphene_rect_t *mask_rect)
gsk_gpu_mask_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuDescriptors *desc,
const graphene_rect_t *rect,
const graphene_point_t *offset,
float opacity,
GskMaskMode mask_mode,
const GskGpuShaderImage *source,
const GskGpuShaderImage *mask)
{
GskGpuMaskInstance *instance;
@ -74,9 +72,9 @@ gsk_gpu_mask_op (GskGpuFrame *frame,
&instance);
gsk_gpu_rect_to_float (rect, offset, instance->rect);
gsk_gpu_rect_to_float (source_rect, offset, instance->source_rect);
instance->source_id = source_descriptor;
gsk_gpu_rect_to_float (mask_rect, offset, instance->mask_rect);
instance->mask_id = mask_descriptor;
gsk_gpu_rect_to_float (source->bounds, offset, instance->source_rect);
instance->source_id = source->descriptor;
gsk_gpu_rect_to_float (mask->bounds, offset, instance->mask_rect);
instance->mask_id = mask->descriptor;
instance->opacity = opacity;
}

View File

@ -13,10 +13,8 @@ void gsk_gpu_mask_op (GskGpuF
const graphene_point_t *offset,
float opacity,
GskMaskMode mask_mode,
guint32 source_descriptor,
const graphene_rect_t *source_rect,
guint32 mask_descriptor,
const graphene_rect_t *mask_rect);
const GskGpuShaderImage *source,
const GskGpuShaderImage *mask);
G_END_DECLS

View File

@ -1082,10 +1082,20 @@ gsk_gpu_node_processor_add_rounded_clip_node_with_mask (GskGpuNodeProcessor *sel
&self->offset,
self->opacity,
GSK_MASK_MODE_ALPHA,
descriptors[0],
&child_rect,
descriptors[1],
&clip_bounds);
&(GskGpuShaderImage) {
child_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[0],
NULL,
&child_rect,
},
&(GskGpuShaderImage) {
mask_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[1],
NULL,
&clip_bounds,
});
g_object_unref (child_image);
g_object_unref (mask_image);
@ -2809,10 +2819,20 @@ gsk_gpu_node_processor_add_mask_node (GskGpuNodeProcessor *self,
&self->offset,
self->opacity,
mask_mode,
descriptors[0],
&source_rect,
descriptors[1],
&mask_rect);
&(GskGpuShaderImage) {
source_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[0],
NULL,
&source_rect,
},
&(GskGpuShaderImage) {
mask_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[1],
NULL,
&mask_rect,
});
g_object_unref (source_image);
}
@ -3275,10 +3295,20 @@ gsk_gpu_node_processor_add_fill_node (GskGpuNodeProcessor *self,
&self->offset,
self->opacity,
GSK_MASK_MODE_ALPHA,
descriptors[0],
&source_rect,
descriptors[1],
&clip_bounds);
&(GskGpuShaderImage) {
source_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[0],
NULL,
&source_rect,
},
&(GskGpuShaderImage) {
mask_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[1],
NULL,
&clip_bounds,
});
g_object_unref (source_image);
}
@ -3373,10 +3403,20 @@ gsk_gpu_node_processor_add_stroke_node (GskGpuNodeProcessor *self,
&self->offset,
self->opacity,
GSK_MASK_MODE_ALPHA,
descriptors[0],
&source_rect,
descriptors[1],
&clip_bounds);
&(GskGpuShaderImage) {
source_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[0],
NULL,
&source_rect,
},
&(GskGpuShaderImage) {
mask_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[1],
NULL,
&clip_bounds,
});
g_object_unref (source_image);
}