X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=external%2Fvulkancts%2Fmodules%2Fvulkan%2Fapi%2FvktApiImageClearingTests.cpp;h=beebce13432923bffb0c933c924e347d71a9f0e0;hb=053c95474556c4c0d19a0dd97705731683c83047;hp=b167d8573a2dec2eee278c70a0d9e5b50e050685;hpb=164e1e260bd969d5d7e11264a0993b3afa151b7d;p=platform%2Fupstream%2FVK-GL-CTS.git diff --git a/external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp index b167d85..beebce1 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiImageClearingTests.cpp @@ -151,7 +151,7 @@ deUint32 greatestCommonDivisor (const deUint32 a, const deUint32 b) deUint32 x=a; deUint32 y=b; - while (x%b != 0) + while (x%y != 0) { temp = y; y = x%y; @@ -1142,20 +1142,34 @@ void ImageClearingTestInstance::beginRenderPass (VkSubpassContents content, VkCl 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 subresourceRanges; + std::vector 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); @@ -1186,7 +1200,11 @@ TestStatus ClearColorImageTestInstance::iterate (void) // 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 @@ -1204,13 +1222,22 @@ TestStatus ClearColorImageTestInstance::iterate (void) 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); @@ -1240,6 +1267,9 @@ TestStatus ClearDepthStencilImageTestInstance::iterate (void) 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 @@ -1633,6 +1663,7 @@ TestCaseGroup* createImageClearingTestsCommon (TestContext& testCtx, tcu::TestCa deUint32 imageLayerCount; LayerRange imageViewRange; LayerRange clearLayerRange; + bool twoStep; const char* testName; }; const ImageLayerParams imageLayerParamsToTest[] = @@ -1641,19 +1672,29 @@ TestCaseGroup* createImageClearingTestsCommon (TestContext& testCtx, tcu::TestCa 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 } }; @@ -1661,7 +1702,7 @@ TestCaseGroup* createImageClearingTestsCommon (TestContext& testCtx, tcu::TestCa 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 { @@ -1715,8 +1756,10 @@ TestCaseGroup* createImageClearingTestsCommon (TestContext& testCtx, tcu::TestCa imageLayerParamsToTest[imageLayerParamsIndex].clearLayerRange, // LayerRange clearLayerRange; allocationKind // AllocationKind allocationKind; }; - - imageLayersGroup->addChild(new InstanceFactory1(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Image", testParams)); + if (!imageLayerParamsToTest[imageLayerParamsIndex].twoStep) + imageLayersGroup->addChild(new InstanceFactory1(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Image", testParams)); + else + imageLayersGroup->addChild(new InstanceFactory1(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Image", testParams)); } imageTypeGroup->addChild(imageLayersGroup.release()); } @@ -1755,7 +1798,10 @@ TestCaseGroup* createImageClearingTestsCommon (TestContext& testCtx, tcu::TestCa allocationKind // AllocationKind allocationKind; }; - imageLayersGroup->addChild(new InstanceFactory1(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Image", testParams)); + if (!imageLayerParamsToTest[imageLayerParamsIndex].twoStep) + imageLayersGroup->addChild(new InstanceFactory1(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Image", testParams)); + else + imageLayersGroup->addChild(new InstanceFactory1(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Image", testParams)); } depthStencilImageClearTests->addChild(imageLayersGroup.release()); } @@ -1766,35 +1812,37 @@ TestCaseGroup* createImageClearingTestsCommon (TestContext& testCtx, tcu::TestCa { for (size_t imageLayerParamsIndex = 0; imageLayerParamsIndex < numOfAttachmentLayerParamsToTest; ++imageLayerParamsIndex) { - de::MovePtr colorAttachmentClearLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, "")); - de::MovePtr 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 colorAttachmentClearLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, "")); + de::MovePtr 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(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Attachment", testParams)); - partialColorAttachmentClearLayersGroup->addChild(new InstanceFactory1(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(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Color Attachment", testParams)); + partialColorAttachmentClearLayersGroup->addChild(new InstanceFactory1(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()); @@ -1804,35 +1852,37 @@ TestCaseGroup* createImageClearingTestsCommon (TestContext& testCtx, tcu::TestCa { for (size_t imageLayerParamsIndex = 0; imageLayerParamsIndex < numOfAttachmentLayerParamsToTest; ++imageLayerParamsIndex) { - de::MovePtr depthStencilLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, "")); - de::MovePtr 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 depthStencilLayersGroup(new TestCaseGroup(testCtx, imageLayerParamsToTest[imageLayerParamsIndex].testName, "")); + de::MovePtr 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(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Attachment", testParams)); - partialDepthStencilLayersGroup->addChild(new InstanceFactory1(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(testCtx, NODETYPE_SELF_VALIDATE, testCaseName, "Clear Depth/Stencil Attachment", testParams)); + partialDepthStencilLayersGroup->addChild(new InstanceFactory1(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());