From cb2b33a42b61f00348e04cb9c5e2f3a12a8f46f0 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 26 Jul 2016 17:37:39 -1000 Subject: [PATCH] Vulkan validation fixes --- lib/graphicsdev/Vulkan.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lib/graphicsdev/Vulkan.cpp b/lib/graphicsdev/Vulkan.cpp index 26b7d14..33b50ca 100644 --- a/lib/graphicsdev/Vulkan.cpp +++ b/lib/graphicsdev/Vulkan.cpp @@ -2056,19 +2056,22 @@ struct VulkanShaderDataBinding : IShaderDataBinding { if (ibuffer; - modInfo.offset += origInfo->offset; - writes[totalWrites].pBufferInfo = &modInfo; - writes[totalWrites].dstArrayElement = 0; - writes[totalWrites].dstBinding = binding; - ++totalWrites; + if (modInfo.range) + { + writes[totalWrites].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writes[totalWrites].pNext = nullptr; + writes[totalWrites].dstSet = m_descSets[b]; + writes[totalWrites].descriptorCount = 1; + writes[totalWrites].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; + const VkDescriptorBufferInfo* origInfo = GetBufferGPUResource(m_ubufs[i], b); + modInfo.buffer = origInfo->buffer; + modInfo.offset += origInfo->offset; + writes[totalWrites].pBufferInfo = &modInfo; + writes[totalWrites].dstArrayElement = 0; + writes[totalWrites].dstBinding = binding; + ++totalWrites; + } } ++binding; } @@ -2478,7 +2481,7 @@ struct VulkanCommandQueue : IGraphicsCommandQueue VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, 1, 1); SetImageLayout(cmdBuf, ctexture->m_colorBindTex, VK_IMAGE_ASPECT_COLOR_BIT, - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, 1); + VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, 1); VkImageCopy copyInfo = {}; copyInfo.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; @@ -2550,6 +2553,8 @@ struct VulkanCommandQueue : IGraphicsCommandQueue SetImageLayout(cmdBuf, ctexture->m_depthBindTex, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 1, 1); } + + vk::CmdBeginRenderPass(cmdBuf, &m_boundTarget->m_passBeginInfo, VK_SUBPASS_CONTENTS_INLINE); } void execute();