From f3ca7f8a25102684e440ada150b4c9d6456acf90 Mon Sep 17 00:00:00 2001 From: Noah Fredriks Date: Wed, 11 Jul 2018 17:56:05 -0400 Subject: [PATCH] Fix incomplete VkImageSubresourceRange Pipeline image barrier arraySize doesn't include the entire image. Affects: dEQP-VK.api.copy_and_blit.core.resolve_image.whole_array* Components: Vulkan VK-GL-CTS Issue: 910 Change-Id: I9974c9390478cf70f2238e03a7180fc81166f84e --- .../api/vktApiCopiesAndBlittingTests.cpp | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp index b85af3662..123b5a5cc 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp @@ -2616,7 +2616,7 @@ public: virtual tcu::TestStatus iterate (void); protected: virtual tcu::TestStatus checkTestResult (tcu::ConstPixelBufferAccess result); - void copyMSImageToMSImage (void); + void copyMSImageToMSImage (deUint32 copyArraySize); private: Move m_multisampledImage; de::MovePtr m_multisampledImageAlloc; @@ -3173,11 +3173,17 @@ tcu::TestStatus ResolveImageToImage::iterate (void) generateBuffer(m_sourceTextureLevel->getAccess(), m_params.src.image.extent.width, m_params.src.image.extent.height, m_params.dst.image.extent.depth, FILL_MODE_MULTISAMPLE); generateExpectedResult(); + VkImage sourceImage = m_multisampledImage.get(); + deUint32 sourceArraySize = getArraySize(m_params.src.image); + switch (m_options) { - case COPY_MS_IMAGE_TO_MS_IMAGE: case COPY_MS_IMAGE_TO_ARRAY_MS_IMAGE: - copyMSImageToMSImage(); + // Duplicate the multisampled image to a multisampled image array + sourceArraySize = getArraySize(m_params.dst.image); + case COPY_MS_IMAGE_TO_MS_IMAGE: + copyMSImageToMSImage(sourceArraySize); + sourceImage = m_multisampledCopyImage.get(); break; default: break; @@ -3203,13 +3209,13 @@ tcu::TestStatus ResolveImageToImage::iterate (void) VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, // VkImageLayout newLayout; VK_QUEUE_FAMILY_IGNORED, // deUint32 srcQueueFamilyIndex; VK_QUEUE_FAMILY_IGNORED, // deUint32 dstQueueFamilyIndex; - m_multisampledImage.get(), // VkImage image; + sourceImage, // VkImage image; { // VkImageSubresourceRange subresourceRange; getAspectFlags(srcTcuFormat), // VkImageAspectFlags aspectMask; 0u, // deUint32 baseMipLevel; 1u, // deUint32 mipLevels; 0u, // deUint32 baseArraySlice; - getArraySize(m_params.src.image) // deUint32 arraySize; + sourceArraySize // deUint32 arraySize; } }, // destination image @@ -3263,7 +3269,7 @@ tcu::TestStatus ResolveImageToImage::iterate (void) VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo)); vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, DE_LENGTH_OF_ARRAY(imageBarriers), imageBarriers); - vk.cmdResolveImage(*m_cmdBuffer, m_multisampledImage.get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, m_destination.get(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (deUint32)m_params.regions.size(), imageResolves.data()); + vk.cmdResolveImage(*m_cmdBuffer, sourceImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, m_destination.get(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (deUint32)m_params.regions.size(), imageResolves.data()); vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &postImageBarrier); VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer)); submitCommandsAndWait(vk, vkDevice, queue, *m_cmdBuffer); @@ -3305,7 +3311,7 @@ void ResolveImageToImage::copyRegionToTextureLevel(tcu::ConstPixelBufferAccess s tcu::copy(dstSubRegion, srcSubRegion); } -void ResolveImageToImage::copyMSImageToMSImage (void) +void ResolveImageToImage::copyMSImageToMSImage (deUint32 copyArraySize) { const DeviceInterface& vk = m_context.getDeviceInterface(); const VkDevice vkDevice = m_context.getDevice(); @@ -3313,7 +3319,7 @@ void ResolveImageToImage::copyMSImageToMSImage (void) const tcu::TextureFormat srcTcuFormat = mapVkFormat(m_params.src.image.format); std::vector imageCopies; - for (deUint32 layerNdx = 0; layerNdx < getArraySize(m_params.dst.image); ++layerNdx) + for (deUint32 layerNdx = 0; layerNdx < copyArraySize; ++layerNdx) { const VkImageSubresourceLayers sourceSubresourceLayers = { @@ -3379,13 +3385,13 @@ void ResolveImageToImage::copyMSImageToMSImage (void) 0u, // deUint32 baseMipLevel; 1u, // deUint32 mipLevels; 0u, // deUint32 baseArraySlice; - getArraySize(m_params.dst.image) // deUint32 arraySize; + copyArraySize // deUint32 arraySize; } }, }; const VkImageMemoryBarrier postImageBarriers = - // source image + // destination image { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType; DE_NULL, // const void* pNext; @@ -3401,7 +3407,7 @@ void ResolveImageToImage::copyMSImageToMSImage (void) 0u, // deUint32 baseMipLevel; 1u, // deUint32 mipLevels; 0u, // deUint32 baseArraySlice; - getArraySize(m_params.dst.image) // deUint32 arraySize; + copyArraySize // deUint32 arraySize; } }; @@ -3420,8 +3426,6 @@ void ResolveImageToImage::copyMSImageToMSImage (void) VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer)); submitCommandsAndWait (vk, vkDevice, queue, *m_cmdBuffer); - - m_multisampledImage = m_multisampledCopyImage; } class ResolveImageToImageTestCase : public vkt::TestCase -- 2.34.1