virtual tcu::TestStatus iterate (void);
protected:
virtual tcu::TestStatus checkTestResult (tcu::ConstPixelBufferAccess result);
- void copyMSImageToMSImage (void);
+ void copyMSImageToMSImage (deUint32 copyArraySize);
private:
Move<VkImage> m_multisampledImage;
de::MovePtr<Allocation> m_multisampledImageAlloc;
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;
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
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);
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();
const tcu::TextureFormat srcTcuFormat = mapVkFormat(m_params.src.image.format);
std::vector<VkImageCopy> imageCopies;
- for (deUint32 layerNdx = 0; layerNdx < getArraySize(m_params.dst.image); ++layerNdx)
+ for (deUint32 layerNdx = 0; layerNdx < copyArraySize; ++layerNdx)
{
const VkImageSubresourceLayers sourceSubresourceLayers =
{
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;
0u, // deUint32 baseMipLevel;
1u, // deUint32 mipLevels;
0u, // deUint32 baseArraySlice;
- getArraySize(m_params.dst.image) // deUint32 arraySize;
+ copyArraySize // deUint32 arraySize;
}
};
VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
submitCommandsAndWait (vk, vkDevice, queue, *m_cmdBuffer);
-
- m_multisampledImage = m_multisampledCopyImage;
}
class ResolveImageToImageTestCase : public vkt::TestCase