fixes in image structs and functions
[vkrt] / src / vk.h
index ff5c025..259240b 100644 (file)
--- a/src/vk.h
+++ b/src/vk.h
@@ -21,12 +21,6 @@ struct vk_ctx
     uint8_t driverUUID[VK_UUID_SIZE];
 };
 
-struct vk_swap_image_obj
-{
-    VkImage image;
-    VkImageView image_view;
-};
-
 struct vk_swapchain
 {
     VkSwapchainKHR swapchain;
@@ -38,7 +32,7 @@ struct vk_swapchain
     VkExtent2D extent2d;
 
     uint32_t num_images;
-    struct vk_swap_image_obj *images;
+    struct vk_image_obj *images;
 };
 
 struct vk_image_props
@@ -75,7 +69,7 @@ struct vk_image_obj {
     struct vk_mem_obj mobj;
 };
 
-struct vk_image_att {
+struct vk_image_attachment {
     struct vk_image_obj obj;
     struct vk_image_props props;
 };
@@ -135,25 +129,25 @@ vk_destroy_image(struct vk_ctx *ctx,
                  struct vk_image_obj *img_obj);
 
 bool
-vk_fill_ext_image_props(struct vk_ctx *ctx,
-                        uint32_t w, uint32_t h,
-                        uint32_t depth,
-                        uint32_t num_samples,
-                        uint32_t num_levels,
-                        uint32_t num_layers,
-                        VkFormat format,
-                        VkImageTiling tiling,
-                        VkImageLayout in_layout,
-                        VkImageLayout end_layout,
-                        bool need_export,
-                        struct vk_image_props *props);
+vk_fill_image_props(struct vk_ctx *ctx,
+                    uint32_t w, uint32_t h,
+                    uint32_t depth,
+                    uint32_t num_samples,
+                    uint32_t num_levels,
+                    uint32_t num_layers,
+                    VkFormat format,
+                    VkImageTiling tiling,
+                    VkImageLayout in_layout,
+                    VkImageLayout end_layout,
+                    bool need_export,
+                    struct vk_image_props *props);
 
 bool
 vk_create_attachment_from_swapchain_image(struct vk_ctx *ctx,
                                           VkImage *swapchain_img,
                                           VkImageView *swapchain_view,
                                           struct vk_image_props *swapchain_props,
-                                          struct vk_image_att *color_att);
+                                          struct vk_image_attachment *color_att);
 
 /* buffers */
 
@@ -180,7 +174,7 @@ vk_create_ext_buffer(struct vk_ctx *ctx,
                      struct vk_buf *bo);
 
 
-/* semaphores */
+/* semaphores and fences */
 
 bool
 vk_create_semaphores(struct vk_ctx *ctx,
@@ -190,6 +184,17 @@ void
 vk_destroy_semaphores(struct vk_ctx *ctx,
                       struct vk_semaphores *semaphores);
 
+bool
+vk_create_fences(struct vk_ctx *ctx,
+                 int num_cmd_buf,
+                 VkFenceCreateFlagBits flags,
+                 VkFence *fences);
+
+void
+vk_destroy_fences(struct vk_ctx *ctc,
+                  int num_fences,
+                  VkFence *fences);
+
 /* renderer */
 
 bool
@@ -200,8 +205,8 @@ vk_create_renderer(struct vk_ctx *ctx,
                    unsigned int fs_size,
                    bool enable_depth,
                    bool enable_stencil,
-                   struct vk_image_att *color_att,
-                   struct vk_image_att *depth_att,
+                   struct vk_image_attachment *color_att,
+                   struct vk_image_attachment *depth_att,
                    struct vk_vertex_info *vert_info,
                    struct vk_renderer *renderer);
 
@@ -218,7 +223,7 @@ vk_draw(struct vk_ctx *ctx,
         float *vk_fb_color,
         uint32_t vk_fb_color_count,
         struct vk_semaphores *semaphores,
-        struct vk_image_att *attachments,
+        struct vk_image_attachment *attachments,
         uint32_t n_attachments,
         float x, float y, float w, float h);
 
@@ -230,7 +235,7 @@ vk_clear_color(struct vk_ctx *ctx,
                uint32_t vk_fb_color_count,
                struct vk_semaphores *semaphores,
                bool has_wait, bool has_signal,
-               struct vk_image_att *attachments,
+               struct vk_image_attachment *attachments,
                uint32_t n_attachments,
                float x, float y, float w, float h);
 
@@ -251,12 +256,12 @@ vk_destroy_swapchain(struct vk_ctx *ctx,
 
 void
 vk_copy_image_to_buffer(struct vk_ctx *ctx,
-                        struct vk_image_att *src_img,
+                        struct vk_image_attachment *src_img,
                         struct vk_buf *dst_bo,
                         float w, float h);
 
 void
-vk_transition_image_layout(struct vk_image_att *img_att,
+vk_transition_image_layout(struct vk_image_attachment *img_att,
                            VkCommandBuffer cmd_buf,
                            VkImageLayout old_layout,
                            VkImageLayout new_layout,