2023-03-31 19:11:10 +00:00
|
|
|
#pragma once
|
2016-12-06 13:42:46 +00:00
|
|
|
|
|
|
|
#include <gdk/gdk.h>
|
2023-06-15 21:17:40 +00:00
|
|
|
#include <gsk/gskrendernode.h>
|
2016-12-06 13:42:46 +00:00
|
|
|
|
2023-06-15 12:29:15 +00:00
|
|
|
#include "gskvulkanbufferprivate.h"
|
2018-01-06 14:36:55 +00:00
|
|
|
#include "gskvulkancommandpoolprivate.h"
|
2016-12-16 05:10:24 +00:00
|
|
|
|
2023-06-15 21:17:40 +00:00
|
|
|
|
2016-12-06 13:42:46 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2016-12-17 03:22:44 +00:00
|
|
|
typedef struct _GskVulkanUploader GskVulkanUploader;
|
|
|
|
|
2016-12-08 19:19:56 +00:00
|
|
|
#define GSK_TYPE_VULKAN_IMAGE (gsk_vulkan_image_get_type ())
|
|
|
|
|
|
|
|
G_DECLARE_FINAL_TYPE (GskVulkanImage, gsk_vulkan_image, GSK, VULKAN_IMAGE, GObject)
|
2016-12-06 13:42:46 +00:00
|
|
|
|
2016-12-17 03:22:44 +00:00
|
|
|
GskVulkanUploader * gsk_vulkan_uploader_new (GdkVulkanContext *context,
|
|
|
|
GskVulkanCommandPool *command_pool);
|
|
|
|
void gsk_vulkan_uploader_free (GskVulkanUploader *self);
|
|
|
|
|
|
|
|
void gsk_vulkan_uploader_reset (GskVulkanUploader *self);
|
2016-12-17 03:54:19 +00:00
|
|
|
void gsk_vulkan_uploader_upload (GskVulkanUploader *self);
|
2016-12-17 03:22:44 +00:00
|
|
|
|
2023-06-15 21:17:40 +00:00
|
|
|
GdkMemoryFormat gsk_render_node_get_preferred_vulkan_format (GskRenderNode *node);
|
|
|
|
|
2016-12-08 20:14:41 +00:00
|
|
|
GskVulkanImage * gsk_vulkan_image_new_for_swapchain (GdkVulkanContext *context,
|
|
|
|
VkImage image,
|
|
|
|
VkFormat format,
|
|
|
|
gsize width,
|
|
|
|
gsize height);
|
2023-06-13 06:02:06 +00:00
|
|
|
GskVulkanImage * gsk_vulkan_image_new_from_texture (GskVulkanUploader *uploader,
|
|
|
|
GdkTexture *texture);
|
2017-09-21 17:42:57 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
guchar *data;
|
|
|
|
gsize width;
|
|
|
|
gsize height;
|
|
|
|
gsize stride;
|
|
|
|
gsize x;
|
|
|
|
gsize y;
|
|
|
|
} GskImageRegion;
|
|
|
|
|
|
|
|
void gsk_vulkan_image_upload_regions (GskVulkanImage *image,
|
|
|
|
GskVulkanUploader *uploader,
|
|
|
|
guint num_regions,
|
|
|
|
GskImageRegion *regions);
|
2017-09-20 23:11:42 +00:00
|
|
|
GskVulkanImage * gsk_vulkan_image_new_for_atlas (GdkVulkanContext *context,
|
|
|
|
gsize width,
|
|
|
|
gsize height);
|
2023-05-09 20:25:22 +00:00
|
|
|
GskVulkanImage * gsk_vulkan_image_new_for_offscreen (GdkVulkanContext *context,
|
2023-06-14 19:32:26 +00:00
|
|
|
GdkMemoryFormat preferred_format,
|
2017-09-26 23:12:20 +00:00
|
|
|
gsize width,
|
|
|
|
gsize height);
|
2016-12-22 18:01:07 +00:00
|
|
|
|
2017-11-02 20:39:00 +00:00
|
|
|
GdkTexture * gsk_vulkan_image_download (GskVulkanImage *self,
|
2016-12-22 18:01:07 +00:00
|
|
|
GskVulkanUploader *uploader);
|
2016-12-06 13:42:46 +00:00
|
|
|
|
2023-06-14 00:08:17 +00:00
|
|
|
typedef struct _GskVulkanImageMap GskVulkanImageMap;
|
|
|
|
|
|
|
|
struct _GskVulkanImageMap
|
|
|
|
{
|
|
|
|
guchar *data;
|
2023-06-15 12:29:15 +00:00
|
|
|
gsize stride;
|
|
|
|
GskVulkanMapMode mode;
|
2023-06-14 00:08:17 +00:00
|
|
|
|
|
|
|
/* private */
|
2023-06-15 12:29:15 +00:00
|
|
|
GskVulkanBuffer *staging_buffer;
|
2023-06-14 00:08:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GskVulkanImage * gsk_vulkan_image_new_for_upload (GskVulkanUploader *uploader,
|
2023-06-14 18:37:58 +00:00
|
|
|
GdkMemoryFormat format,
|
2023-06-14 00:08:17 +00:00
|
|
|
gsize width,
|
|
|
|
gsize height);
|
|
|
|
void gsk_vulkan_image_map_memory (GskVulkanImage *self,
|
|
|
|
GskVulkanUploader *uploader,
|
2023-06-15 12:29:15 +00:00
|
|
|
GskVulkanMapMode mode,
|
2023-06-14 00:08:17 +00:00
|
|
|
GskVulkanImageMap *map);
|
|
|
|
void gsk_vulkan_image_unmap_memory (GskVulkanImage *self,
|
|
|
|
GskVulkanUploader *uploader,
|
|
|
|
GskVulkanImageMap *map);
|
|
|
|
|
2016-12-08 19:46:02 +00:00
|
|
|
gsize gsk_vulkan_image_get_width (GskVulkanImage *self);
|
|
|
|
gsize gsk_vulkan_image_get_height (GskVulkanImage *self);
|
2016-12-06 13:42:46 +00:00
|
|
|
VkImage gsk_vulkan_image_get_image (GskVulkanImage *self);
|
|
|
|
VkImageView gsk_vulkan_image_get_image_view (GskVulkanImage *self);
|
2023-06-17 14:05:09 +00:00
|
|
|
VkFormat gsk_vulkan_image_get_vk_format (GskVulkanImage *self);
|
2016-12-06 13:42:46 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|