gulkan-texture

gulkan-texture

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GulkanTexture

Includes

#include <gulkan.h>

Description

Functions

gulkan_texture_new_mip_levels ()

GulkanTexture *
gulkan_texture_new_mip_levels (GulkanContext *context,
                               VkExtent2D extent,
                               guint mip_levels,
                               VkFormat format);

gulkan_texture_new ()

GulkanTexture *
gulkan_texture_new (GulkanContext *context,
                    VkExtent2D extent,
                    VkFormat format);

gulkan_texture_new_from_pixbuf ()

GulkanTexture *
gulkan_texture_new_from_pixbuf (GulkanContext *context,
                                GdkPixbuf *pixbuf,
                                VkFormat format,
                                VkImageLayout layout,
                                gboolean create_mipmaps);

gulkan_texture_new_from_resource ()

GulkanTexture *
gulkan_texture_new_from_resource (GulkanContext *context,
                                  const char *resource_path,
                                  VkImageLayout layout,
                                  gboolean create_mipmaps);

gulkan_texture_new_from_cairo_surface ()

GulkanTexture *
gulkan_texture_new_from_cairo_surface (GulkanContext *context,
                                       cairo_surface_t *surface,
                                       VkFormat format,
                                       VkImageLayout layout);

gulkan_texture_new_from_dmabuf ()

GulkanTexture *
gulkan_texture_new_from_dmabuf (GulkanContext *context,
                                int fd,
                                VkExtent2D extent,
                                VkFormat format);

gulkan_texture_new_from_dmabuf_attribs ()

GulkanTexture *
gulkan_texture_new_from_dmabuf_attribs
                               (GulkanContext *context,
                                struct GulkanDmabufAttributes *attribs);

gulkan_texture_new_export_fd ()

GulkanTexture *
gulkan_texture_new_export_fd (GulkanContext *context,
                              VkExtent2D extent,
                              VkFormat format,
                              VkImageLayout layout,
                              gsize *size,
                              int *fd);

Allocates a GulkanTexture and exports it via external memory to an fd and provides the size of the external memory.

based on code from https://github.com/lostgoat/ogl-samples/blob/master/tests/gl-450-culling.cpp https://gitlab.com/beVR_nz/VulkanIPC_Demo/

Parameters

context

a GulkanContext

 

extent

Extent in pixels

 

format

VkFormat of the texture

 

layout

VkImageLayout of the texture

 

size

Return value of allocated size.

[out]

fd

Return value for allocated fd.

[out]

Returns

the initialized GulkanTexture


gulkan_texture_record_transfer ()

void
gulkan_texture_record_transfer (GulkanTexture *self,
                                VkCommandBuffer cmd_buffer,
                                VkImageLayout src_layout,
                                VkImageLayout dst_layout);

gulkan_texture_record_transfer_full ()

void
gulkan_texture_record_transfer_full (GulkanTexture *self,
                                     VkCommandBuffer cmd_buffer,
                                     VkAccessFlags src_access_mask,
                                     VkAccessFlags dst_access_mask,
                                     VkImageLayout src_layout,
                                     VkImageLayout dst_layout,
                                     VkPipelineStageFlags src_stage_mask,
                                     VkPipelineStageFlags dst_stage_mask);

gulkan_texture_transfer_layout ()

gboolean
gulkan_texture_transfer_layout (GulkanTexture *self,
                                VkImageLayout src_layout,
                                VkImageLayout dst_layout);

gulkan_texture_transfer_layout_full ()

gboolean
gulkan_texture_transfer_layout_full (GulkanTexture *self,
                                     VkAccessFlags src_access_mask,
                                     VkAccessFlags dst_access_mask,
                                     VkImageLayout src_layout,
                                     VkImageLayout dst_layout,
                                     VkPipelineStageFlags src_stage_mask,
                                     VkPipelineStageFlags dst_stage_mask);

gulkan_texture_upload_pixels ()

gboolean
gulkan_texture_upload_pixels (GulkanTexture *self,
                              guchar *pixels,
                              gsize size,
                              VkImageLayout layout);

gulkan_texture_upload_pixels_region ()

gboolean
gulkan_texture_upload_pixels_region (GulkanTexture *self,
                                     guchar *region_pixels,
                                     gsize region_size,
                                     VkImageLayout layout,
                                     VkOffset2D offset,
                                     VkExtent2D extent);

gulkan_texture_upload_cairo_surface ()

gboolean
gulkan_texture_upload_cairo_surface (GulkanTexture *self,
                                     cairo_surface_t *surface,
                                     VkImageLayout layout);

gulkan_texture_upload_pixbuf ()

gboolean
gulkan_texture_upload_pixbuf (GulkanTexture *self,
                              GdkPixbuf *pixbuf,
                              VkImageLayout layout);

gulkan_texture_get_image_view ()

VkImageView
gulkan_texture_get_image_view (GulkanTexture *self);

Parameters

self

a GulkanTexture

 

Returns

a VkImageView.

[transfer none]


gulkan_texture_get_image ()

VkImage
gulkan_texture_get_image (GulkanTexture *self);

Parameters

self

a GulkanTexture

 

Returns

a VkImage.

[transfer none]


gulkan_texture_get_extent ()

VkExtent2D
gulkan_texture_get_extent (GulkanTexture *self);

Parameters

self

a GulkanTexture

 

Returns

a VkExtent2D.

[transfer none]


gulkan_texture_get_format ()

VkFormat
gulkan_texture_get_format (GulkanTexture *self);

Parameters

self

a GulkanTexture

 

Returns

a VkFormat.

[transfer none]


gulkan_texture_get_mip_levels ()

guint
gulkan_texture_get_mip_levels (GulkanTexture *self);

gulkan_texture_get_sampler ()

VkSampler
gulkan_texture_get_sampler (GulkanTexture *self);

gulkan_texture_init_sampler ()

gboolean
gulkan_texture_init_sampler (GulkanTexture *self,
                             VkFilter filter,
                             VkSamplerAddressMode address_mode);

gulkan_texture_get_descriptor_info ()

VkDescriptorImageInfo *
gulkan_texture_get_descriptor_info (GulkanTexture *self);

gulkan_texture_set_sampler ()

void
gulkan_texture_set_sampler (GulkanTexture *self,
                            VkSampler sampler);

Types and Values

GULKAN_DMABUF_MAX_PLANES

#define GULKAN_DMABUF_MAX_PLANES 4

struct GulkanDmabufAttributes

struct GulkanDmabufAttributes {
  int32_t  width;
  int32_t  height;
  uint32_t format;
  uint64_t modifier;

  int      n_planes;
  uint32_t offset[GULKAN_DMABUF_MAX_PLANES];
  uint32_t stride[GULKAN_DMABUF_MAX_PLANES];
  int      fd[GULKAN_DMABUF_MAX_PLANES];
};

Members

int32_t width;

Width

 

int32_t height;

Height

 

uint32_t format;

DRM format

 

uint64_t modifier;

dmabuf modifier

 

int n_planes;

Number of planes

 

uint32_t offset[GULKAN_DMABUF_MAX_PLANES];

Memory offset of plane N

 

uint32_t stride[GULKAN_DMABUF_MAX_PLANES];

Stride of plane N

 

int fd[GULKAN_DMABUF_MAX_PLANES];

File descriptor of plane N. Can be different file descriptors pointing at the same memory (Multi plane image where the planes are laid out next to each other and are accessed with offset rather than different memory per plane).

 

GULKAN_TYPE_TEXTURE

#define GULKAN_TYPE_TEXTURE gulkan_texture_get_type ()

GulkanTexture

typedef struct _GulkanTexture GulkanTexture;