static int vsz, fsz;
static struct vk_renderer vk_rnd;
static struct vk_swapchain vk_chain;
-
static struct vk_semaphores vk_sema;
+static struct vk_image_attachment vk_color_att;
+static struct vk_image_attachment vk_depth_att;
+static struct vk_image_props vk_depth_att_props;
/* empty for as long as we hardcode the vertices in the vertex shader */
static struct vk_vertex_info vk_vert_info;
vsdr = sdr_load("data/main.vert.spv", &vsz);
fsdr = sdr_load("data/main.frag.spv", &fsz);
+ /* create depth attachment (for the moment we are going to use this
+ * for all images */
+ if (!vk_fill_image_props(&vk_core,
+ win_w, win_h, 1,
+ 1, 1, 1,
+ VK_FORMAT_D24_UNORM_S8_UINT,
+ VK_IMAGE_TILING_OPTIMAL,
+ VK_IMAGE_LAYOUT_UNDEFINED,
+ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
+ false, &vk_depth_att_props)) {
+ fprintf(stderr, "Unsupported depth image properties\n");
+ return false;
+ }
+ if (!vk_create_image(&vk_core, &vk_depth_att_props, &vk_depth_att.obj)) {
+ fprintf(stderr, "Failed to create depth attachment.\n");
+ return false;
+ }
+
/* create renderer */
if (!vk_create_renderer(&vk_core, vsdr, vsz, fsdr, fsz,
- false, false, 0, 0,
+ false, false, 0, &vk_depth_att,
&vk_vert_info, &vk_rnd)) {
fprintf(stderr, "Failed to create renderer.\n");
return false;