| 1 | /* |
| 2 | * GStreamer |
| 3 | * Copyright (C) 2019 Matthew Waters <[email protected]> |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Library General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Library General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Library General Public |
| 16 | * License along with this library; if not, write to the |
| 17 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 18 | * Boston, MA 02110-1301, USA. |
| 19 | */ |
| 20 | |
| 21 | #ifndef __GST_VULKAN_DESCRIPTOR_SET_H__ |
| 22 | #define __GST_VULKAN_DESCRIPTOR_SET_H__ |
| 23 | |
| 24 | #include <gst/gst.h> |
| 25 | |
| 26 | #include <gst/vulkan/vulkan_fwd.h> |
| 27 | #include <gst/vulkan/gstvkapi.h> |
| 28 | |
| 29 | G_BEGIN_DECLS |
| 30 | |
| 31 | /** |
| 32 | * gst_vulkan_descriptor_set_get_type: |
| 33 | * |
| 34 | * Since: 1.18 |
| 35 | */ |
| 36 | GST_VULKAN_API |
| 37 | GType gst_vulkan_descriptor_set_get_type (void); |
| 38 | /** |
| 39 | * GST_TYPE_VULKAN_DESCRIPTOR_SET: |
| 40 | * |
| 41 | * Since: 1.18 |
| 42 | */ |
| 43 | #define GST_TYPE_VULKAN_DESCRIPTOR_SET (gst_vulkan_descriptor_set_get_type ()) |
| 44 | |
| 45 | typedef struct _GstVulkanDescriptorSet GstVulkanDescriptorSet; |
| 46 | |
| 47 | /** |
| 48 | * GstVulkanDescriptorSet: |
| 49 | * @parent: the parent #GstMiniObject |
| 50 | * @set: the vulkan descriptor set handle |
| 51 | * @pool: the parent #GstVulkanDescriptorPool for pooling |
| 52 | * @cache: the parent #GstVulkanDescriptorCache for reuse |
| 53 | * @n_layouts: number of layouts applied to this descriptor set |
| 54 | * @layouts: layouts applied to this descriptor set |
| 55 | * |
| 56 | * Since: 1.18 |
| 57 | */ |
| 58 | struct _GstVulkanDescriptorSet |
| 59 | { |
| 60 | GstMiniObject parent; |
| 61 | |
| 62 | VkDescriptorSet set; |
| 63 | |
| 64 | /* <protected> */ |
| 65 | GstVulkanDescriptorPool *pool; |
| 66 | GstVulkanDescriptorCache *cache; |
| 67 | |
| 68 | guint n_layouts; |
| 69 | GstVulkanHandle **layouts; |
| 70 | |
| 71 | /* <private> */ |
| 72 | gpointer _reserved [GST_PADDING]; |
| 73 | }; |
| 74 | |
| 75 | /** |
| 76 | * gst_vulkan_descriptor_set_ref: (skip) |
| 77 | * @set: a #GstVulkanDescriptorSet. |
| 78 | * |
| 79 | * Increases the refcount of the given buffer by one. |
| 80 | * |
| 81 | * Returns: (transfer full): @set |
| 82 | * |
| 83 | * Since: 1.18 |
| 84 | */ |
| 85 | static inline GstVulkanDescriptorSet* gst_vulkan_descriptor_set_ref(GstVulkanDescriptorSet* set); |
| 86 | static inline GstVulkanDescriptorSet * |
| 87 | gst_vulkan_descriptor_set_ref (GstVulkanDescriptorSet * set) |
| 88 | { |
| 89 | return (GstVulkanDescriptorSet *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (set)); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * gst_vulkan_descriptor_set_unref: (skip) |
| 94 | * @set: (transfer full): a #GstVulkanDescriptorSet. |
| 95 | * |
| 96 | * Decreases the refcount of the buffer. If the refcount reaches 0, the buffer |
| 97 | * will be freed. |
| 98 | * |
| 99 | * Since: 1.18 |
| 100 | */ |
| 101 | static inline void gst_vulkan_descriptor_set_unref(GstVulkanDescriptorSet* set); |
| 102 | static inline void |
| 103 | gst_vulkan_descriptor_set_unref (GstVulkanDescriptorSet * set) |
| 104 | { |
| 105 | gst_mini_object_unref (GST_MINI_OBJECT_CAST (set)); |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * gst_clear_vulkan_descriptor_set: (skip) |
| 110 | * @set_ptr: a pointer to a #GstVulkanDescriptorSet reference |
| 111 | * |
| 112 | * Clears a reference to a #GstVulkanDescriptorSet. |
| 113 | * |
| 114 | * @set_ptr must not be %NULL. |
| 115 | * |
| 116 | * If the reference is %NULL then this function does nothing. Otherwise, the |
| 117 | * reference count of the descriptor set is decreased and the pointer is set |
| 118 | * to %NULL. |
| 119 | * |
| 120 | * Since: 1.18 |
| 121 | */ |
| 122 | static inline void |
| 123 | gst_clear_vulkan_descriptor_set (GstVulkanDescriptorSet ** set_ptr) |
| 124 | { |
| 125 | gst_clear_mini_object ((GstMiniObject **) set_ptr); |
| 126 | } |
| 127 | |
| 128 | GST_VULKAN_API |
| 129 | GstVulkanDescriptorSet * gst_vulkan_descriptor_set_new_wrapped (GstVulkanDescriptorPool * pool, |
| 130 | VkDescriptorSet set, |
| 131 | guint n_layouts, |
| 132 | GstVulkanHandle ** layouts) G_GNUC_WARN_UNUSED_RESULT; |
| 133 | |
| 134 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVulkanDescriptorSet, gst_vulkan_descriptor_set_unref); |
| 135 | |
| 136 | G_END_DECLS |
| 137 | |
| 138 | #endif /* _GST_VULKAN_DESCRIPTOR_SET_H_ */ |