2023-08-12 20:10:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "gskgpurenderer.h"
|
|
|
|
#include "gskgputypesprivate.h"
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GSK_TYPE_GPU_FRAME (gsk_gpu_frame_get_type ())
|
|
|
|
#define GSK_GPU_FRAME(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSK_TYPE_GPU_FRAME, GskGpuFrame))
|
|
|
|
#define GSK_GPU_FRAME_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSK_TYPE_GPU_FRAME, GskGpuFrameClass))
|
|
|
|
#define GSK_IS_GPU_FRAME(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSK_TYPE_GPU_FRAME))
|
|
|
|
#define GSK_IS_GPU_FRAME_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSK_TYPE_GPU_FRAME))
|
|
|
|
#define GSK_GPU_FRAME_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSK_TYPE_GPU_FRAME, GskGpuFrameClass))
|
|
|
|
|
|
|
|
typedef struct _GskGpuFrameClass GskGpuFrameClass;
|
|
|
|
|
|
|
|
struct _GskGpuFrame
|
|
|
|
{
|
|
|
|
GObject parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GskGpuFrameClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
gboolean (* is_busy) (GskGpuFrame *self);
|
|
|
|
void (* setup) (GskGpuFrame *self);
|
|
|
|
void (* cleanup) (GskGpuFrame *self);
|
2023-10-15 00:11:13 +00:00
|
|
|
GskGpuImage * (* upload_texture) (GskGpuFrame *self,
|
2023-11-01 05:43:15 +00:00
|
|
|
gboolean with_mipmap,
|
2023-10-15 00:11:13 +00:00
|
|
|
GdkTexture *texture);
|
2023-10-03 19:04:21 +00:00
|
|
|
GskGpuDescriptors * (* create_descriptors) (GskGpuFrame *self);
|
2023-08-21 00:18:37 +00:00
|
|
|
GskGpuBuffer * (* create_vertex_buffer) (GskGpuFrame *self,
|
|
|
|
gsize size);
|
2023-08-30 19:57:41 +00:00
|
|
|
GskGpuBuffer * (* create_storage_buffer) (GskGpuFrame *self,
|
|
|
|
gsize size);
|
2023-08-12 20:10:16 +00:00
|
|
|
void (* submit) (GskGpuFrame *self,
|
2023-08-21 00:18:37 +00:00
|
|
|
GskGpuBuffer *vertex_buffer,
|
2023-08-12 20:10:16 +00:00
|
|
|
GskGpuOp *op);
|
|
|
|
};
|
|
|
|
|
|
|
|
GType gsk_gpu_frame_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
|
|
|
|
void gsk_gpu_frame_setup (GskGpuFrame *self,
|
|
|
|
GskGpuRenderer *renderer,
|
2023-09-23 03:03:13 +00:00
|
|
|
GskGpuDevice *device,
|
|
|
|
GskGpuOptimizations optimizations);
|
2023-08-12 20:10:16 +00:00
|
|
|
|
2023-08-21 00:18:37 +00:00
|
|
|
GdkDrawContext * gsk_gpu_frame_get_context (GskGpuFrame *self) G_GNUC_PURE;
|
|
|
|
GskGpuDevice * gsk_gpu_frame_get_device (GskGpuFrame *self) G_GNUC_PURE;
|
2023-09-01 10:13:51 +00:00
|
|
|
gint64 gsk_gpu_frame_get_timestamp (GskGpuFrame *self) G_GNUC_PURE;
|
2023-09-23 03:03:13 +00:00
|
|
|
gboolean gsk_gpu_frame_should_optimize (GskGpuFrame *self,
|
|
|
|
GskGpuOptimizations optimization) G_GNUC_PURE;
|
2023-08-12 20:10:16 +00:00
|
|
|
|
|
|
|
gpointer gsk_gpu_frame_alloc_op (GskGpuFrame *self,
|
|
|
|
gsize size);
|
2023-10-15 00:11:13 +00:00
|
|
|
GskGpuImage * gsk_gpu_frame_upload_texture (GskGpuFrame *self,
|
2023-11-01 05:43:15 +00:00
|
|
|
gboolean with_mipmap,
|
2023-10-15 00:11:13 +00:00
|
|
|
GdkTexture *texture);
|
2023-10-03 19:04:21 +00:00
|
|
|
GskGpuDescriptors * gsk_gpu_frame_create_descriptors (GskGpuFrame *self);
|
2023-08-21 00:18:37 +00:00
|
|
|
gsize gsk_gpu_frame_reserve_vertex_data (GskGpuFrame *self,
|
|
|
|
gsize size);
|
|
|
|
guchar * gsk_gpu_frame_get_vertex_data (GskGpuFrame *self,
|
|
|
|
gsize offset);
|
2023-11-19 14:27:10 +00:00
|
|
|
GskGpuBuffer * gsk_gpu_frame_write_storage_buffer (GskGpuFrame *self,
|
|
|
|
const guchar *data,
|
|
|
|
gsize size,
|
|
|
|
gsize *out_offset);
|
2023-08-12 20:10:16 +00:00
|
|
|
|
|
|
|
gboolean gsk_gpu_frame_is_busy (GskGpuFrame *self);
|
|
|
|
|
|
|
|
void gsk_gpu_frame_render (GskGpuFrame *self,
|
2023-09-01 10:13:51 +00:00
|
|
|
gint64 timestamp,
|
2023-08-12 20:10:16 +00:00
|
|
|
GskGpuImage *target,
|
|
|
|
const cairo_region_t *region,
|
|
|
|
GskRenderNode *node,
|
|
|
|
const graphene_rect_t *viewport,
|
|
|
|
GdkTexture **texture);
|
|
|
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskGpuFrame, g_object_unref)
|
|
|
|
|
|
|
|
G_END_DECLS
|