tmp to switch computer: there are logical errors in main, needs fixing
[vkrt] / src / vk.h
index 2750d84..5adfbd7 100644 (file)
--- a/src/vk.h
+++ b/src/vk.h
@@ -5,15 +5,15 @@
 #include <stdbool.h>
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+
 struct vk_ctx
 {
     VkInstance inst;
+
     VkPhysicalDevice pdev;
     VkDevice dev;
 
     VkCommandPool cmd_pool;
-    VkCommandBuffer *cmd_buffers;
-    uint32_t num_cmd_buffers;
 
     VkQueue queue;
     int qfam_idx;
@@ -22,12 +22,6 @@ struct vk_ctx
     uint8_t driverUUID[VK_UUID_SIZE];
 };
 
-struct vk_cmd_buffer
-{
-    VkCommandBuffer buffer;
-    VkSubmitInfo submit_info;
-};
-
 struct vk_swapchain
 {
     VkSwapchainKHR swapchain;
@@ -133,8 +127,7 @@ bool vk_init_ctx_for_rendering(struct vk_ctx *ctx,
                                bool enable_cache,
                                bool enable_layers);
 
-void vk_cleanup_ctx(struct vk_ctx *ctx,
-                    bool enable_layers);
+void vk_cleanup_ctx(struct vk_ctx *ctx);
 
 /* images */
 
@@ -197,12 +190,6 @@ 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,
@@ -230,7 +217,11 @@ void
 vk_destroy_renderer(struct vk_ctx *ctx,
                     struct vk_renderer *pipeline);
 
-/* draw */
+/* fences and command buffers */
+bool
+vk_create_fence(struct vk_ctx *ctx,
+                VkFence *fence);
+
 VkCommandBuffer
 vk_create_cmd_buffer(struct vk_ctx *ctx);
 
@@ -247,13 +238,11 @@ vk_record_cmd_buffer(struct vk_ctx *ctx,
                      float w, float h);
 
 void
-vk_reset_cmd_buf(struct vk_cmd_buffer *cmd_buf);
-
-void
-vk_destroy_cmd_bufs(struct vk_ctx *ctx,
-                    uint32_t num_buffers,
-                    VkCommandBuffer *buffers);
+vk_destroy_cmd_buffers(struct vk_ctx *ctx,
+                       uint32_t num_buffers,
+                       VkCommandBuffer *buffers);
 
+/* draw */
 void
 vk_draw(struct vk_ctx *ctx,
         struct vk_semaphores *semaphores,
@@ -273,6 +262,13 @@ vk_clear_color(struct vk_ctx *ctx,
                uint32_t n_attachments,
                float x, float y, float w, float h);
 
+void
+vk_set_viewport(struct vk_ctx *ctx,
+                VkCommandBuffer cmd_buf,
+                float x, float y,
+                float w, float h,
+                float near, float far);
+
 /* swapchain */
 
 bool
@@ -287,7 +283,7 @@ vk_destroy_swapchain(struct vk_ctx *ctx,
                      struct vk_swapchain *swapchain);
 
 bool
-vk_present_queue(struct vk_swapchain *swapchain,
+vk_queue_present(struct vk_swapchain *swapchain,
                  VkQueue queue,
                  uint32_t image_idx,
                  VkSemaphore wait_sema);