}
}
+std::string extentToString (VkExtent3D extent, VkImageType imageType)
+{
+ // Don't append image dimensions when using the dimensions found in original test cases. This avoids name clashing with the old versions.
+ if (imageType == VK_IMAGE_TYPE_1D && extent.width == 256u) return "";
+ if (imageType == VK_IMAGE_TYPE_2D && extent.width == 256u && extent.height == 256u) return "";
+ if (imageType == VK_IMAGE_TYPE_3D && extent.width == 256u && extent.height == 256u && extent.depth == 16u) return "";
+
+ return (std::string("_") + de::toString(extent.width) + std::string("x") + de::toString(extent.height) + (extent.depth != 1 ? (std::string("x") + de::toString(extent.depth)) : ""));
+}
+
+enum SeparateDepthStencilLayoutMode
+{
+ SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_NONE = 0,
+ SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_DEPTH,
+ SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_STENCIL,
+};
+
struct TestParams
{
- bool useSingleMipLevel; //!< only mip level 0, otherwise up to maxMipLevels
- VkImageType imageType;
- VkFormat imageFormat;
- VkImageTiling imageTiling;
- VkExtent3D imageExtent;
- deUint32 imageLayerCount;
- LayerRange imageViewLayerRange;
- VkClearValue initValue;
- VkClearValue clearValue[2]; //!< the second value is used with more than one mip map
- LayerRange clearLayerRange;
- AllocationKind allocationKind;
- bool isCube;
+ bool useSingleMipLevel; //!< only mip level 0, otherwise up to maxMipLevels
+ VkImageType imageType;
+ VkFormat imageFormat;
+ VkImageTiling imageTiling;
+ VkExtent3D imageExtent;
+ deUint32 imageLayerCount;
+ LayerRange imageViewLayerRange;
+ VkClearValue initValue;
+ VkClearValue clearValue[2]; //!< the second value is used with more than one mip map
+ LayerRange clearLayerRange;
+ AllocationKind allocationKind;
+ bool isCube;
+ SeparateDepthStencilLayoutMode separateDepthStencilLayoutMode;
};
class ImageClearingTestInstance : public vkt::TestInstance
void submitCommandBuffer (void) const;
void beginRenderPass (VkSubpassContents content, VkClearValue clearValue) const;
- void pipelineImageBarrier (VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout) const;
+ void pipelineImageBarrier (VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout, VkImageAspectFlags aspectMask = 0u) const;
de::MovePtr<TextureLevelPyramid> readImage (VkImageAspectFlags aspectMask, deUint32 baseLayer) const;
tcu::TestStatus verifyResultImage (const std::string& successMessage, const UVec4& clearCoords = UVec4()) const;
, m_frameBuffer (m_isAttachmentFormat ? createFrameBuffer(*m_imageView, *m_renderPass, params.imageExtent.width, params.imageExtent.height, params.imageViewLayerRange.layerCount) : vk::Move<vk::VkFramebuffer>())
{
if (m_params.allocationKind == ALLOCATION_KIND_DEDICATED)
- {
- if (!isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_dedicated_allocation"))
- TCU_THROW(NotSupportedError, "VK_KHR_dedicated_allocation is not supported");
- }
+ context.requireDeviceFunctionality("VK_KHR_dedicated_allocation");
+
+ if (m_params.separateDepthStencilLayoutMode != SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_NONE)
+ context.requireDeviceFunctionality("VK_KHR_separate_depth_stencil_layouts");
}
ImageClearingTestInstance::ViewType ImageClearingTestInstance::getViewType (deUint32 imageLayerCount) const
Move<VkRenderPass> ImageClearingTestInstance::createRenderPass (VkFormat format) const
{
- VkImageLayout imageLayout;
+ if (m_params.separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_NONE)
+ {
+ VkImageLayout imageLayout;
- if (isDepthStencilFormat(format))
- imageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
- else
- imageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
+ if (isDepthStencilFormat(format))
+ imageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ else
+ imageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
- const VkAttachmentDescription attachmentDesc =
- {
- 0u, // VkAttachmentDescriptionFlags flags;
- format, // VkFormat format;
- VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
- VK_ATTACHMENT_LOAD_OP_CLEAR, // VkAttachmentLoadOp loadOp;
- VK_ATTACHMENT_STORE_OP_STORE, // VkAttachmentStoreOp storeOp;
- VK_ATTACHMENT_LOAD_OP_CLEAR, // VkAttachmentLoadOp stencilLoadOp;
- VK_ATTACHMENT_STORE_OP_STORE, // VkAttachmentStoreOp stencilStoreOp;
- imageLayout, // VkImageLayout initialLayout;
- imageLayout, // VkImageLayout finalLayout;
- };
+ const VkAttachmentDescription attachmentDesc =
+ {
+ 0u, // VkAttachmentDescriptionFlags flags;
+ format, // VkFormat format;
+ VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
+ VK_ATTACHMENT_LOAD_OP_CLEAR, // VkAttachmentLoadOp loadOp;
+ VK_ATTACHMENT_STORE_OP_STORE, // VkAttachmentStoreOp storeOp;
+ VK_ATTACHMENT_LOAD_OP_CLEAR, // VkAttachmentLoadOp stencilLoadOp;
+ VK_ATTACHMENT_STORE_OP_STORE, // VkAttachmentStoreOp stencilStoreOp;
+ imageLayout, // VkImageLayout initialLayout;
+ imageLayout, // VkImageLayout finalLayout;
+ };
- const VkAttachmentDescription attachments[1] =
- {
- attachmentDesc
- };
+ const VkAttachmentDescription attachments[1] =
+ {
+ attachmentDesc
+ };
- const VkAttachmentReference attachmentRef =
- {
- 0u, // deUint32 attachment;
- imageLayout, // VkImageLayout layout;
- };
+ const VkAttachmentReference attachmentRef =
+ {
+ 0u, // deUint32 attachment;
+ imageLayout, // VkImageLayout layout;
+ };
- const VkAttachmentReference* pColorAttachments = DE_NULL;
- const VkAttachmentReference* pDepthStencilAttachment = DE_NULL;
- deUint32 colorAttachmentCount = 1;
+ const VkAttachmentReference* pColorAttachments = DE_NULL;
+ const VkAttachmentReference* pDepthStencilAttachment = DE_NULL;
+ deUint32 colorAttachmentCount = 1;
- if (isDepthStencilFormat(format))
- {
- colorAttachmentCount = 0;
- pDepthStencilAttachment = &attachmentRef;
+ if (isDepthStencilFormat(format))
+ {
+ colorAttachmentCount = 0;
+ pDepthStencilAttachment = &attachmentRef;
+ }
+ else
+ {
+ colorAttachmentCount = 1;
+ pColorAttachments = &attachmentRef;
+ }
+
+ const VkSubpassDescription subpassDesc[1] =
+ {
+ {
+ 0u, // VkSubpassDescriptionFlags flags;
+ VK_PIPELINE_BIND_POINT_GRAPHICS, // VkPipelineBindPoint pipelineBindPoint;
+ 0u, // deUint32 inputAttachmentCount;
+ DE_NULL, // const VkAttachmentReference* pInputAttachments;
+ colorAttachmentCount, // deUint32 colorAttachmentCount;
+ pColorAttachments, // const VkAttachmentReference* pColorAttachments;
+ DE_NULL, // const VkAttachmentReference* pResolveAttachments;
+ pDepthStencilAttachment, // const VkAttachmentReference* pDepthStencilAttachment;
+ 0u, // deUint32 preserveAttachmentCount;
+ DE_NULL, // const VkAttachmentReference* pPreserveAttachments;
+ }
+ };
+
+ const VkRenderPassCreateInfo renderPassCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkRenderPassCreateFlags flags;
+ 1u, // deUint32 attachmentCount;
+ attachments, // const VkAttachmentDescription* pAttachments;
+ 1u, // deUint32 subpassCount;
+ subpassDesc, // const VkSubpassDescription* pSubpasses;
+ 0u, // deUint32 dependencyCount;
+ DE_NULL, // const VkSubpassDependency* pDependencies;
+ };
+
+ return vk::createRenderPass(m_vkd, m_device, &renderPassCreateInfo, DE_NULL);
}
else
{
- colorAttachmentCount = 1;
- pColorAttachments = &attachmentRef;
- }
+ // Make sure VK_KHR_create_renderpass2 is supported. Due to InstanceFactory1 being used and the render pass being created in
+ // the instance constructor and not every time, this is the best moment to check.
+ m_context.requireDeviceFunctionality("VK_KHR_create_renderpass2");
- const VkSubpassDescription subpassDesc[1] =
- {
+ VkImageLayout initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ VkImageLayout finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ VkAttachmentDescriptionStencilLayoutKHR stencilLayouts =
+ {
+ VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR,
+ DE_NULL,
+ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
+ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
+ };
+
+ VkImageLayout imageLayout;
+ VkAttachmentReferenceStencilLayoutKHR stencilLayoutRef =
+ {
+ VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR,
+ DE_NULL,
+ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
+ };
+
+ if (m_params.separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_DEPTH)
+ {
+ initialLayout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR;
+ finalLayout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR;
+ stencilLayouts.stencilInitialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ stencilLayouts.stencilFinalLayout = VK_IMAGE_LAYOUT_GENERAL;
+ imageLayout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR;
+ stencilLayoutRef.stencilLayout = VK_IMAGE_LAYOUT_GENERAL;
+ }
+ else
+ {
+ initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ finalLayout = VK_IMAGE_LAYOUT_GENERAL;
+ stencilLayouts.stencilInitialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
+ stencilLayouts.stencilFinalLayout = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR;
+ imageLayout = VK_IMAGE_LAYOUT_GENERAL;
+ stencilLayoutRef.stencilLayout = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR;
+ }
+
+ const VkAttachmentDescription2KHR attachmentDesc =
+ {
+ VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2_KHR, // VkStructureType sType;
+ &stencilLayouts, // const void* pNext;
+ 0u, // VkAttachmentDescriptionFlags flags;
+ format, // VkFormat format;
+ VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
+ VK_ATTACHMENT_LOAD_OP_CLEAR, // VkAttachmentLoadOp loadOp;
+ VK_ATTACHMENT_STORE_OP_STORE, // VkAttachmentStoreOp storeOp;
+ VK_ATTACHMENT_LOAD_OP_CLEAR, // VkAttachmentLoadOp stencilLoadOp;
+ VK_ATTACHMENT_STORE_OP_STORE, // VkAttachmentStoreOp stencilStoreOp;
+ initialLayout, // VkImageLayout initialLayout;
+ finalLayout, // VkImageLayout finalLayout;
+ };
+
+ const VkAttachmentReference2KHR attachmentRef =
{
+ VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR, // VkStructureType sType;
+ &stencilLayoutRef, // const void* pNext;
+ 0u, // deUint32 attachment;
+ imageLayout, // VkImageLayout layout;
+ 0u, // VkImageAspectFlags aspectMask;
+ };
+
+ const VkSubpassDescription2KHR subpassDesc =
+ {
+ VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
0u, // VkSubpassDescriptionFlags flags;
VK_PIPELINE_BIND_POINT_GRAPHICS, // VkPipelineBindPoint pipelineBindPoint;
+ 0u, // deUint32 viewMask;
0u, // deUint32 inputAttachmentCount;
- DE_NULL, // const VkAttachmentReference* pInputAttachments;
- colorAttachmentCount, // deUint32 colorAttachmentCount;
- pColorAttachments, // const VkAttachmentReference* pColorAttachments;
- DE_NULL, // const VkAttachmentReference* pResolveAttachments;
- pDepthStencilAttachment, // const VkAttachmentReference* pDepthStencilAttachment;
+ DE_NULL, // const VkAttachmentReference2KHR* pInputAttachments;
+ 0u, // deUint32 colorAttachmentCount;
+ DE_NULL, // const VkAttachmentReference2KHR* pColorAttachments;
+ DE_NULL, // const VkAttachmentReference2KHR* pResolveAttachments;
+ &attachmentRef, // const VkAttachmentReference2KHR* pDepthStencilAttachment;
0u, // deUint32 preserveAttachmentCount;
- DE_NULL, // const VkAttachmentReference* pPreserveAttachments;
- }
- };
+ DE_NULL, // const VkAttachmentReference2KHR* pPreserveAttachments;
+ };
- const VkRenderPassCreateInfo renderPassCreateInfo =
- {
- VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0u, // VkRenderPassCreateFlags flags;
- 1u, // deUint32 attachmentCount;
- attachments, // const VkAttachmentDescription* pAttachments;
- 1u, // deUint32 subpassCount;
- subpassDesc, // const VkSubpassDescription* pSubpasses;
- 0u, // deUint32 dependencyCount;
- DE_NULL, // const VkSubpassDependency* pDependencies;
- };
+ const VkRenderPassCreateInfo2KHR renderPassCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2_KHR, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkRenderPassCreateFlags flags;
+ 1u, // deUint32 attachmentCount;
+ &attachmentDesc, // const VkAttachmentDescription* pAttachments;
+ 1u, // deUint32 subpassCount;
+ &subpassDesc, // const VkSubpassDescription* pSubpasses;
+ 0u, // deUint32 dependencyCount;
+ DE_NULL, // const VkSubpassDependency* pDependencies;
+ 0u, // deUint32 correlatedViewMaskCount;
+ DE_NULL, // const deUint32* pCorrelatedViewMasks;
+ };
- return vk::createRenderPass(m_vkd, m_device, &renderPassCreateInfo, DE_NULL);
+ return vk::createRenderPass2KHR(m_vkd, m_device, &renderPassCreateInfo, DE_NULL);
+ }
}
Move<VkFramebuffer> ImageClearingTestInstance::createFrameBuffer (VkImageView imageView, VkRenderPass renderPass, deUint32 imageWidth, deUint32 imageHeight, deUint32 imageLayersCount) const
submitCommandsAndWait(m_vkd, m_device, m_queue, m_commandBuffer.get());
}
-void ImageClearingTestInstance::pipelineImageBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout) const
+void ImageClearingTestInstance::pipelineImageBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout, VkImageAspectFlags aspectMask) const
{
+ if (!aspectMask || m_params.separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_NONE)
+ aspectMask = m_imageAspectFlags;
+
const VkImageMemoryBarrier imageBarrier =
{
VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType;
VK_QUEUE_FAMILY_IGNORED, // deUint32 destQueueFamilyIndex;
*m_image, // VkImage image;
{
- m_imageAspectFlags, // VkImageAspectFlags aspectMask;
+ aspectMask, // VkImageAspectFlags aspectMask;
0u, // deUint32 baseMipLevel;
VK_REMAINING_MIP_LEVELS, // deUint32 levelCount;
0u, // deUint32 baseArrayLayer;
VK_ACCESS_TRANSFER_WRITE_BIT,
VK_ACCESS_TRANSFER_READ_BIT,
VK_IMAGE_LAYOUT_GENERAL,
- VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
+ VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+ aspectMask);
m_vkd.cmdCopyImageToBuffer(*m_commandBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *buffer, static_cast<deUint32>(copyRegions.size()), ©Regions[0]);
m_vkd.cmdPipelineBarrier(*m_commandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &bufferBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
VK_ACCESS_TRANSFER_READ_BIT,
VK_ACCESS_TRANSFER_READ_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
- VK_IMAGE_LAYOUT_GENERAL);
+ VK_IMAGE_LAYOUT_GENERAL,
+ aspectMask);
endCommandBuffer();
submitCommandBuffer();
{
DE_ASSERT((clearCoords == UVec4()) || m_params.imageExtent.depth == 1u);
- if (getIsDepthFormat(m_params.imageFormat))
+ if (getIsDepthFormat(m_params.imageFormat) && m_params.separateDepthStencilLayoutMode != SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_STENCIL)
{
DE_ASSERT(m_imageMipLevels == 1u);
}
}
- if (getIsStencilFormat(m_params.imageFormat))
+ if (getIsStencilFormat(m_params.imageFormat) && m_params.separateDepthStencilLayoutMode != SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_DEPTH)
{
DE_ASSERT(m_imageMipLevels == 1u);
TestStatus ClearDepthStencilImageTestInstance::iterate (void)
{
- const VkImageSubresourceRange subresourceRange = makeImageSubresourceRange(m_imageAspectFlags, 0u, 1u, m_params.clearLayerRange.baseArrayLayer, m_twoStep ? 1 : m_params.clearLayerRange.layerCount);
- const VkImageSubresourceRange steptwoRange = makeImageSubresourceRange(m_imageAspectFlags, 0u, VK_REMAINING_MIP_LEVELS, m_params.clearLayerRange.baseArrayLayer, VK_REMAINING_ARRAY_LAYERS);
+ VkImageLayout layout = (m_isAttachmentFormat
+ ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
+ : VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
+ VkImageAspectFlags aspectMask = m_imageAspectFlags;
+ if (m_params.separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_DEPTH)
+ {
+ layout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR;
+ aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
+ }
+ else if (m_params.separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_STENCIL)
+ {
+ layout = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR;
+ aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT;
+ }
+
+ const VkImageSubresourceRange subresourceRange = makeImageSubresourceRange(aspectMask, 0u, 1u, m_params.clearLayerRange.baseArrayLayer, m_twoStep ? 1 : m_params.clearLayerRange.layerCount);
+ const VkImageSubresourceRange steptwoRange = makeImageSubresourceRange(aspectMask, 0u, VK_REMAINING_MIP_LEVELS, m_params.clearLayerRange.baseArrayLayer, VK_REMAINING_ARRAY_LAYERS);
beginCommandBuffer(0);
? VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT
: VK_ACCESS_TRANSFER_WRITE_BIT), // VkAccessFlags dstAccessMask
VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout oldLayout;
- (m_isAttachmentFormat
- ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
- : VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL)); // VkImageLayout newLayout;
+ layout, // VkImageLayout newLayout;
+ aspectMask); // VkImageAspectFlags aspectMask;
if (m_isAttachmentFormat)
{
VK_PIPELINE_STAGE_TRANSFER_BIT, // VkPipelineStageFlags dstStageMask
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, // VkAccessFlags srcAccessMask
VK_ACCESS_TRANSFER_WRITE_BIT, // VkAccessFlags dstAccessMask
- VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, // VkImageLayout oldLayout;
- VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); // VkImageLayout newLayout;
+ layout, // VkImageLayout oldLayout;
+ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // VkImageLayout newLayout;
+ aspectMask); // VkImageAspectFlags aspectMask;
}
m_vkd.cmdClearDepthStencilImage(*m_commandBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &m_params.clearValue[0].depthStencil, 1, &subresourceRange);
VK_ACCESS_TRANSFER_WRITE_BIT, // VkAccessFlags srcAccessMask
VK_ACCESS_TRANSFER_READ_BIT, // VkAccessFlags dstAccessMask
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // VkImageLayout oldLayout;
- VK_IMAGE_LAYOUT_GENERAL); // VkImageLayout newLayout;
+ VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout newLayout;
+ aspectMask); // VkImageAspectFlags aspectMask;
endCommandBuffer();
submitCommandBuffer();
TestStatus iterate (void)
{
+ const bool isDepthStencil = isDepthStencilFormat(m_params.imageFormat);
+ const VkAccessFlags accessMask = (isDepthStencil ? VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT : VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
+ VkImageLayout attachmentLayout = (isDepthStencil ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
+ VkImageAspectFlags aspectMask = m_imageAspectFlags;
+
+ if (m_params.separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_DEPTH)
+ {
+ attachmentLayout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR;
+ aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
+ }
+ else if (m_params.separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_STENCIL)
+ {
+ attachmentLayout = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR;
+ aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT;
+ }
+
const VkClearAttachment clearAttachment =
{
- m_imageAspectFlags, // VkImageAspectFlags aspectMask;
+ aspectMask, // VkImageAspectFlags aspectMask;
0u, // deUint32 colorAttachment;
m_params.clearValue[0] // VkClearValue clearValue;
};
}
else
{
- const deUint32 clearX = m_params.imageExtent.width / 4u;
- const deUint32 clearY = m_params.imageExtent.height / 4u;
+ const deUint32 clearX = m_params.imageExtent.width / 8u;
+ const deUint32 clearY = m_params.imageExtent.height / 8u;
const deUint32 clearWidth = m_params.imageExtent.width / 2u;
const deUint32 clearHeight = m_params.imageExtent.height / 2u;
clearRects.push_back(rects[1]);
}
- const bool isDepthStencil = isDepthStencilFormat(m_params.imageFormat);
- const VkAccessFlags accessMask = (isDepthStencil ? VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT : VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
- const VkImageLayout attachmentLayout = (isDepthStencil ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
-
beginCommandBuffer(0);
pipelineImageBarrier(VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // VkPipelineStageFlags srcStageMask
0, // VkAccessFlags srcAccessMask
accessMask, // VkAccessFlags dstAccessMask
VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout oldLayout;
- attachmentLayout); // VkImageLayout newLayout;
+ attachmentLayout, // VkImageLayout newLayout;
+ aspectMask); // VkImageAspectFlags aspectMask;
beginRenderPass(VK_SUBPASS_CONTENTS_INLINE, m_params.initValue);
m_vkd.cmdClearAttachments(*m_commandBuffer, 1, &clearAttachment, static_cast<deUint32>(clearRects.size()), &clearRects[0]);
accessMask, // VkAccessFlags srcAccessMask
VK_ACCESS_TRANSFER_READ_BIT, // VkAccessFlags dstAccessMask
attachmentLayout, // VkImageLayout oldLayout;
- VK_IMAGE_LAYOUT_GENERAL); // VkImageLayout newLayout;
+ VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout newLayout;
+ aspectMask); // VkImageAspectFlags aspectMask;
endCommandBuffer();
submitCommandBuffer();
"2d",
"3d"
};
- return de::getSizedArrayElement<VK_IMAGE_TYPE_LAST>(s_names, type);
+ return s_names[type];
}
const char* getImageTilingCaseName (VkImageTiling tiling)
"optimal",
"linear",
};
- return de::getSizedArrayElement<VK_IMAGE_TILING_LAST>(s_names, tiling);
+ return s_names[tiling];
}
TestCaseGroup* createImageClearingTestsCommon (TestContext& testCtx, tcu::TestCaseGroup* imageClearingTests, AllocationKind allocationKind)
};
// Include test cases with VK_REMAINING_ARRAY_LAYERS when using vkCmdClearColorImage
- const size_t numOfImageLayerParamsToTest = DE_LENGTH_OF_ARRAY(imageLayerParamsToTest);
+ const size_t numOfImageLayerParamsToTest = DE_LENGTH_OF_ARRAY(imageLayerParamsToTest);
// Exclude test cases with VK_REMAINING_ARRAY_LAYERS when using vkCmdClearAttachments
- const size_t numOfAttachmentLayerParamsToTest = numOfImageLayerParamsToTest - 2;
+ const size_t numOfAttachmentLayerParamsToTest = numOfImageLayerParamsToTest - 2;
+
+ const VkExtent3D imageDimensions[] =
+ {
+ { 256, 1, 1},
+ { 256, 256, 1},
+ { 256, 256, 16},
+ { 200, 1, 1},
+ { 200, 180, 1},
+ { 200, 180, 16},
+ { 71, 1, 1},
+ { 1, 33, 1},
+ { 55, 21, 11},
+ { 64, 11, 1},
+ { 33, 128, 1},
+ { 32, 29, 3}
+ };
// Clear color image
{
};
const size_t numOfImageTypesToTest = DE_LENGTH_OF_ARRAY(imageTypesToTest);
- const VkImageTiling imageTilingsToTest[] =
+ const VkImageTiling imageTilingsToTest[] =
{
VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_TILING_LINEAR,
};
const size_t numOfImageTilingsToTest = DE_LENGTH_OF_ARRAY(imageTilingsToTest);
- const VkExtent3D imageDimensionsByType[] =
- {
- { 256, 1, 1},
- { 256, 256, 1},
- { 256, 256, 16}
- };
-
for (size_t imageTypeIndex = 0; imageTypeIndex < numOfImageTypesToTest; ++imageTypeIndex)
{
de::MovePtr<TestCaseGroup> imageTypeGroup(new TestCaseGroup(testCtx, getImageTypeCaseName(imageTypesToTest[imageTypeIndex]), ""));
de::MovePtr<TestCaseGroup> imageLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, ""));
- for (size_t imageFormatIndex = 0; imageFormatIndex < numOfColorImageFormatsToTest; ++imageFormatIndex)
+ for (size_t imageDimensionsIndex = 0; imageDimensionsIndex < DE_LENGTH_OF_ARRAY(imageDimensions); ++imageDimensionsIndex)
{
- const VkFormat format = colorImageFormatsToTest[imageFormatIndex];
- const std::string testCaseName = getFormatCaseName(format);
- const TestParams testParams =
+ const VkExtent3D dimensions = imageDimensions[imageDimensionsIndex];
+ const std::string dimensionsString = extentToString(dimensions, imageTypesToTest[imageTypeIndex]);
+
+ if (imageTypesToTest[imageTypeIndex] == VK_IMAGE_TYPE_1D && dimensions.height > 1)
+ continue;
+ if (imageTypesToTest[imageTypeIndex] == VK_IMAGE_TYPE_2D && (dimensions.depth > 1 || dimensions.height == 1))
+ continue;
+ if (imageTypesToTest[imageTypeIndex] == VK_IMAGE_TYPE_3D && dimensions.depth == 1)
+ continue;
+
+ for (size_t imageFormatIndex = 0; imageFormatIndex < numOfColorImageFormatsToTest; ++imageFormatIndex)
{
- false, // bool useSingleMipLevel;
- imageTypesToTest[imageTypeIndex], // VkImageType imageType;
- format, // VkFormat imageFormat;
- imageTilingsToTest[imageTilingIndex], // VkImageTiling imageTiling;
- imageDimensionsByType[imageTypeIndex], // VkExtent3D imageExtent;
- imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount, // deUint32 imageLayerCount;
+ const VkFormat format = colorImageFormatsToTest[imageFormatIndex];
+ const std::string testCaseName = getFormatCaseName(format) + dimensionsString;
+ const TestParams testParams =
{
- 0u,
- imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount
- }, // LayerRange imageViewLayerRange;
- makeClearColorValue(format, 0.2f, 0.1f, 0.7f, 0.8f), // VkClearValue initValue;
- {
- makeClearColorValue(format, 0.1f, 0.5f, 0.3f, 0.9f), // VkClearValue clearValue[0];
- makeClearColorValue(format, 0.3f, 0.6f, 0.2f, 0.7f), // VkClearValue clearValue[1];
- },
- imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
- allocationKind, // AllocationKind allocationKind;
- false // bool isCube;
- };
- if (!imageLayerParamsToTest[imageLayerParamsIndex].twoStep)
- imageLayersGroup->addChild(new InstanceFactory1<ClearColorImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Image", testParams));
- else
- imageLayersGroup->addChild(new InstanceFactory1<TwoStepClearColorImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Image", testParams));
+ false, // bool useSingleMipLevel;
+ imageTypesToTest[imageTypeIndex], // VkImageType imageType;
+ format, // VkFormat imageFormat;
+ imageTilingsToTest[imageTilingIndex], // VkImageTiling imageTiling;
+ dimensions, // VkExtent3D imageExtent;
+ imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount, // deUint32 imageLayerCount;
+ {
+ 0u,
+ imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount
+ }, // LayerRange imageViewLayerRange;
+ makeClearColorValue(format, 0.2f, 0.1f, 0.7f, 0.8f), // VkClearValue initValue;
+ {
+ makeClearColorValue(format, 0.1f, 0.5f, 0.3f, 0.9f), // VkClearValue clearValue[0];
+ makeClearColorValue(format, 0.3f, 0.6f, 0.2f, 0.7f), // VkClearValue clearValue[1];
+ },
+ imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
+ allocationKind, // AllocationKind allocationKind;
+ false, // bool isCube;
+ SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_NONE, // SeparateDepthStencilLayoutMode separateDepthStencilLayoutMode;
+ };
+ if (!imageLayerParamsToTest[imageLayerParamsIndex].twoStep)
+ imageLayersGroup->addChild(new InstanceFactory1<ClearColorImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Image", testParams));
+ else
+ imageLayersGroup->addChild(new InstanceFactory1<TwoStepClearColorImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Image", testParams));
+ }
}
imageTilingGroup->addChild(imageLayersGroup.release());
}
de::MovePtr<TestCaseGroup> imageLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, ""));
- for (size_t imageFormatIndex = 0; imageFormatIndex < numOfDepthStencilImageFormatsToTest; ++imageFormatIndex)
+ for (size_t imageDimensionsIndex = 0; imageDimensionsIndex < DE_LENGTH_OF_ARRAY(imageDimensions); ++imageDimensionsIndex)
{
- const VkFormat format = depthStencilImageFormatsToTest[imageFormatIndex];
- const std::string testCaseName = getFormatCaseName(format);
- const TestParams testParams =
+ const VkExtent3D dimensions = imageDimensions[imageDimensionsIndex];
+ const std::string dimensionsString = extentToString(dimensions, VK_IMAGE_TYPE_2D);
+
+ if (dimensions.height == 1 || dimensions.depth > 1)
+ continue;
+
+ for (size_t imageFormatIndex = 0; imageFormatIndex < numOfDepthStencilImageFormatsToTest; ++imageFormatIndex)
{
- true, // bool useSingleMipLevel;
- VK_IMAGE_TYPE_2D, // VkImageType imageType;
- format, // VkFormat format;
- VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
- { 256, 256, 1 }, // VkExtent3D extent;
- imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount, // deUint32 imageLayerCount;
- {
- 0u,
- imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount
- }, // LayerRange imageViewLayerRange;
- makeClearValueDepthStencil(0.5f, 0x03), // VkClearValue initValue
+ const VkFormat format = depthStencilImageFormatsToTest[imageFormatIndex];
+ const bool hasDepth = tcu::hasDepthComponent(mapVkFormat(format).order);
+ const bool hasStencil = tcu::hasStencilComponent(mapVkFormat(format).order);
+ const int separateLayoutsLoopCount = (hasDepth && hasStencil) ? 3 : 1;
+
+ for (int separateDepthStencilLayoutMode = 0; separateDepthStencilLayoutMode < separateLayoutsLoopCount; ++separateDepthStencilLayoutMode)
{
- makeClearValueDepthStencil(0.1f, 0x06), // VkClearValue clearValue[0];
- makeClearValueDepthStencil(0.3f, 0x04), // VkClearValue clearValue[1];
- },
- imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
- allocationKind, // AllocationKind allocationKind;
- false // bool isCube;
- };
-
- if (!imageLayerParamsToTest[imageLayerParamsIndex].twoStep)
- imageLayersGroup->addChild(new InstanceFactory1<ClearDepthStencilImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Image", testParams));
- else
- imageLayersGroup->addChild(new InstanceFactory1<TwoStepClearDepthStencilImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Image", testParams));
+ const std::string testCaseName = getFormatCaseName(format) +
+ ((separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_DEPTH) ? "_separate_layouts_depth" :
+ (separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_STENCIL) ? "_separate_layouts_stencil" :
+ "")
+ + dimensionsString;
+ const TestParams testParams =
+ {
+ true, // bool useSingleMipLevel;
+ VK_IMAGE_TYPE_2D, // VkImageType imageType;
+ format, // VkFormat format;
+ VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
+ dimensions, // VkExtent3D extent;
+ imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount, // deUint32 imageLayerCount;
+ {
+ 0u,
+ imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount
+ }, // LayerRange imageViewLayerRange;
+ makeClearValueDepthStencil(0.5f, 0x03), // VkClearValue initValue
+ {
+ makeClearValueDepthStencil(0.1f, 0x06), // VkClearValue clearValue[0];
+ makeClearValueDepthStencil(0.3f, 0x04), // VkClearValue clearValue[1];
+ },
+ imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
+ allocationKind, // AllocationKind allocationKind;
+ false, // bool isCube;
+ SeparateDepthStencilLayoutMode(separateDepthStencilLayoutMode), // SeparateDepthStencilLayoutMode separateDepthStencilLayoutMode;
+ };
+
+ if (!imageLayerParamsToTest[imageLayerParamsIndex].twoStep)
+ imageLayersGroup->addChild(new InstanceFactory1<ClearDepthStencilImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Image", testParams));
+ else
+ imageLayersGroup->addChild(new InstanceFactory1<TwoStepClearDepthStencilImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Image", testParams));
+ }
+ }
}
depthStencilImageClearTests->addChild(imageLayersGroup.release());
}
de::MovePtr<TestCaseGroup> colorAttachmentClearLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, ""));
de::MovePtr<TestCaseGroup> partialColorAttachmentClearLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, ""));
- for (size_t imageFormatIndex = 0; imageFormatIndex < numOfColorImageFormatsToTest; ++imageFormatIndex)
+ for (size_t imageDimensionsIndex = 0; imageDimensionsIndex < DE_LENGTH_OF_ARRAY(imageDimensions); ++imageDimensionsIndex)
{
- const VkFormat format = colorImageFormatsToTest[imageFormatIndex];
- const std::string testCaseName = getFormatCaseName(format);
- const TestParams testParams =
+ const VkExtent3D dimensions = imageDimensions[imageDimensionsIndex];
+ const std::string dimensionsString = extentToString(dimensions, VK_IMAGE_TYPE_2D);
+
+ if (dimensions.height == 1 || dimensions.depth > 1)
+ continue;
+
+ if (imageLayerParamsToTest[imageLayerParamsIndex].isCube && dimensions.width != dimensions.height)
+ continue;
+
+ for (size_t imageFormatIndex = 0; imageFormatIndex < numOfColorImageFormatsToTest; ++imageFormatIndex)
{
- true, // bool useSingleMipLevel;
- VK_IMAGE_TYPE_2D, // VkImageType imageType;
- format, // VkFormat format;
- VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
- { 256, 256, 1 }, // VkExtent3D extent;
- imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount, // deUint32 imageLayerCount;
- imageLayerParamsToTest[imageLayerParamsIndex].imageViewRange, // LayerRange imageViewLayerRange;
- makeClearColorValue(format, 0.2f, 0.1f, 0.7f, 0.8f), // VkClearValue initValue
+ const VkFormat format = colorImageFormatsToTest[imageFormatIndex];
+ const std::string testCaseName = getFormatCaseName(format) + dimensionsString;
+ const TestParams testParams =
{
- makeClearColorValue(format, 0.1f, 0.5f, 0.3f, 0.9f), // VkClearValue clearValue[0];
- makeClearColorValue(format, 0.3f, 0.6f, 0.2f, 0.7f), // VkClearValue clearValue[1];
- },
- imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
- allocationKind, // AllocationKind allocationKind;
- imageLayerParamsToTest[imageLayerParamsIndex].isCube // bool isCube;
- };
- colorAttachmentClearLayersGroup->addChild(new InstanceFactory1<ClearAttachmentTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Attachment", testParams));
- partialColorAttachmentClearLayersGroup->addChild(new InstanceFactory1<PartialClearAttachmentTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Partial Clear Color Attachment", testParams));
+ true, // bool useSingleMipLevel;
+ VK_IMAGE_TYPE_2D, // VkImageType imageType;
+ format, // VkFormat format;
+ VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
+ dimensions, // VkExtent3D extent;
+ imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount, // deUint32 imageLayerCount;
+ imageLayerParamsToTest[imageLayerParamsIndex].imageViewRange, // LayerRange imageViewLayerRange;
+ makeClearColorValue(format, 0.2f, 0.1f, 0.7f, 0.8f), // VkClearValue initValue
+ {
+ makeClearColorValue(format, 0.1f, 0.5f, 0.3f, 0.9f), // VkClearValue clearValue[0];
+ makeClearColorValue(format, 0.3f, 0.6f, 0.2f, 0.7f), // VkClearValue clearValue[1];
+ },
+ imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
+ allocationKind, // AllocationKind allocationKind;
+ imageLayerParamsToTest[imageLayerParamsIndex].isCube, // bool isCube;
+ SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_NONE, // SeparateDepthStencilLayoutMode separateDepthStencilLayoutMode;
+ };
+ colorAttachmentClearLayersGroup->addChild(new InstanceFactory1<ClearAttachmentTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Attachment", testParams));
+ if (dimensions.width > 1)
+ partialColorAttachmentClearLayersGroup->addChild(new InstanceFactory1<PartialClearAttachmentTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Partial Clear Color Attachment", testParams));
+ }
}
colorAttachmentClearTests->addChild(colorAttachmentClearLayersGroup.release());
partialColorAttachmentClearTests->addChild(partialColorAttachmentClearLayersGroup.release());
de::MovePtr<TestCaseGroup> depthStencilLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, ""));
de::MovePtr<TestCaseGroup> partialDepthStencilLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, ""));
- for (size_t imageFormatIndex = 0; imageFormatIndex < numOfDepthStencilImageFormatsToTest; ++imageFormatIndex)
+ for (size_t imageDimensionsIndex = 0; imageDimensionsIndex < DE_LENGTH_OF_ARRAY(imageDimensions); ++imageDimensionsIndex)
{
- const VkFormat format = depthStencilImageFormatsToTest[imageFormatIndex];
- const std::string testCaseName = getFormatCaseName(format);
- const TestParams testParams =
+ const VkExtent3D dimensions = imageDimensions[imageDimensionsIndex];
+ const std::string dimensionsString = extentToString(dimensions, VK_IMAGE_TYPE_2D);
+
+ if (dimensions.height == 1 || dimensions.depth > 1)
+ continue;
+
+ if (imageLayerParamsToTest[imageLayerParamsIndex].isCube && dimensions.width != dimensions.height)
+ continue;
+
+ for (size_t imageFormatIndex = 0; imageFormatIndex < numOfDepthStencilImageFormatsToTest; ++imageFormatIndex)
{
- true, // bool useSingleMipLevel;
- VK_IMAGE_TYPE_2D, // VkImageType imageType;
- format, // VkFormat format;
- VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
- { 256, 256, 1 }, // VkExtent3D extent;
- imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount, // deUint32 imageLayerCount;
- imageLayerParamsToTest[imageLayerParamsIndex].imageViewRange, // LayerRange imageViewLayerRange;
- makeClearValueDepthStencil(0.5f, 0x03), // VkClearValue initValue
+ const VkFormat format = depthStencilImageFormatsToTest[imageFormatIndex];
+ const bool hasDepth = tcu::hasDepthComponent(mapVkFormat(format).order);
+ const bool hasStencil = tcu::hasStencilComponent(mapVkFormat(format).order);
+ const int separateLayoutsLoopCount = (hasDepth && hasStencil) ? 3 : 1;
+
+ for (int separateDepthStencilLayoutMode = 0; separateDepthStencilLayoutMode < separateLayoutsLoopCount; ++separateDepthStencilLayoutMode)
{
- makeClearValueDepthStencil(0.1f, 0x06), // VkClearValue clearValue[0];
- makeClearValueDepthStencil(0.3f, 0x04), // VkClearValue clearValue[1];
- },
- imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
- allocationKind, // AllocationKind allocationKind;
- imageLayerParamsToTest[imageLayerParamsIndex].isCube // bool isCube;
- };
- depthStencilLayersGroup->addChild(new InstanceFactory1<ClearAttachmentTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Attachment", testParams));
- partialDepthStencilLayersGroup->addChild(new InstanceFactory1<PartialClearAttachmentTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Parital Clear Depth/Stencil Attachment", testParams));
+ const std::string testCaseName = getFormatCaseName(format) +
+ ((separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_DEPTH) ? "_separate_layouts_depth" :
+ (separateDepthStencilLayoutMode == SEPARATE_DEPTH_STENCIL_LAYOUT_MODE_STENCIL) ? "_separate_layouts_stencil" :
+ "")
+ + dimensionsString;
+
+ const TestParams testParams =
+ {
+ true, // bool useSingleMipLevel;
+ VK_IMAGE_TYPE_2D, // VkImageType imageType;
+ format, // VkFormat format;
+ VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
+ dimensions, // VkExtent3D extent;
+ imageLayerParamsToTest[imageLayerParamsIndex].imageLayerCount, // deUint32 imageLayerCount;
+ imageLayerParamsToTest[imageLayerParamsIndex].imageViewRange, // LayerRange imageViewLayerRange;
+ makeClearValueDepthStencil(0.5f, 0x03), // VkClearValue initValue
+ {
+ makeClearValueDepthStencil(0.1f, 0x06), // VkClearValue clearValue[0];
+ makeClearValueDepthStencil(0.3f, 0x04), // VkClearValue clearValue[1];
+ },
+ imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
+ allocationKind, // AllocationKind allocationKind;
+ imageLayerParamsToTest[imageLayerParamsIndex].isCube, // bool isCube;
+ SeparateDepthStencilLayoutMode(separateDepthStencilLayoutMode), // SeparateDepthStencilLayoutMode separateDepthStencilLayoutMode;
+ };
+ depthStencilLayersGroup->addChild(new InstanceFactory1<ClearAttachmentTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Attachment", testParams));
+ if (dimensions.width > 1)
+ partialDepthStencilLayersGroup->addChild(new InstanceFactory1<PartialClearAttachmentTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Partial Clear Depth/Stencil Attachment", testParams));
+ }
+ }
}
depthStencilAttachmentClearTests->addChild(depthStencilLayersGroup.release());
partialDepthStencilAttachmentClearTests->addChild(partialDepthStencilLayersGroup.release());