gpu: Use GskGpuShaderImage for blendmode ops

This commit is contained in:
Benjamin Otte 2024-07-19 00:46:33 +02:00
parent 23081d2bc4
commit 21988ea700
3 changed files with 29 additions and 23 deletions

View File

@ -52,17 +52,15 @@ static const GskGpuShaderOpClass GSK_GPU_BLEND_MODE_OP_CLASS = {
};
void
gsk_gpu_blend_mode_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuDescriptors *desc,
const graphene_rect_t *rect,
const graphene_point_t *offset,
float opacity,
GskBlendMode blend_mode,
guint32 bottom_descriptor,
const graphene_rect_t *bottom_rect,
guint32 top_descriptor,
const graphene_rect_t *top_rect)
gsk_gpu_blend_mode_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GskGpuDescriptors *desc,
const graphene_rect_t *rect,
const graphene_point_t *offset,
float opacity,
GskBlendMode blend_mode,
const GskGpuShaderImage *bottom,
const GskGpuShaderImage *top)
{
GskGpuBlendmodeInstance *instance;
@ -76,8 +74,8 @@ gsk_gpu_blend_mode_op (GskGpuFrame *frame,
gsk_gpu_rect_to_float (rect, offset, instance->rect);
instance->opacity = opacity;
gsk_gpu_rect_to_float (bottom_rect, offset, instance->bottom_rect);
instance->bottom_id = bottom_descriptor;
gsk_gpu_rect_to_float (top_rect, offset, instance->top_rect);
instance->top_id = top_descriptor;
gsk_gpu_rect_to_float (bottom->bounds, offset, instance->bottom_rect);
instance->bottom_id = bottom->descriptor;
gsk_gpu_rect_to_float (top->bounds, offset, instance->top_rect);
instance->top_id = top->descriptor;
}

View File

@ -13,10 +13,8 @@ void gsk_gpu_blend_mode_op (GskGpuF
const graphene_point_t *offset,
float opacity,
GskBlendMode blend_mode,
guint32 start_descriptor,
const graphene_rect_t *start_rect,
guint32 end_descriptor,
const graphene_rect_t *end_rect);
const GskGpuShaderImage *bottom,
const GskGpuShaderImage *top);
G_END_DECLS

View File

@ -2625,10 +2625,20 @@ gsk_gpu_node_processor_add_blend_node (GskGpuNodeProcessor *self,
&self->offset,
self->opacity,
gsk_blend_node_get_blend_mode (node),
descriptors[0],
&bottom_rect,
descriptors[1],
&top_rect);
&(GskGpuShaderImage) {
bottom_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[0],
NULL,
&bottom_rect
},
&(GskGpuShaderImage) {
top_image,
GSK_GPU_SAMPLER_DEFAULT,
descriptors[1],
NULL,
&top_rect
});
g_object_unref (top_image);
g_object_unref (bottom_image);