mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-07 11:20:09 +00:00
2aba50efa0
This is a massive refactoring because it collects all the renderops of all renderpasses into one long array in the Render object. Lots of code in there is still flaky and needs cleanup. That will follow in further commits. Other than that it does work fine though.
100 lines
3.1 KiB
C
100 lines
3.1 KiB
C
#include "config.h"
|
|
|
|
#include "gskvulkaninsetshadowopprivate.h"
|
|
|
|
#include "gskvulkanprivate.h"
|
|
#include "gsk/gskroundedrectprivate.h"
|
|
|
|
#include "vulkan/resources/inset-shadow.vert.h"
|
|
|
|
typedef struct _GskVulkanInsetShadowOp GskVulkanInsetShadowOp;
|
|
|
|
struct _GskVulkanInsetShadowOp
|
|
{
|
|
GskVulkanOp op;
|
|
|
|
GskRoundedRect outline;
|
|
GdkRGBA color;
|
|
graphene_point_t offset;
|
|
float spread;
|
|
float blur_radius;
|
|
};
|
|
|
|
static void
|
|
gsk_vulkan_inset_shadow_op_finish (GskVulkanOp *op)
|
|
{
|
|
}
|
|
|
|
static void
|
|
gsk_vulkan_inset_shadow_op_print (GskVulkanOp *op,
|
|
GString *string,
|
|
guint indent)
|
|
{
|
|
GskVulkanInsetShadowOp *self = (GskVulkanInsetShadowOp *) op;
|
|
|
|
print_indent (string, indent);
|
|
print_rounded_rect (string, &self->outline);
|
|
g_string_append (string, "inset-shadow ");
|
|
if (self->blur_radius > 0)
|
|
g_string_append_printf (string, "blur %gpx ", self->blur_radius);
|
|
print_newline (string);
|
|
}
|
|
|
|
static void
|
|
gsk_vulkan_inset_shadow_op_collect_vertex_data (GskVulkanOp *op,
|
|
guchar *data)
|
|
{
|
|
GskVulkanInsetShadowOp *self = (GskVulkanInsetShadowOp *) op;
|
|
GskVulkanInsetShadowInstance *instance = (GskVulkanInsetShadowInstance *) (data + op->vertex_offset);
|
|
|
|
gsk_rounded_rect_to_float (&self->outline, graphene_point_zero (), instance->outline);
|
|
gsk_vulkan_rgba_to_float (&self->color, instance->color);
|
|
gsk_vulkan_point_to_float (&self->offset, instance->offset);
|
|
instance->spread = self->spread;
|
|
instance->blur_radius = self->blur_radius;
|
|
}
|
|
|
|
static void
|
|
gsk_vulkan_inset_shadow_op_reserve_descriptor_sets (GskVulkanOp *op,
|
|
GskVulkanRender *render)
|
|
{
|
|
}
|
|
|
|
static const GskVulkanOpClass GSK_VULKAN_INSET_SHADOW_OP_CLASS = {
|
|
GSK_VULKAN_OP_SIZE (GskVulkanInsetShadowOp),
|
|
GSK_VULKAN_STAGE_COMMAND,
|
|
"inset-shadow",
|
|
&gsk_vulkan_inset_shadow_info,
|
|
gsk_vulkan_inset_shadow_op_finish,
|
|
gsk_vulkan_inset_shadow_op_print,
|
|
gsk_vulkan_op_draw_upload,
|
|
gsk_vulkan_op_draw_count_vertex_data,
|
|
gsk_vulkan_inset_shadow_op_collect_vertex_data,
|
|
gsk_vulkan_inset_shadow_op_reserve_descriptor_sets,
|
|
gsk_vulkan_op_draw_command
|
|
};
|
|
|
|
void
|
|
gsk_vulkan_inset_shadow_op (GskVulkanRender *render,
|
|
const char *clip_type,
|
|
const GskRoundedRect *outline,
|
|
const graphene_point_t *offset,
|
|
const GdkRGBA *color,
|
|
const graphene_point_t *shadow_offset,
|
|
float spread,
|
|
float blur_radius)
|
|
{
|
|
GskVulkanInsetShadowOp *self;
|
|
|
|
self = (GskVulkanInsetShadowOp *) gsk_vulkan_op_alloc (render, &GSK_VULKAN_INSET_SHADOW_OP_CLASS);
|
|
|
|
((GskVulkanOp *) self)->clip_type = g_intern_string (clip_type);
|
|
self->outline = *outline;
|
|
gsk_rounded_rect_offset (&self->outline, offset->x, offset->y);
|
|
self->color = *color;
|
|
self->offset = *shadow_offset;
|
|
self->spread = spread;
|
|
self->blur_radius = blur_radius;
|
|
}
|
|
|