class ClearColorImageTestInstance : public ImageClearingTestInstance
{
public:
- ClearColorImageTestInstance (Context& context, const TestParams& testParams) : ImageClearingTestInstance (context, testParams) {}
+ ClearColorImageTestInstance (Context& context, const TestParams& testParams, bool twoStep = false) : ImageClearingTestInstance (context, testParams), m_twoStep(twoStep) {}
TestStatus iterate (void);
+protected:
+ bool m_twoStep;
+};
+
+class TwoStepClearColorImageTestInstance : public ClearColorImageTestInstance
+{
+public:
+ TwoStepClearColorImageTestInstance (Context& context, const TestParams& testParams) : ClearColorImageTestInstance(context, testParams, true) {}
};
TestStatus ClearColorImageTestInstance::iterate (void)
{
std::vector<VkImageSubresourceRange> subresourceRanges;
+ std::vector<VkImageSubresourceRange> steptwoRanges;
if (m_imageMipLevels == 1)
- subresourceRanges.push_back(makeImageSubresourceRange(m_imageAspectFlags, 0u, 1u, m_params.clearLayerRange.baseArrayLayer, m_params.clearLayerRange.layerCount));
+ {
+ subresourceRanges.push_back(makeImageSubresourceRange(m_imageAspectFlags, 0u, 1u, m_params.clearLayerRange.baseArrayLayer, m_twoStep ? 1 : m_params.clearLayerRange.layerCount));
+ steptwoRanges.push_back( makeImageSubresourceRange(m_imageAspectFlags, 0u, VK_REMAINING_MIP_LEVELS, m_params.clearLayerRange.baseArrayLayer, VK_REMAINING_ARRAY_LAYERS));
+ }
else
{
- subresourceRanges.push_back(makeImageSubresourceRange(m_imageAspectFlags, 0u, m_thresholdMipLevel, m_params.clearLayerRange.baseArrayLayer, m_params.clearLayerRange.layerCount));
- subresourceRanges.push_back(makeImageSubresourceRange(m_imageAspectFlags, m_thresholdMipLevel, VK_REMAINING_MIP_LEVELS, m_params.clearLayerRange.baseArrayLayer, m_params.clearLayerRange.layerCount));
+ subresourceRanges.push_back(makeImageSubresourceRange(m_imageAspectFlags, 0u, m_thresholdMipLevel, m_params.clearLayerRange.baseArrayLayer, m_params.clearLayerRange.layerCount));
+ subresourceRanges.push_back(makeImageSubresourceRange(m_imageAspectFlags, m_thresholdMipLevel, VK_REMAINING_MIP_LEVELS, m_params.clearLayerRange.baseArrayLayer, m_params.clearLayerRange.layerCount));
+ steptwoRanges.push_back( makeImageSubresourceRange(m_imageAspectFlags, 0u, m_thresholdMipLevel, m_params.clearLayerRange.baseArrayLayer, VK_REMAINING_ARRAY_LAYERS));
+ steptwoRanges.push_back( makeImageSubresourceRange(m_imageAspectFlags, m_thresholdMipLevel, VK_REMAINING_MIP_LEVELS, m_params.clearLayerRange.baseArrayLayer, VK_REMAINING_ARRAY_LAYERS));
}
beginCommandBuffer(0);
// Different clear color per range
for (std::size_t i = 0u; i < subresourceRanges.size(); ++i)
+ {
m_vkd.cmdClearColorImage(*m_commandBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &m_params.clearValue[i].color, 1, &subresourceRanges[i]);
+ if (m_twoStep)
+ m_vkd.cmdClearColorImage(*m_commandBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &m_params.clearValue[i].color, 1, &steptwoRanges[i]);
+ }
pipelineImageBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, // VkPipelineStageFlags srcStageMask
VK_PIPELINE_STAGE_TRANSFER_BIT, // VkPipelineStageFlags dstStageMask
class ClearDepthStencilImageTestInstance : public ImageClearingTestInstance
{
public:
- ClearDepthStencilImageTestInstance (Context& context, const TestParams& testParams) : ImageClearingTestInstance (context, testParams) {}
+ ClearDepthStencilImageTestInstance (Context& context, const TestParams& testParams, bool twoStep = false) : ImageClearingTestInstance (context, testParams), m_twoStep(twoStep) {}
TestStatus iterate (void);
+protected:
+ bool m_twoStep;
+};
+
+class TwoStepClearDepthStencilImageTestInstance : public ClearDepthStencilImageTestInstance
+{
+public:
+ TwoStepClearDepthStencilImageTestInstance (Context& context, const TestParams& testParams) : ClearDepthStencilImageTestInstance (context, testParams, true) { }
};
TestStatus ClearDepthStencilImageTestInstance::iterate (void)
{
- const VkImageSubresourceRange subresourceRange = makeImageSubresourceRange(m_imageAspectFlags, 0u, 1u, m_params.clearLayerRange.baseArrayLayer, m_params.clearLayerRange.layerCount);
+ 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);
beginCommandBuffer(0);
m_vkd.cmdClearDepthStencilImage(*m_commandBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &m_params.clearValue[0].depthStencil, 1, &subresourceRange);
+ if (m_twoStep)
+ m_vkd.cmdClearDepthStencilImage(*m_commandBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &m_params.clearValue[0].depthStencil, 1, &steptwoRange);
+
pipelineImageBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, // VkPipelineStageFlags srcStageMask
VK_PIPELINE_STAGE_TRANSFER_BIT, // VkPipelineStageFlags dstStageMask
VK_ACCESS_TRANSFER_WRITE_BIT, // VkAccessFlags srcAccessMask
deUint32 imageLayerCount;
LayerRange imageViewRange;
LayerRange clearLayerRange;
+ bool twoStep;
const char* testName;
};
const ImageLayerParams imageLayerParamsToTest[] =
1u, // imageLayerCount
{0u, 1u}, // imageViewRange
{0u, 1u}, // clearLayerRange
+ false, // twoStep
"single_layer" // testName
},
{
16u, // imageLayerCount
{3u, 12u}, // imageViewRange
{2u, 5u}, // clearLayerRange
+ false, // twoStep
"multiple_layers" // testName
},
{
16u, // imageLayerCount
{ 3u, 12u }, // imageViewRange
{ 8u, VK_REMAINING_ARRAY_LAYERS }, // clearLayerRange
+ false, // twoStep
"remaining_array_layers" // testName
+ },
+ {
+ 16u, // imageLayerCount
+ { 3u, 12u }, // imageViewRange
+ { 8u, VK_REMAINING_ARRAY_LAYERS }, // clearLayerRange
+ true, // twoStep
+ "remaining_array_layers_twostep" // testName
}
};
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 - 1;
+ const size_t numOfAttachmentLayerParamsToTest = numOfImageLayerParamsToTest - 2;
// Clear color image
{
imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
allocationKind // AllocationKind allocationKind;
};
-
- imageLayersGroup->addChild(new InstanceFactory1<ClearColorImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Image", testParams));
+ 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));
}
imageTypeGroup->addChild(imageLayersGroup.release());
}
allocationKind // AllocationKind allocationKind;
};
- imageLayersGroup->addChild(new InstanceFactory1<ClearDepthStencilImageTestInstance, TestParams>(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Image", testParams));
+ 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());
}
{
for (size_t imageLayerParamsIndex = 0; imageLayerParamsIndex < numOfAttachmentLayerParamsToTest; ++imageLayerParamsIndex)
{
- 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)
+ if (!imageLayerParamsToTest[imageLayerParamsIndex].twoStep)
{
- const VkFormat format = colorImageFormatsToTest[imageFormatIndex];
- const std::string testCaseName = getFormatCaseName(format);
- const TestParams testParams =
+ 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)
{
- true, // bool useSingleMipLevel;
- VK_IMAGE_TYPE_2D, // VkImageType imageType;
- format, // VkFormat format;
- { 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);
+ 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;
- };
-
- 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;
+ { 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
+ {
+ 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;
+ };
+ 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));
+ }
+ colorAttachmentClearTests->addChild(colorAttachmentClearLayersGroup.release());
+ partialColorAttachmentClearTests->addChild(partialColorAttachmentClearLayersGroup.release());
}
- colorAttachmentClearTests->addChild(colorAttachmentClearLayersGroup.release());
- partialColorAttachmentClearTests->addChild(partialColorAttachmentClearLayersGroup.release());
}
imageClearingTests->addChild(colorAttachmentClearTests.release());
imageClearingTests->addChild(partialColorAttachmentClearTests.release());
{
for (size_t imageLayerParamsIndex = 0; imageLayerParamsIndex < numOfAttachmentLayerParamsToTest; ++imageLayerParamsIndex)
{
- 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)
+ if (!imageLayerParamsToTest[imageLayerParamsIndex].twoStep)
{
- const VkFormat format = depthStencilImageFormatsToTest[imageFormatIndex];
- const std::string testCaseName = getFormatCaseName(format);
- const TestParams testParams =
+ 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)
{
- true, // bool useSingleMipLevel;
- VK_IMAGE_TYPE_2D, // VkImageType imageType;
- format, // VkFormat format;
- { 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 std::string testCaseName = getFormatCaseName(format);
+ const TestParams testParams =
{
- makeClearValueDepthStencil(0.1f, 0x06), // VkClearValue clearValue[0];
- makeClearValueDepthStencil(0.3f, 0x04), // VkClearValue clearValue[1];
- },
- imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange;
- allocationKind // AllocationKind allocationKind;
- };
-
- 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));
+ true, // bool useSingleMipLevel;
+ VK_IMAGE_TYPE_2D, // VkImageType imageType;
+ format, // VkFormat format;
+ { 256, 256, 1 }, // 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;
+ };
+ 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));
+ }
+ depthStencilAttachmentClearTests->addChild(depthStencilLayersGroup.release());
+ partialDepthStencilAttachmentClearTests->addChild(partialDepthStencilLayersGroup.release());
}
- depthStencilAttachmentClearTests->addChild(depthStencilLayersGroup.release());
- partialDepthStencilAttachmentClearTests->addChild(partialDepthStencilLayersGroup.release());
}
imageClearingTests->addChild(depthStencilAttachmentClearTests.release());
imageClearingTests->addChild(partialDepthStencilAttachmentClearTests.release());