Framebuffer image final layout

This commit is contained in:
saschawillems 2016-09-03 11:19:38 +02:00
parent 5e3b0f4b75
commit 0261fc27ba

View file

@ -215,22 +215,14 @@ namespace vk
attachment.description.format = createinfo.format; attachment.description.format = createinfo.format;
attachment.description.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; attachment.description.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
// Final layout // Final layout
if ((createinfo.usage & VK_IMAGE_USAGE_SAMPLED_BIT)) // If not, final layout depends on attachment type
if (attachment.hasDepth() || attachment.hasStencil())
{ {
// If sampled, final layout is always SHADER_READ attachment.description.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
attachment.description.finalLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
} }
else else
{ {
// If not, final layout depends on attachment type attachment.description.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
if (attachment.hasDepth() || attachment.hasStencil())
{
attachment.description.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
}
else
{
attachment.description.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
}
} }
attachments.push_back(attachment); attachments.push_back(attachment);