Initializers for attachment descriptions

This commit is contained in:
saschawillems 2016-04-30 10:45:39 +02:00
parent 81af6fe108
commit 8ee2687ced
2 changed files with 5 additions and 2 deletions

View file

@ -1386,7 +1386,9 @@ void VulkanExampleBase::setupFrameBuffer()
void VulkanExampleBase::setupRenderPass() void VulkanExampleBase::setupRenderPass()
{ {
VkAttachmentDescription attachments[2]; VkAttachmentDescription attachments[2] = {};
// Color attachment
attachments[0].format = colorformat; attachments[0].format = colorformat;
attachments[0].samples = VK_SAMPLE_COUNT_1_BIT; attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
@ -1396,6 +1398,7 @@ void VulkanExampleBase::setupRenderPass()
attachments[0].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; attachments[0].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
attachments[0].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; attachments[0].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
// Depth attachment
attachments[1].format = depthFormat; attachments[1].format = depthFormat;
attachments[1].samples = VK_SAMPLE_COUNT_1_BIT; attachments[1].samples = VK_SAMPLE_COUNT_1_BIT;
attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;

View file

@ -402,7 +402,7 @@ public:
// Set up separate renderpass with references // Set up separate renderpass with references
// to the color and depth attachments // to the color and depth attachments
std::array<VkAttachmentDescription, 4> attachmentDescs; std::array<VkAttachmentDescription, 4> attachmentDescs = {};
// Init attachment properties // Init attachment properties
for (uint32_t i = 0; i < 4; ++i) for (uint32_t i = 0; i < 4; ++i)