projects
/
vkrt
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tmp to switch computer: there are logical errors in main, needs fixing
[vkrt]
/
src
/
vk.h
diff --git
a/src/vk.h
b/src/vk.h
index
dfe6aa6
..
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]))
#include <stdbool.h>
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+
struct vk_ctx
{
VkInstance inst;
struct vk_ctx
{
VkInstance inst;
+
VkPhysicalDevice pdev;
VkDevice dev;
VkCommandPool cmd_pool;
VkPhysicalDevice pdev;
VkDevice dev;
VkCommandPool cmd_pool;
- VkCommandBuffer *cmd_buffers;
- uint32_t num_cmd_buffers;
VkQueue queue;
int qfam_idx;
VkQueue queue;
int qfam_idx;
@@
-22,16
+22,9
@@
struct vk_ctx
uint8_t driverUUID[VK_UUID_SIZE];
};
uint8_t driverUUID[VK_UUID_SIZE];
};
-struct vk_cmd_buffer
-{
- VkCommandBuffer buffer;
- VkSubmitInfo submit_info;
-};
-
struct vk_swapchain
{
VkSwapchainKHR swapchain;
struct vk_swapchain
{
VkSwapchainKHR swapchain;
- VkSurfaceKHR surface;
VkSurfaceFormatKHR surf_fmt;
/* image properties */
VkSurfaceFormatKHR surf_fmt;
/* image properties */
@@
-121,6
+114,10
@@
struct vk_semaphores
VkSemaphore frame_done;
};
VkSemaphore frame_done;
};
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* context */
bool vk_init_ctx(struct vk_ctx *ctx,
/* context */
bool vk_init_ctx(struct vk_ctx *ctx,
@@
-130,8
+127,7
@@
bool vk_init_ctx_for_rendering(struct vk_ctx *ctx,
bool enable_cache,
bool enable_layers);
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 */
/* images */
@@
-194,12
+190,6
@@
void
vk_destroy_semaphores(struct vk_ctx *ctx,
struct vk_semaphores *semaphores);
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,
void
vk_destroy_fences(struct vk_ctx *ctc,
int num_fences,
@@
-227,7
+217,11
@@
void
vk_destroy_renderer(struct vk_ctx *ctx,
struct vk_renderer *pipeline);
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);
VkCommandBuffer
vk_create_cmd_buffer(struct vk_ctx *ctx);
@@
-244,13
+238,11
@@
vk_record_cmd_buffer(struct vk_ctx *ctx,
float w, float h);
void
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,
void
vk_draw(struct vk_ctx *ctx,
struct vk_semaphores *semaphores,
@@
-270,6
+262,13
@@
vk_clear_color(struct vk_ctx *ctx,
uint32_t n_attachments,
float x, float y, float w, float h);
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
/* swapchain */
bool
@@
-284,7
+283,7
@@
vk_destroy_swapchain(struct vk_ctx *ctx,
struct vk_swapchain *swapchain);
bool
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);
VkQueue queue,
uint32_t image_idx,
VkSemaphore wait_sema);
@@
-306,4
+305,9
@@
vk_transition_image_layout(struct vk_attachment *img_att,
uint32_t src_queue_family_index,
uint32_t dst_queue_family_index);
uint32_t src_queue_family_index,
uint32_t dst_queue_family_index);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* VK_H */
#endif /* VK_H */