return 0;
}
-int vk_next_image(VkSemaphore sem)
+int vk_num_swap_images(void)
+{
+ return vksc_numimg;
+}
+
+VkImageView vk_swap_image(int idx)
+{
+ return vksc_view[idx];
+}
+
+int vk_next_swap_image(VkSemaphore sem)
{
uint32_t idx;
if(vkAcquireNextImageKHR(vkdev, vksc, UINT64_MAX, sem, 0, &idx) != 0) {
att[i].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
att[i].finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
}
+ /*
att[zidx].format = r->zfmt;
att[zidx].samples = 1;
att[zidx].loadOp = r->clear ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_DONT_CARE;
att[zidx].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
att[zidx].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
att[zidx].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ */
for(i=0; i<r->num_colbuf; i++) {
catref[i].attachment = i;
catref[i].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
}
+ /*
zatref.attachment = zidx;
zatref.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ */
memset(&subpass, 0, sizeof subpass);
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpass.colorAttachmentCount = r->num_colbuf;
subpass.pColorAttachments = catref;
- subpass.pDepthStencilAttachment = &zatref;
+ subpass.pDepthStencilAttachment = 0;//&zatref;
memset(&pinf, 0, sizeof pinf);
pinf.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- pinf.attachmentCount = r->num_colbuf + 1;
+ pinf.attachmentCount = r->num_colbuf;// + 1;
pinf.pAttachments = att;
pinf.subpassCount = 1;
pinf.pSubpasses = &subpass;
void vk_fb_size(int fb, int x, int y)
{
- framebufs[fb].width = x;
- framebufs[fb].height = y;
- framebufs[fb].vkobj_valid = 0;
+ if(x != framebufs[fb].width || y != framebufs[fb].height) {
+ framebufs[fb].width = x;
+ framebufs[fb].height = y;
+ framebufs[fb].vkobj_valid = 0;
+ }
}
void vk_fb_rpass(int fb, int rpass)
fbinf.pAttachments = f->imgv;
fbinf.width = f->width;
fbinf.height = f->height;
+ fbinf.layers = 1;
if(vkCreateFramebuffer(vkdev, &fbinf, 0, &f->vkobj) != 0) {
fprintf(stderr, "vk_fb: failed to create framebuffer\n");
vkDestroySemaphore(vkdev, sem, 0);
}
+
+void vk_rect(VkRect2D *r, int x, int y, int w, int h)
+{
+ r->offset.x = x;
+ r->offset.y = y;
+ r->extent.width = w;
+ r->extent.height = h;
+}
+
+
#define ARRSZ(arr) (sizeof arr / sizeof *arr)
static const char *known_layer_list[] = {
+ "VK_LAYER_KHRONOS_validation",
"VK_LAYER_GOOGLE_threading",
"VK_LAYER_LUNARG_parameter_validation",
"VK_LAYER_LUNARG_object_tracker",