- if(viewport)
- {
- begin_info.renderArea.offset.x = viewport->left;
- begin_info.renderArea.offset.y = framebuffer->get_height()-(viewport->bottom+viewport->height);
- begin_info.renderArea.extent.width = viewport->width;
- begin_info.renderArea.extent.height = viewport->height;
- }
- else
- {
- begin_info.renderArea.extent.width = framebuffer->get_width();
- begin_info.renderArea.extent.height = framebuffer->get_height();
- }
-
- VkClearValue vk_clear_values[7];
- if(clear_values)
- {
- unsigned i = 0;
- for(FrameAttachment a: framebuffer->get_format())
- {
- if(get_attach_point(a)==get_attach_point(DEPTH_ATTACHMENT))
- vk_clear_values[i].depthStencil.depth = clear_values[i].depth_stencil.depth;
- else if(get_attach_point(a)==get_attach_point(STENCIL_ATTACHMENT))
- vk_clear_values[i].depthStencil.stencil = clear_values[i].depth_stencil.stencil;
- else
- {
- vk_clear_values[i].color.float32[0] = clear_values[i].color.r;
- vk_clear_values[i].color.float32[1] = clear_values[i].color.g;
- vk_clear_values[i].color.float32[2] = clear_values[i].color.b;
- vk_clear_values[i].color.float32[3] = clear_values[i].color.a;
- }
- ++i;
- }
-
- begin_info.clearValueCount = framebuffer->get_format().size();
- begin_info.pClearValues = vk_clear_values;
- }
-
- vk.CmdBeginRenderPass(current_buffer, begin_info, VK_SUBPASS_CONTENTS_INLINE);