2023-06-29 04:58:55 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gskvulkancoloropprivate.h"
|
|
|
|
|
2023-07-05 04:32:52 +00:00
|
|
|
#include "gskvulkanprivate.h"
|
|
|
|
|
2023-06-29 04:58:55 +00:00
|
|
|
#include "vulkan/resources/color.vert.h"
|
|
|
|
|
|
|
|
typedef struct _GskVulkanColorOp GskVulkanColorOp;
|
|
|
|
|
|
|
|
struct _GskVulkanColorOp
|
|
|
|
{
|
|
|
|
GskVulkanOp op;
|
|
|
|
|
|
|
|
graphene_rect_t rect;
|
|
|
|
GdkRGBA color;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
gsk_vulkan_color_op_finish (GskVulkanOp *op)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-07-08 19:28:56 +00:00
|
|
|
gsk_vulkan_color_op_upload (GskVulkanOp *op,
|
|
|
|
GskVulkanUploader *uploader)
|
2023-06-29 04:58:55 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-07-05 04:32:52 +00:00
|
|
|
static void
|
|
|
|
gsk_vulkan_color_op_print (GskVulkanOp *op,
|
|
|
|
GString *string,
|
|
|
|
guint indent)
|
|
|
|
{
|
|
|
|
GskVulkanColorOp *self = (GskVulkanColorOp *) op;
|
|
|
|
|
|
|
|
print_indent (string, indent);
|
|
|
|
print_rect (string, &self->rect);
|
|
|
|
g_string_append (string, "color ");
|
|
|
|
print_rgba (string, &self->color);
|
|
|
|
print_newline (string);
|
|
|
|
}
|
|
|
|
|
2023-06-29 04:58:55 +00:00
|
|
|
static void
|
2023-07-08 19:28:56 +00:00
|
|
|
gsk_vulkan_color_op_collect_vertex_data (GskVulkanOp *op,
|
|
|
|
guchar *data)
|
2023-06-29 04:58:55 +00:00
|
|
|
{
|
|
|
|
GskVulkanColorOp *self = (GskVulkanColorOp *) op;
|
2023-07-09 14:27:02 +00:00
|
|
|
GskVulkanColorInstance *instance = (GskVulkanColorInstance *) (data + op->vertex_offset);
|
2023-06-29 04:58:55 +00:00
|
|
|
|
|
|
|
instance->rect[0] = self->rect.origin.x;
|
|
|
|
instance->rect[1] = self->rect.origin.y;
|
|
|
|
instance->rect[2] = self->rect.size.width;
|
|
|
|
instance->rect[3] = self->rect.size.height;
|
|
|
|
instance->color[0] = self->color.red;
|
|
|
|
instance->color[1] = self->color.green;
|
|
|
|
instance->color[2] = self->color.blue;
|
|
|
|
instance->color[3] = self->color.alpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gsk_vulkan_color_op_reserve_descriptor_sets (GskVulkanOp *op,
|
|
|
|
GskVulkanRender *render)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GskVulkanOpClass GSK_VULKAN_COLOR_OP_CLASS = {
|
|
|
|
GSK_VULKAN_OP_SIZE (GskVulkanColorOp),
|
2023-07-09 13:40:48 +00:00
|
|
|
GSK_VULKAN_STAGE_COMMAND,
|
2023-06-29 04:58:55 +00:00
|
|
|
"color",
|
|
|
|
&gsk_vulkan_color_info,
|
|
|
|
gsk_vulkan_color_op_finish,
|
2023-07-05 04:32:52 +00:00
|
|
|
gsk_vulkan_color_op_print,
|
2023-06-29 04:58:55 +00:00
|
|
|
gsk_vulkan_color_op_upload,
|
2023-07-09 14:27:02 +00:00
|
|
|
gsk_vulkan_op_draw_count_vertex_data,
|
2023-06-29 04:58:55 +00:00
|
|
|
gsk_vulkan_color_op_collect_vertex_data,
|
|
|
|
gsk_vulkan_color_op_reserve_descriptor_sets,
|
2023-07-09 14:27:02 +00:00
|
|
|
gsk_vulkan_op_draw_command
|
2023-06-29 04:58:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2023-07-09 18:28:12 +00:00
|
|
|
gsk_vulkan_color_op (GskVulkanRender *render,
|
2023-06-29 04:58:55 +00:00
|
|
|
const char *clip_type,
|
|
|
|
const graphene_rect_t *rect,
|
|
|
|
const graphene_point_t *offset,
|
|
|
|
const GdkRGBA *color)
|
|
|
|
{
|
|
|
|
GskVulkanColorOp *self;
|
|
|
|
|
2023-07-09 18:28:12 +00:00
|
|
|
self = (GskVulkanColorOp *) gsk_vulkan_op_alloc (render, &GSK_VULKAN_COLOR_OP_CLASS);
|
2023-06-29 04:58:55 +00:00
|
|
|
|
|
|
|
((GskVulkanOp *) self)->clip_type = g_intern_string (clip_type);
|
|
|
|
graphene_rect_offset_r (rect, offset->x, offset->y, &self->rect);
|
|
|
|
self->color = *color;
|
|
|
|
}
|