mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
vulkan: Port inset and outset shadow to new ops
This commit is contained in:
parent
594595d9cd
commit
b2296a1918
@ -110,7 +110,6 @@ if have_vulkan
|
||||
'vulkan/gskvulkanblendmodeop.c',
|
||||
'vulkan/gskvulkanblurpipeline.c',
|
||||
'vulkan/gskvulkanborderpipeline.c',
|
||||
'vulkan/gskvulkanboxshadowpipeline.c',
|
||||
'vulkan/gskvulkanbuffer.c',
|
||||
'vulkan/gskvulkanclip.c',
|
||||
'vulkan/gskvulkancolormatrixop.c',
|
||||
@ -120,10 +119,12 @@ if have_vulkan
|
||||
'vulkan/gskvulkancrossfadeop.c',
|
||||
'vulkan/gskvulkanglyphcache.c',
|
||||
'vulkan/gskvulkanimage.c',
|
||||
'vulkan/gskvulkaninsetshadowop.c',
|
||||
'vulkan/gskvulkanlineargradientpipeline.c',
|
||||
'vulkan/gskvulkanmemory.c',
|
||||
'vulkan/gskvulkanoffscreenop.c',
|
||||
'vulkan/gskvulkanop.c',
|
||||
'vulkan/gskvulkanoutsetshadowop.c',
|
||||
'vulkan/gskvulkanpipeline.c',
|
||||
'vulkan/gskvulkanpushconstants.c',
|
||||
'vulkan/gskvulkanrender.c',
|
||||
|
@ -1,89 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskvulkanboxshadowpipelineprivate.h"
|
||||
|
||||
#include "vulkan/resources/inset-shadow.vert.h"
|
||||
|
||||
#include "gskroundedrectprivate.h"
|
||||
|
||||
struct _GskVulkanBoxShadowPipeline
|
||||
{
|
||||
GObject parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GskVulkanBoxShadowPipeline, gsk_vulkan_box_shadow_pipeline, GSK_TYPE_VULKAN_PIPELINE)
|
||||
|
||||
static const VkPipelineVertexInputStateCreateInfo *
|
||||
gsk_vulkan_box_shadow_pipeline_get_input_state_create_info (GskVulkanPipeline *self)
|
||||
{
|
||||
return &gsk_vulkan_inset_shadow_info;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_box_shadow_pipeline_finalize (GObject *gobject)
|
||||
{
|
||||
//GskVulkanBoxShadowPipeline *self = GSK_VULKAN_BOX_SHADOW_PIPELINE (gobject);
|
||||
|
||||
G_OBJECT_CLASS (gsk_vulkan_box_shadow_pipeline_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_box_shadow_pipeline_class_init (GskVulkanBoxShadowPipelineClass *klass)
|
||||
{
|
||||
GskVulkanPipelineClass *pipeline_class = GSK_VULKAN_PIPELINE_CLASS (klass);
|
||||
|
||||
G_OBJECT_CLASS (klass)->finalize = gsk_vulkan_box_shadow_pipeline_finalize;
|
||||
|
||||
pipeline_class->get_input_state_create_info = gsk_vulkan_box_shadow_pipeline_get_input_state_create_info;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_box_shadow_pipeline_init (GskVulkanBoxShadowPipeline *self)
|
||||
{
|
||||
}
|
||||
|
||||
GskVulkanPipeline *
|
||||
gsk_vulkan_box_shadow_pipeline_new (GdkVulkanContext *context,
|
||||
VkPipelineLayout layout,
|
||||
const char *shader_name,
|
||||
VkRenderPass render_pass)
|
||||
{
|
||||
return gsk_vulkan_pipeline_new (GSK_TYPE_VULKAN_BOX_SHADOW_PIPELINE, context, layout, shader_name, render_pass);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_vulkan_box_shadow_pipeline_collect_vertex_data (GskVulkanBoxShadowPipeline *pipeline,
|
||||
guchar *data,
|
||||
const graphene_point_t *offset,
|
||||
const GskRoundedRect *outline,
|
||||
const GdkRGBA *color,
|
||||
float dx,
|
||||
float dy,
|
||||
float spread,
|
||||
float blur_radius)
|
||||
{
|
||||
GskVulkanInsetShadowInstance *instance = (GskVulkanInsetShadowInstance *) data;
|
||||
|
||||
gsk_rounded_rect_to_float (outline, offset, instance->outline);
|
||||
instance->color[0] = color->red;
|
||||
instance->color[1] = color->green;
|
||||
instance->color[2] = color->blue;
|
||||
instance->color[3] = color->alpha;
|
||||
instance->offset[0] = dx;
|
||||
instance->offset[1] = dy;
|
||||
instance->spread = spread;
|
||||
instance->blur_radius = blur_radius;
|
||||
}
|
||||
|
||||
gsize
|
||||
gsk_vulkan_box_shadow_pipeline_draw (GskVulkanBoxShadowPipeline *pipeline,
|
||||
VkCommandBuffer command_buffer,
|
||||
gsize offset,
|
||||
gsize n_commands)
|
||||
{
|
||||
vkCmdDraw (command_buffer,
|
||||
6 * 8, n_commands,
|
||||
0, offset);
|
||||
|
||||
return n_commands;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <graphene.h>
|
||||
|
||||
#include "gskvulkanpipelineprivate.h"
|
||||
#include "gskroundedrect.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GskVulkanBoxShadowPipelineLayout GskVulkanBoxShadowPipelineLayout;
|
||||
|
||||
#define GSK_TYPE_VULKAN_BOX_SHADOW_PIPELINE (gsk_vulkan_box_shadow_pipeline_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GskVulkanBoxShadowPipeline, gsk_vulkan_box_shadow_pipeline, GSK, VULKAN_BOX_SHADOW_PIPELINE, GskVulkanPipeline)
|
||||
|
||||
GskVulkanPipeline * gsk_vulkan_box_shadow_pipeline_new (GdkVulkanContext *context,
|
||||
VkPipelineLayout layout,
|
||||
const char *shader_name,
|
||||
VkRenderPass render_pass);
|
||||
|
||||
void gsk_vulkan_box_shadow_pipeline_collect_vertex_data (GskVulkanBoxShadowPipeline *pipeline,
|
||||
guchar *data,
|
||||
const graphene_point_t *offset,
|
||||
const GskRoundedRect *outline,
|
||||
const GdkRGBA *color,
|
||||
float dx,
|
||||
float dy,
|
||||
float spread,
|
||||
float blur_radius);
|
||||
|
||||
gsize gsk_vulkan_box_shadow_pipeline_draw (GskVulkanBoxShadowPipeline *pipeline,
|
||||
VkCommandBuffer command_buffer,
|
||||
gsize offset,
|
||||
gsize n_commands);
|
||||
|
||||
G_END_DECLS
|
||||
|
135
gsk/vulkan/gskvulkaninsetshadowop.c
Normal file
135
gsk/vulkan/gskvulkaninsetshadowop.c
Normal file
@ -0,0 +1,135 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskvulkaninsetshadowopprivate.h"
|
||||
|
||||
#include "vulkan/resources/inset-shadow.vert.h"
|
||||
|
||||
#include "gsk/gskroundedrectprivate.h"
|
||||
|
||||
typedef struct _GskVulkanInsetShadowOp GskVulkanInsetShadowOp;
|
||||
|
||||
struct _GskVulkanInsetShadowOp
|
||||
{
|
||||
GskVulkanOp op;
|
||||
|
||||
GskRoundedRect outline;
|
||||
GdkRGBA color;
|
||||
graphene_point_t offset;
|
||||
float spread;
|
||||
float blur_radius;
|
||||
|
||||
gsize vertex_offset;
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_vulkan_inset_shadow_op_finish (GskVulkanOp *op)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_inset_shadow_op_upload (GskVulkanOp *op,
|
||||
GskVulkanRenderPass *pass,
|
||||
GskVulkanRender *render,
|
||||
GskVulkanUploader *uploader,
|
||||
const graphene_rect_t *clip,
|
||||
const graphene_vec2_t *scale)
|
||||
{
|
||||
}
|
||||
|
||||
static inline gsize
|
||||
round_up (gsize number, gsize divisor)
|
||||
{
|
||||
return (number + divisor - 1) / divisor * divisor;
|
||||
}
|
||||
|
||||
static gsize
|
||||
gsk_vulkan_inset_shadow_op_count_vertex_data (GskVulkanOp *op,
|
||||
gsize n_bytes)
|
||||
{
|
||||
GskVulkanInsetShadowOp *self = (GskVulkanInsetShadowOp *) op;
|
||||
gsize vertex_stride;
|
||||
|
||||
vertex_stride = gsk_vulkan_inset_shadow_info.pVertexBindingDescriptions[0].stride;
|
||||
n_bytes = round_up (n_bytes, vertex_stride);
|
||||
self->vertex_offset = n_bytes;
|
||||
n_bytes += vertex_stride;
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_inset_shadow_op_collect_vertex_data (GskVulkanOp *op,
|
||||
GskVulkanRenderPass *pass,
|
||||
GskVulkanRender *render,
|
||||
guchar *data)
|
||||
{
|
||||
GskVulkanInsetShadowOp *self = (GskVulkanInsetShadowOp *) op;
|
||||
GskVulkanInsetShadowInstance *instance = (GskVulkanInsetShadowInstance *) (data + self->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 VkPipeline
|
||||
gsk_vulkan_inset_shadow_op_get_pipeline (GskVulkanOp *op)
|
||||
{
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_inset_shadow_op_command (GskVulkanOp *op,
|
||||
GskVulkanRender *render,
|
||||
VkPipelineLayout pipeline_layout,
|
||||
VkCommandBuffer command_buffer)
|
||||
{
|
||||
GskVulkanInsetShadowOp *self = (GskVulkanInsetShadowOp *) op;
|
||||
|
||||
vkCmdDraw (command_buffer,
|
||||
6, 1,
|
||||
0, self->vertex_offset / gsk_vulkan_inset_shadow_info.pVertexBindingDescriptions[0].stride);
|
||||
}
|
||||
|
||||
static const GskVulkanOpClass GSK_VULKAN_INSET_SHADOW_OP_CLASS = {
|
||||
GSK_VULKAN_OP_SIZE (GskVulkanInsetShadowOp),
|
||||
"inset-shadow",
|
||||
&gsk_vulkan_inset_shadow_info,
|
||||
gsk_vulkan_inset_shadow_op_finish,
|
||||
gsk_vulkan_inset_shadow_op_upload,
|
||||
gsk_vulkan_inset_shadow_op_count_vertex_data,
|
||||
gsk_vulkan_inset_shadow_op_collect_vertex_data,
|
||||
gsk_vulkan_inset_shadow_op_reserve_descriptor_sets,
|
||||
gsk_vulkan_inset_shadow_op_get_pipeline,
|
||||
gsk_vulkan_inset_shadow_op_command
|
||||
};
|
||||
|
||||
void
|
||||
gsk_vulkan_inset_shadow_op (GskVulkanRenderPass *render_pass,
|
||||
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_pass, &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;
|
||||
}
|
||||
|
18
gsk/vulkan/gskvulkaninsetshadowopprivate.h
Normal file
18
gsk/vulkan/gskvulkaninsetshadowopprivate.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "gskvulkanopprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gsk_vulkan_inset_shadow_op (GskVulkanRenderPass *render_pass,
|
||||
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);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -95,5 +95,23 @@ gsk_vulkan_rect_to_float (const graphene_rect_t *rect,
|
||||
values[3] = rect->size.height;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_vulkan_rgba_to_float (const GdkRGBA *rgba,
|
||||
float values[4])
|
||||
{
|
||||
values[0] = rgba->red;
|
||||
values[1] = rgba->green;
|
||||
values[2] = rgba->blue;
|
||||
values[3] = rgba->alpha;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_vulkan_point_to_float (const graphene_point_t *point,
|
||||
float values[2])
|
||||
{
|
||||
values[0] = point->x;
|
||||
values[1] = point->y;
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
135
gsk/vulkan/gskvulkanoutsetshadowop.c
Normal file
135
gsk/vulkan/gskvulkanoutsetshadowop.c
Normal file
@ -0,0 +1,135 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskvulkanoutsetshadowopprivate.h"
|
||||
|
||||
#include "vulkan/resources/outset-shadow.vert.h"
|
||||
|
||||
#include "gsk/gskroundedrectprivate.h"
|
||||
|
||||
typedef struct _GskVulkanOutsetShadowOp GskVulkanOutsetShadowOp;
|
||||
|
||||
struct _GskVulkanOutsetShadowOp
|
||||
{
|
||||
GskVulkanOp op;
|
||||
|
||||
GskRoundedRect outline;
|
||||
GdkRGBA color;
|
||||
graphene_point_t offset;
|
||||
float spread;
|
||||
float blur_radius;
|
||||
|
||||
gsize vertex_offset;
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_vulkan_outset_shadow_op_finish (GskVulkanOp *op)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_outset_shadow_op_upload (GskVulkanOp *op,
|
||||
GskVulkanRenderPass *pass,
|
||||
GskVulkanRender *render,
|
||||
GskVulkanUploader *uploader,
|
||||
const graphene_rect_t *clip,
|
||||
const graphene_vec2_t *scale)
|
||||
{
|
||||
}
|
||||
|
||||
static inline gsize
|
||||
round_up (gsize number, gsize divisor)
|
||||
{
|
||||
return (number + divisor - 1) / divisor * divisor;
|
||||
}
|
||||
|
||||
static gsize
|
||||
gsk_vulkan_outset_shadow_op_count_vertex_data (GskVulkanOp *op,
|
||||
gsize n_bytes)
|
||||
{
|
||||
GskVulkanOutsetShadowOp *self = (GskVulkanOutsetShadowOp *) op;
|
||||
gsize vertex_stride;
|
||||
|
||||
vertex_stride = gsk_vulkan_outset_shadow_info.pVertexBindingDescriptions[0].stride;
|
||||
n_bytes = round_up (n_bytes, vertex_stride);
|
||||
self->vertex_offset = n_bytes;
|
||||
n_bytes += vertex_stride;
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_outset_shadow_op_collect_vertex_data (GskVulkanOp *op,
|
||||
GskVulkanRenderPass *pass,
|
||||
GskVulkanRender *render,
|
||||
guchar *data)
|
||||
{
|
||||
GskVulkanOutsetShadowOp *self = (GskVulkanOutsetShadowOp *) op;
|
||||
GskVulkanOutsetShadowInstance *instance = (GskVulkanOutsetShadowInstance *) (data + self->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_outset_shadow_op_reserve_descriptor_sets (GskVulkanOp *op,
|
||||
GskVulkanRender *render)
|
||||
{
|
||||
}
|
||||
|
||||
static VkPipeline
|
||||
gsk_vulkan_outset_shadow_op_get_pipeline (GskVulkanOp *op)
|
||||
{
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_outset_shadow_op_command (GskVulkanOp *op,
|
||||
GskVulkanRender *render,
|
||||
VkPipelineLayout pipeline_layout,
|
||||
VkCommandBuffer command_buffer)
|
||||
{
|
||||
GskVulkanOutsetShadowOp *self = (GskVulkanOutsetShadowOp *) op;
|
||||
|
||||
vkCmdDraw (command_buffer,
|
||||
6, 1,
|
||||
0, self->vertex_offset / gsk_vulkan_outset_shadow_info.pVertexBindingDescriptions[0].stride);
|
||||
}
|
||||
|
||||
static const GskVulkanOpClass GSK_VULKAN_OUTSET_SHADOW_OP_CLASS = {
|
||||
GSK_VULKAN_OP_SIZE (GskVulkanOutsetShadowOp),
|
||||
"outset-shadow",
|
||||
&gsk_vulkan_outset_shadow_info,
|
||||
gsk_vulkan_outset_shadow_op_finish,
|
||||
gsk_vulkan_outset_shadow_op_upload,
|
||||
gsk_vulkan_outset_shadow_op_count_vertex_data,
|
||||
gsk_vulkan_outset_shadow_op_collect_vertex_data,
|
||||
gsk_vulkan_outset_shadow_op_reserve_descriptor_sets,
|
||||
gsk_vulkan_outset_shadow_op_get_pipeline,
|
||||
gsk_vulkan_outset_shadow_op_command
|
||||
};
|
||||
|
||||
void
|
||||
gsk_vulkan_outset_shadow_op (GskVulkanRenderPass *render_pass,
|
||||
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)
|
||||
{
|
||||
GskVulkanOutsetShadowOp *self;
|
||||
|
||||
self = (GskVulkanOutsetShadowOp *) gsk_vulkan_op_alloc (render_pass, &GSK_VULKAN_OUTSET_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;
|
||||
}
|
||||
|
18
gsk/vulkan/gskvulkanoutsetshadowopprivate.h
Normal file
18
gsk/vulkan/gskvulkanoutsetshadowopprivate.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "gskvulkanopprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gsk_vulkan_outset_shadow_op (GskVulkanRenderPass *render_pass,
|
||||
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);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "gskvulkanblurpipelineprivate.h"
|
||||
#include "gskvulkanborderpipelineprivate.h"
|
||||
#include "gskvulkanboxshadowpipelineprivate.h"
|
||||
#include "gskvulkancolortextpipelineprivate.h"
|
||||
#include "gskvulkanlineargradientpipelineprivate.h"
|
||||
#include "gskvulkantextpipelineprivate.h"
|
||||
@ -506,12 +505,6 @@ gsk_vulkan_render_get_pipeline (GskVulkanRender *self,
|
||||
{ "border", 0, gsk_vulkan_border_pipeline_new },
|
||||
{ "border-clip", 0, gsk_vulkan_border_pipeline_new },
|
||||
{ "border-clip-rounded", 0, gsk_vulkan_border_pipeline_new },
|
||||
{ "inset-shadow", 0, gsk_vulkan_box_shadow_pipeline_new },
|
||||
{ "inset-shadow-clip", 0, gsk_vulkan_box_shadow_pipeline_new },
|
||||
{ "inset-shadow-clip-rounded", 0, gsk_vulkan_box_shadow_pipeline_new },
|
||||
{ "outset-shadow", 0, gsk_vulkan_box_shadow_pipeline_new },
|
||||
{ "outset-shadow-clip", 0, gsk_vulkan_box_shadow_pipeline_new },
|
||||
{ "outset-shadow-clip-rounded", 0, gsk_vulkan_box_shadow_pipeline_new },
|
||||
{ "blur", 1, gsk_vulkan_blur_pipeline_new },
|
||||
{ "blur-clip", 1, gsk_vulkan_blur_pipeline_new },
|
||||
{ "blur-clip-rounded", 1, gsk_vulkan_blur_pipeline_new },
|
||||
|
@ -12,18 +12,19 @@
|
||||
#include "gskvulkanblendmodeopprivate.h"
|
||||
#include "gskvulkanblurpipelineprivate.h"
|
||||
#include "gskvulkanborderpipelineprivate.h"
|
||||
#include "gskvulkanboxshadowpipelineprivate.h"
|
||||
#include "gskvulkanclipprivate.h"
|
||||
#include "gskvulkancolormatrixopprivate.h"
|
||||
#include "gskvulkancoloropprivate.h"
|
||||
#include "gskvulkancolortextpipelineprivate.h"
|
||||
#include "gskvulkancrossfadeopprivate.h"
|
||||
#include "gskvulkaninsetshadowopprivate.h"
|
||||
#include "gskvulkanlineargradientpipelineprivate.h"
|
||||
#include "gskvulkanopprivate.h"
|
||||
#include "gskvulkanrendererprivate.h"
|
||||
#include "gskvulkantextpipelineprivate.h"
|
||||
#include "gskvulkanimageprivate.h"
|
||||
#include "gskvulkanoffscreenopprivate.h"
|
||||
#include "gskvulkanoutsetshadowopprivate.h"
|
||||
#include "gskvulkanpushconstantsprivate.h"
|
||||
#include "gskvulkanscissoropprivate.h"
|
||||
#include "gskvulkantextureopprivate.h"
|
||||
@ -55,8 +56,6 @@ typedef enum {
|
||||
GSK_VULKAN_OP_LINEAR_GRADIENT,
|
||||
GSK_VULKAN_OP_BLUR,
|
||||
GSK_VULKAN_OP_BORDER,
|
||||
GSK_VULKAN_OP_INSET_SHADOW,
|
||||
GSK_VULKAN_OP_OUTSET_SHADOW,
|
||||
/* GskVulkanOpText */
|
||||
GSK_VULKAN_OP_TEXT,
|
||||
GSK_VULKAN_OP_COLOR_TEXT,
|
||||
@ -661,24 +660,18 @@ gsk_vulkan_render_pass_add_inset_shadow_node (GskVulkanRenderPass *self,
|
||||
const GskVulkanParseState *state,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
GskVulkanPipelineType pipeline_type;
|
||||
GskVulkanOpRender op = {
|
||||
.type = GSK_VULKAN_OP_INSET_SHADOW,
|
||||
.node = node,
|
||||
.offset = state->offset,
|
||||
};
|
||||
|
||||
if (gsk_inset_shadow_node_get_blur_radius (node) > 0)
|
||||
FALLBACK ("Blur support not implemented for inset shadows");
|
||||
else if (gsk_vulkan_clip_contains_rect (&state->clip, &state->offset, &node->bounds))
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_INSET_SHADOW;
|
||||
else if (state->clip.type == GSK_VULKAN_CLIP_RECT)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_INSET_SHADOW_CLIP;
|
||||
else
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_INSET_SHADOW_CLIP_ROUNDED;
|
||||
|
||||
op.pipeline = gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type);
|
||||
gsk_vulkan_render_pass_add_op (self, (GskVulkanOp *) &op);
|
||||
gsk_vulkan_inset_shadow_op (self,
|
||||
gsk_vulkan_clip_get_clip_type (&state->clip, &state->offset, &node->bounds),
|
||||
gsk_inset_shadow_node_get_outline (node),
|
||||
&state->offset,
|
||||
gsk_inset_shadow_node_get_color (node),
|
||||
&GRAPHENE_POINT_INIT (gsk_inset_shadow_node_get_dx (node),
|
||||
gsk_inset_shadow_node_get_dy (node)),
|
||||
gsk_inset_shadow_node_get_spread (node),
|
||||
gsk_inset_shadow_node_get_blur_radius (node));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -689,24 +682,18 @@ gsk_vulkan_render_pass_add_outset_shadow_node (GskVulkanRenderPass *self,
|
||||
const GskVulkanParseState *state,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
GskVulkanPipelineType pipeline_type;
|
||||
GskVulkanOpRender op = {
|
||||
.type = GSK_VULKAN_OP_OUTSET_SHADOW,
|
||||
.node = node,
|
||||
.offset = state->offset,
|
||||
};
|
||||
|
||||
if (gsk_outset_shadow_node_get_blur_radius (node) > 0)
|
||||
FALLBACK ("Blur support not implemented for outset shadows");
|
||||
else if (gsk_vulkan_clip_contains_rect (&state->clip, &state->offset, &node->bounds))
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_OUTSET_SHADOW;
|
||||
else if (state->clip.type == GSK_VULKAN_CLIP_RECT)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_OUTSET_SHADOW_CLIP;
|
||||
else
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_OUTSET_SHADOW_CLIP_ROUNDED;
|
||||
|
||||
op.pipeline = gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type);
|
||||
gsk_vulkan_render_pass_add_op (self, (GskVulkanOp *) &op);
|
||||
gsk_vulkan_outset_shadow_op (self,
|
||||
gsk_vulkan_clip_get_clip_type (&state->clip, &state->offset, &node->bounds),
|
||||
gsk_outset_shadow_node_get_outline (node),
|
||||
&state->offset,
|
||||
gsk_outset_shadow_node_get_color (node),
|
||||
&GRAPHENE_POINT_INIT (gsk_outset_shadow_node_get_dx (node),
|
||||
gsk_outset_shadow_node_get_dy (node)),
|
||||
gsk_outset_shadow_node_get_spread (node),
|
||||
gsk_outset_shadow_node_get_blur_radius (node));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -1703,8 +1690,6 @@ gsk_vulkan_render_op_upload (GskVulkanOp *op_,
|
||||
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
|
||||
case GSK_VULKAN_OP_LINEAR_GRADIENT:
|
||||
case GSK_VULKAN_OP_BORDER:
|
||||
case GSK_VULKAN_OP_INSET_SHADOW:
|
||||
case GSK_VULKAN_OP_OUTSET_SHADOW:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1739,8 +1724,6 @@ gsk_vulkan_render_op_count_vertex_data (GskVulkanOp *op_,
|
||||
case GSK_VULKAN_OP_LINEAR_GRADIENT:
|
||||
case GSK_VULKAN_OP_BLUR:
|
||||
case GSK_VULKAN_OP_BORDER:
|
||||
case GSK_VULKAN_OP_INSET_SHADOW:
|
||||
case GSK_VULKAN_OP_OUTSET_SHADOW:
|
||||
vertex_stride = gsk_vulkan_pipeline_get_vertex_stride (op->render.pipeline);
|
||||
n_bytes = round_up (n_bytes, vertex_stride);
|
||||
op->render.vertex_offset = n_bytes;
|
||||
@ -1859,30 +1842,6 @@ gsk_vulkan_render_op_collect_vertex_data (GskVulkanOp *op_,
|
||||
gsk_border_node_get_colors (op->render.node));
|
||||
break;
|
||||
|
||||
case GSK_VULKAN_OP_INSET_SHADOW:
|
||||
gsk_vulkan_box_shadow_pipeline_collect_vertex_data (GSK_VULKAN_BOX_SHADOW_PIPELINE (op->render.pipeline),
|
||||
data + op->render.vertex_offset,
|
||||
&op->render.offset,
|
||||
gsk_inset_shadow_node_get_outline (op->render.node),
|
||||
gsk_inset_shadow_node_get_color (op->render.node),
|
||||
gsk_inset_shadow_node_get_dx (op->render.node),
|
||||
gsk_inset_shadow_node_get_dy (op->render.node),
|
||||
gsk_inset_shadow_node_get_spread (op->render.node),
|
||||
gsk_inset_shadow_node_get_blur_radius (op->render.node));
|
||||
break;
|
||||
|
||||
case GSK_VULKAN_OP_OUTSET_SHADOW:
|
||||
gsk_vulkan_box_shadow_pipeline_collect_vertex_data (GSK_VULKAN_BOX_SHADOW_PIPELINE (op->render.pipeline),
|
||||
data + op->render.vertex_offset,
|
||||
&op->render.offset,
|
||||
gsk_outset_shadow_node_get_outline (op->render.node),
|
||||
gsk_outset_shadow_node_get_color (op->render.node),
|
||||
gsk_outset_shadow_node_get_dx (op->render.node),
|
||||
gsk_outset_shadow_node_get_dy (op->render.node),
|
||||
gsk_outset_shadow_node_get_spread (op->render.node),
|
||||
gsk_outset_shadow_node_get_blur_radius (op->render.node));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
|
||||
@ -1986,8 +1945,6 @@ gsk_vulkan_render_op_reserve_descriptor_sets (GskVulkanOp *op_,
|
||||
g_assert_not_reached ();
|
||||
|
||||
case GSK_VULKAN_OP_BORDER:
|
||||
case GSK_VULKAN_OP_INSET_SHADOW:
|
||||
case GSK_VULKAN_OP_OUTSET_SHADOW:
|
||||
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
|
||||
break;
|
||||
}
|
||||
@ -2054,8 +2011,6 @@ gsk_vulkan_render_op_get_pipeline (GskVulkanOp *op_)
|
||||
case GSK_VULKAN_OP_LINEAR_GRADIENT:
|
||||
case GSK_VULKAN_OP_BLUR:
|
||||
case GSK_VULKAN_OP_BORDER:
|
||||
case GSK_VULKAN_OP_INSET_SHADOW:
|
||||
case GSK_VULKAN_OP_OUTSET_SHADOW:
|
||||
return gsk_vulkan_pipeline_get_pipeline (op->render.pipeline);
|
||||
|
||||
case GSK_VULKAN_OP_TEXT:
|
||||
@ -2118,14 +2073,6 @@ gsk_vulkan_render_op_command (GskVulkanOp *op_,
|
||||
1);
|
||||
break;
|
||||
|
||||
case GSK_VULKAN_OP_INSET_SHADOW:
|
||||
case GSK_VULKAN_OP_OUTSET_SHADOW:
|
||||
gsk_vulkan_box_shadow_pipeline_draw (GSK_VULKAN_BOX_SHADOW_PIPELINE (op->render.pipeline),
|
||||
command_buffer,
|
||||
op->render.vertex_offset / gsk_vulkan_pipeline_get_vertex_stride (op->render.pipeline),
|
||||
1);
|
||||
break;
|
||||
|
||||
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
|
||||
gsk_vulkan_push_constants_push (command_buffer,
|
||||
pipeline_layout,
|
||||
|
@ -17,12 +17,6 @@ typedef enum {
|
||||
GSK_VULKAN_PIPELINE_BORDER,
|
||||
GSK_VULKAN_PIPELINE_BORDER_CLIP,
|
||||
GSK_VULKAN_PIPELINE_BORDER_CLIP_ROUNDED,
|
||||
GSK_VULKAN_PIPELINE_INSET_SHADOW,
|
||||
GSK_VULKAN_PIPELINE_INSET_SHADOW_CLIP,
|
||||
GSK_VULKAN_PIPELINE_INSET_SHADOW_CLIP_ROUNDED,
|
||||
GSK_VULKAN_PIPELINE_OUTSET_SHADOW,
|
||||
GSK_VULKAN_PIPELINE_OUTSET_SHADOW_CLIP,
|
||||
GSK_VULKAN_PIPELINE_OUTSET_SHADOW_CLIP_ROUNDED,
|
||||
GSK_VULKAN_PIPELINE_BLUR,
|
||||
GSK_VULKAN_PIPELINE_BLUR_CLIP,
|
||||
GSK_VULKAN_PIPELINE_BLUR_CLIP_ROUNDED,
|
||||
|
Loading…
Reference in New Issue
Block a user