2023-08-12 20:10:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "gskgpudeviceprivate.h"
|
|
|
|
|
|
|
|
#include "gskdebugprivate.h"
|
2023-08-21 00:18:37 +00:00
|
|
|
#include "gskgpuclipprivate.h"
|
2023-08-12 20:10:16 +00:00
|
|
|
#include "gskvulkanmemoryprivate.h"
|
|
|
|
|
2023-10-19 10:54:14 +00:00
|
|
|
#include "gdk/gdkdisplayprivate.h"
|
2024-01-07 08:39:21 +00:00
|
|
|
#include "gdk/gdkvulkancontextprivate.h"
|
2023-08-12 20:10:16 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2023-08-21 00:18:37 +00:00
|
|
|
/* also used by gskvulkanframe.c */
|
|
|
|
enum {
|
|
|
|
GSK_VULKAN_IMAGE_SET_LAYOUT,
|
|
|
|
GSK_VULKAN_BUFFER_SET_LAYOUT,
|
|
|
|
|
|
|
|
GSK_VULKAN_N_DESCRIPTOR_SETS
|
|
|
|
};
|
|
|
|
|
2023-08-12 20:10:16 +00:00
|
|
|
#define GSK_TYPE_VULKAN_DEVICE (gsk_vulkan_device_get_type ())
|
|
|
|
|
|
|
|
G_DECLARE_FINAL_TYPE(GskVulkanDevice, gsk_vulkan_device, GSK, VULKAN_DEVICE, GskGpuDevice)
|
|
|
|
|
2023-10-19 05:43:31 +00:00
|
|
|
typedef struct _GskVulkanPipelineLayout GskVulkanPipelineLayout;
|
|
|
|
|
2023-08-12 20:10:16 +00:00
|
|
|
GskGpuDevice * gsk_vulkan_device_get_for_display (GdkDisplay *display,
|
|
|
|
GError **error);
|
|
|
|
|
2023-11-03 01:48:06 +00:00
|
|
|
gsize gsk_vulkan_device_get_max_immutable_samplers (GskVulkanDevice *self);
|
|
|
|
gsize gsk_vulkan_device_get_max_samplers (GskVulkanDevice *self);
|
|
|
|
gsize gsk_vulkan_device_get_max_buffers (GskVulkanDevice *self);
|
2023-10-19 10:54:14 +00:00
|
|
|
gboolean gsk_vulkan_device_has_feature (GskVulkanDevice *self,
|
|
|
|
GdkVulkanFeatures feature) G_GNUC_PURE;
|
2023-08-21 00:18:37 +00:00
|
|
|
|
|
|
|
VkDevice gsk_vulkan_device_get_vk_device (GskVulkanDevice *self) G_GNUC_PURE;
|
|
|
|
VkPhysicalDevice gsk_vulkan_device_get_vk_physical_device (GskVulkanDevice *self) G_GNUC_PURE;
|
|
|
|
VkQueue gsk_vulkan_device_get_vk_queue (GskVulkanDevice *self) G_GNUC_PURE;
|
2023-10-19 11:36:15 +00:00
|
|
|
uint32_t gsk_vulkan_device_get_vk_queue_family_index (GskVulkanDevice *self) G_GNUC_PURE;
|
2023-08-21 00:18:37 +00:00
|
|
|
VkCommandPool gsk_vulkan_device_get_vk_command_pool (GskVulkanDevice *self) G_GNUC_PURE;
|
|
|
|
VkSampler gsk_vulkan_device_get_vk_sampler (GskVulkanDevice *self,
|
|
|
|
GskGpuSampler sampler) G_GNUC_PURE;
|
|
|
|
|
2023-10-19 05:43:31 +00:00
|
|
|
GskVulkanPipelineLayout *
|
|
|
|
gsk_vulkan_device_acquire_pipeline_layout (GskVulkanDevice *self,
|
|
|
|
VkSampler *immutable_samplers,
|
2023-11-03 00:59:24 +00:00
|
|
|
gsize n_immutable_samplers,
|
|
|
|
gsize n_samplers,
|
|
|
|
gsize n_buffers);
|
2023-10-19 05:43:31 +00:00
|
|
|
void gsk_vulkan_device_release_pipeline_layout (GskVulkanDevice *self,
|
|
|
|
GskVulkanPipelineLayout*layout);
|
2023-11-04 18:38:21 +00:00
|
|
|
void gsk_vulkan_device_get_pipeline_sizes (GskVulkanDevice *self,
|
|
|
|
GskVulkanPipelineLayout*layout,
|
|
|
|
gsize *n_immutable_samplers,
|
|
|
|
gsize *n_samplers,
|
|
|
|
gsize *n_buffers);
|
2023-10-19 05:43:31 +00:00
|
|
|
VkDescriptorSetLayout gsk_vulkan_device_get_vk_image_set_layout (GskVulkanDevice *self,
|
|
|
|
GskVulkanPipelineLayout*layout) G_GNUC_PURE;
|
2023-11-03 00:59:24 +00:00
|
|
|
VkDescriptorSetLayout gsk_vulkan_device_get_vk_buffer_set_layout (GskVulkanDevice *self,
|
|
|
|
GskVulkanPipelineLayout*layout) G_GNUC_PURE;
|
2023-10-19 05:43:31 +00:00
|
|
|
VkPipelineLayout gsk_vulkan_device_get_vk_pipeline_layout (GskVulkanDevice *self,
|
|
|
|
GskVulkanPipelineLayout*layout) G_GNUC_PURE;
|
|
|
|
|
2023-10-18 07:33:15 +00:00
|
|
|
VkSamplerYcbcrConversion
|
|
|
|
gsk_vulkan_device_get_vk_conversion (GskVulkanDevice *self,
|
|
|
|
VkFormat vk_format,
|
|
|
|
VkSampler *out_sampler);
|
2023-08-21 00:18:37 +00:00
|
|
|
VkRenderPass gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
|
|
|
|
VkFormat format,
|
|
|
|
VkImageLayout from_layout,
|
|
|
|
VkImageLayout to_layout);
|
|
|
|
VkPipeline gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
|
2023-10-19 05:43:31 +00:00
|
|
|
GskVulkanPipelineLayout*layout,
|
2023-08-21 00:18:37 +00:00
|
|
|
const GskGpuShaderOpClass *op_class,
|
2023-12-31 04:38:56 +00:00
|
|
|
guint32 variation,
|
2023-08-21 00:18:37 +00:00
|
|
|
GskGpuShaderClip clip,
|
2023-12-25 04:21:13 +00:00
|
|
|
GskGpuBlend blend,
|
2023-08-21 00:18:37 +00:00
|
|
|
VkFormat format,
|
|
|
|
VkRenderPass render_pass);
|
2023-08-12 20:10:16 +00:00
|
|
|
|
2023-10-19 08:58:06 +00:00
|
|
|
GskVulkanAllocator * gsk_vulkan_device_get_external_allocator (GskVulkanDevice *self);
|
2023-08-12 20:10:16 +00:00
|
|
|
GskVulkanAllocator * gsk_vulkan_device_find_allocator (GskVulkanDevice *self,
|
|
|
|
uint32_t allowed_types,
|
|
|
|
VkMemoryPropertyFlags required_flags,
|
|
|
|
VkMemoryPropertyFlags desired_flags);
|
|
|
|
static inline VkResult
|
|
|
|
gsk_vulkan_handle_result (VkResult res,
|
|
|
|
const char *called_function)
|
|
|
|
{
|
|
|
|
if (res != VK_SUCCESS)
|
|
|
|
{
|
|
|
|
GSK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GSK_VK_CHECK(func, ...) gsk_vulkan_handle_result (func (__VA_ARGS__), G_STRINGIFY (func))
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|