2023-12-30 05:41:11 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gskgpucrossfadeopprivate.h"
|
|
|
|
|
|
|
|
#include "gskgpuframeprivate.h"
|
|
|
|
#include "gskgpuprintprivate.h"
|
|
|
|
#include "gskrectprivate.h"
|
|
|
|
|
|
|
|
#include "gpu/shaders/gskgpucrossfadeinstance.h"
|
|
|
|
|
|
|
|
typedef struct _GskGpuCrossFadeOp GskGpuCrossFadeOp;
|
|
|
|
|
|
|
|
struct _GskGpuCrossFadeOp
|
|
|
|
{
|
|
|
|
GskGpuShaderOp op;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2024-03-15 12:37:31 +00:00
|
|
|
gsk_gpu_cross_fade_op_print_instance (GskGpuShaderOp *shader,
|
|
|
|
gpointer instance_,
|
|
|
|
GString *string)
|
2023-12-30 05:41:11 +00:00
|
|
|
{
|
2024-03-15 12:37:31 +00:00
|
|
|
GskGpuCrossfadeInstance *instance = (GskGpuCrossfadeInstance *) instance_;
|
2023-12-30 05:41:11 +00:00
|
|
|
|
|
|
|
gsk_gpu_print_rect (string, instance->rect);
|
2024-07-20 08:25:17 +00:00
|
|
|
gsk_gpu_print_image (string, shader->images[0]);
|
|
|
|
gsk_gpu_print_image (string, shader->images[1]);
|
2023-12-30 05:41:11 +00:00
|
|
|
g_string_append_printf (string, "%g%%", 100 * instance->opacity_progress[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GskGpuShaderOpClass GSK_GPU_CROSS_FADE_OP_CLASS = {
|
|
|
|
{
|
|
|
|
GSK_GPU_OP_SIZE (GskGpuCrossFadeOp),
|
|
|
|
GSK_GPU_STAGE_SHADER,
|
|
|
|
gsk_gpu_shader_op_finish,
|
2024-03-15 12:37:31 +00:00
|
|
|
gsk_gpu_shader_op_print,
|
2023-12-30 05:41:11 +00:00
|
|
|
#ifdef GDK_RENDERING_VULKAN
|
|
|
|
gsk_gpu_shader_op_vk_command,
|
|
|
|
#endif
|
|
|
|
gsk_gpu_shader_op_gl_command
|
|
|
|
},
|
|
|
|
"gskgpucrossfade",
|
2024-07-19 15:25:03 +00:00
|
|
|
gsk_gpu_crossfade_n_textures,
|
2023-12-30 05:41:11 +00:00
|
|
|
sizeof (GskGpuCrossfadeInstance),
|
|
|
|
#ifdef GDK_RENDERING_VULKAN
|
|
|
|
&gsk_gpu_crossfade_info,
|
|
|
|
#endif
|
2024-03-15 12:37:31 +00:00
|
|
|
gsk_gpu_cross_fade_op_print_instance,
|
2024-01-04 13:52:03 +00:00
|
|
|
gsk_gpu_crossfade_setup_attrib_locations,
|
2023-12-30 05:41:11 +00:00
|
|
|
gsk_gpu_crossfade_setup_vao
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2024-07-19 10:11:40 +00:00
|
|
|
gsk_gpu_cross_fade_op (GskGpuFrame *frame,
|
|
|
|
GskGpuShaderClip clip,
|
|
|
|
const graphene_rect_t *rect,
|
|
|
|
const graphene_point_t *offset,
|
|
|
|
float opacity,
|
|
|
|
float progress,
|
|
|
|
const GskGpuShaderImage *start,
|
|
|
|
const GskGpuShaderImage *end)
|
2023-12-30 05:41:11 +00:00
|
|
|
{
|
|
|
|
GskGpuCrossfadeInstance *instance;
|
|
|
|
|
|
|
|
gsk_gpu_shader_op_alloc (frame,
|
|
|
|
&GSK_GPU_CROSS_FADE_OP_CLASS,
|
2024-08-19 22:32:10 +00:00
|
|
|
gsk_gpu_color_states_create_equal (TRUE, TRUE),
|
2023-12-31 04:38:56 +00:00
|
|
|
0,
|
2023-12-30 05:41:11 +00:00
|
|
|
clip,
|
2024-07-19 16:02:06 +00:00
|
|
|
(GskGpuImage *[2]) { start->image, end->image },
|
|
|
|
(GskGpuSampler[2]) { start->sampler, end->sampler },
|
2023-12-30 05:41:11 +00:00
|
|
|
&instance);
|
|
|
|
|
|
|
|
gsk_gpu_rect_to_float (rect, offset, instance->rect);
|
|
|
|
instance->opacity_progress[0] = opacity;
|
|
|
|
instance->opacity_progress[1] = progress;
|
2024-07-19 10:11:40 +00:00
|
|
|
gsk_gpu_rect_to_float (start->bounds, offset, instance->start_rect);
|
|
|
|
gsk_gpu_rect_to_float (end->bounds, offset, instance->end_rect);
|
2023-12-30 05:41:11 +00:00
|
|
|
}
|