uint8_t driverUUID[VK_UUID_SIZE];
};
-struct vk_swapchain
-{
- VkSwapchainKHR swapchain;
- VkSurfaceFormatKHR surf_fmt;
-
- /* image properties */
- VkFormat image_fmt;
- VkExtent2D extent2d;
-
- uint32_t num_atts;
- struct vk_attachment *atts;
-};
-
struct vk_att_props
{
uint32_t w;
bool need_export;
};
+struct vk_swapchain
+{
+ VkSwapchainKHR swapchain;
+ VkSurfaceFormatKHR surf_fmt;
+
+ /* image properties */
+ /* FIXME: do I really need those 2?*/
+ VkFormat image_fmt;
+ VkExtent2D extent2d;
+
+ struct vk_att_props img_props;
+
+ uint32_t num_images;
+ VkImage *images;
+ VkImageView *views;
+};
+
+/* for allocated images */
+
struct vk_mem_obj {
VkDeviceMemory mem;
VkDeviceSize mem_sz;
VkRenderPass renderpass;
VkShaderModule vs;
VkShaderModule fs;
- VkFramebuffer fb;
struct vk_vertex_info vertex_info;
};
void vk_cleanup_ctx(struct vk_ctx *ctx);
/* images */
+bool
+vk_create_ext_image(struct vk_ctx *ctx,
+ struct vk_att_props *props,
+ struct vk_image_obj *img);
bool
vk_create_image(struct vk_ctx *ctx,
struct vk_image_obj *img_obj);
bool
+vk_create_image_view(struct vk_ctx *ctx,
+ VkImage image,
+ VkImageViewType view_type,
+ VkFormat format,
+ bool is_swapchain,
+ VkImageView *image_view);
+
+bool
vk_fill_image_props(struct vk_ctx *ctx,
uint32_t w, uint32_t h,
uint32_t depth,
bool need_export,
struct vk_att_props *props);
+struct vk_attachment
+vk_create_attachment_from_obj(struct vk_image_obj *obj,
+ struct vk_att_props *props);
+
+struct vk_attachment
+vk_create_attachment(VkImage image,
+ VkImageView view,
+ struct vk_att_props *props);
+
/* buffers */
bool
VkFence *fences);
/* renderer */
+bool
+vk_create_framebuffer(struct vk_ctx *ctx,
+ int width, int height,
+ int num_color_atts,
+ VkImageView *color_views,
+ VkImageView *depth_view,
+ VkRenderPass rb,
+ VkFramebuffer *fb);
+
+bool
+vk_create_renderpass(struct vk_ctx *ctx,
+ uint32_t num_color_atts,
+ struct vk_att_props *color_props,
+ struct vk_att_props *depth_props,
+ VkRenderPass *renderpass);
bool
vk_create_renderer(struct vk_ctx *ctx,
bool enable_depth,
bool enable_stencil,
int num_color_att,
- struct vk_attachment *color_att,
- struct vk_attachment *depth_att,
+ struct vk_att_props *color_props,
+ struct vk_att_props *depth_props,
struct vk_vertex_info *vert_info,
struct vk_renderer *renderer);
struct vk_buf *vbo,
uint32_t vk_fb_color_count,
float *vk_fb_color,
+ VkFramebuffer fb,
uint32_t num_atts,
struct vk_attachment *atts,
float x, float y,
struct vk_renderer *renderer,
float *vk_fb_color,
uint32_t vk_fb_color_count,
+ VkFramebuffer fb,
struct vk_semaphores *semaphores,
bool has_wait, bool has_signal,
struct vk_attachment *attachments,