2023-08-21 00:18:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "gskgpuopprivate.h"
|
|
|
|
|
|
|
|
#include "gskgputypesprivate.h"
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
struct _GskGpuShaderOp
|
|
|
|
{
|
|
|
|
GskGpuOp parent_op;
|
|
|
|
|
2023-10-03 19:04:21 +00:00
|
|
|
GskGpuDescriptors *desc;
|
2023-08-21 00:18:37 +00:00
|
|
|
GskGpuShaderClip clip;
|
|
|
|
gsize vertex_offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GskGpuShaderOpClass
|
|
|
|
{
|
|
|
|
GskGpuOpClass parent_class;
|
|
|
|
|
|
|
|
const char * shader_name;
|
|
|
|
gsize vertex_size;
|
|
|
|
#ifdef GDK_RENDERING_VULKAN
|
|
|
|
const VkPipelineVertexInputStateCreateInfo *vertex_input_state;
|
|
|
|
#endif
|
|
|
|
void (* setup_vao) (gsize offset);
|
|
|
|
};
|
|
|
|
|
|
|
|
GskGpuShaderOp * gsk_gpu_shader_op_alloc (GskGpuFrame *frame,
|
|
|
|
const GskGpuShaderOpClass *op_class,
|
|
|
|
GskGpuShaderClip clip,
|
2023-10-03 19:04:21 +00:00
|
|
|
GskGpuDescriptors *desc,
|
2023-08-21 00:18:37 +00:00
|
|
|
gpointer out_vertex_data);
|
|
|
|
|
2023-10-03 19:04:21 +00:00
|
|
|
void gsk_gpu_shader_op_finish (GskGpuOp *op);
|
|
|
|
|
2023-08-21 00:18:37 +00:00
|
|
|
#ifdef GDK_RENDERING_VULKAN
|
|
|
|
GskGpuOp * gsk_gpu_shader_op_vk_command_n (GskGpuOp *op,
|
|
|
|
GskGpuFrame *frame,
|
2023-11-04 02:57:38 +00:00
|
|
|
GskVulkanCommandState *state,
|
2023-08-21 00:18:37 +00:00
|
|
|
gsize instance_scale);
|
|
|
|
GskGpuOp * gsk_gpu_shader_op_vk_command (GskGpuOp *op,
|
|
|
|
GskGpuFrame *frame,
|
2023-11-04 02:57:38 +00:00
|
|
|
GskVulkanCommandState *state);
|
2023-08-21 00:18:37 +00:00
|
|
|
#endif
|
|
|
|
GskGpuOp * gsk_gpu_shader_op_gl_command_n (GskGpuOp *op,
|
|
|
|
GskGpuFrame *frame,
|
2023-11-04 02:57:38 +00:00
|
|
|
GskGLCommandState *state,
|
2023-08-21 00:18:37 +00:00
|
|
|
gsize instance_scale);
|
|
|
|
GskGpuOp * gsk_gpu_shader_op_gl_command (GskGpuOp *op,
|
2023-08-29 06:34:55 +00:00
|
|
|
GskGpuFrame *frame,
|
2023-11-04 02:57:38 +00:00
|
|
|
GskGLCommandState *state);
|
2023-08-21 00:18:37 +00:00
|
|
|
|
2023-09-10 21:19:42 +00:00
|
|
|
static inline void
|
|
|
|
gsk_gpu_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;
|
|
|
|
}
|
|
|
|
|
2023-12-25 04:02:51 +00:00
|
|
|
#include <graphene.h>
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
gsk_gpu_point_to_float (const graphene_point_t *point,
|
|
|
|
const graphene_point_t *offset,
|
|
|
|
float values[2])
|
|
|
|
{
|
|
|
|
values[0] = point->x + offset->x;
|
|
|
|
values[1] = point->y + offset->y;
|
|
|
|
}
|
|
|
|
|
2023-08-21 00:18:37 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|