Add tests for resolving between images of different sizes
authorSlawomir Cygan <slawomir.cygan@intel.com>
Mon, 28 Nov 2016 18:28:01 +0000 (19:28 +0100)
committerPyry Haulos <phaulos@google.com>
Wed, 18 Jan 2017 18:37:49 +0000 (10:37 -0800)
New tests: dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size*

This change adds new tests, which try to resolve data between images of
different sizes. As some implementations may optimize resolves of whole
images, this tests tricks implementation by having resolve region equal
one of dst/src image size, while the other image is larger.

`FILL_MODE_MULTISAMPLE` logic was tweaked to work properly on non-square src images
- this is required by new tests.

Change-Id: If15f500e0e4b2b574f1441da71e5d57e690f8f43

android/cts/master/vk-master.txt
external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
external/vulkancts/mustpass/1.0.2/vk-default.txt

index 34a05ae..d2bfa17 100644 (file)
@@ -16125,6 +16125,42 @@ dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image_8_bit
 dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image_16_bit
 dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image_32_bit
 dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_64_bit
 dEQP-VK.api.image_clearing.clear_color_image.1d_r4g4_unorm_pack8
 dEQP-VK.api.image_clearing.clear_color_image.1d_r4g4b4a4_unorm_pack16
 dEQP-VK.api.image_clearing.clear_color_image.1d_b4g4r4a4_unorm_pack16
index 49ec184..9840b50 100644 (file)
@@ -337,8 +337,12 @@ void CopiesAndBlittingTestInstance::generateBuffer (tcu::PixelBufferAccess buffe
                                break;
 
                        case FILL_MODE_MULTISAMPLE:
-                               buffer.setPixel((x == y) ? tcu::Vec4(0.0, 0.5, 0.5, 1.0) : ((x > y) ? greenColor : blueColor), x, y, z);
+                       {
+                               float xScaled = static_cast<float>(x) / static_cast<float>(width);
+                               float yScaled = static_cast<float>(y) / static_cast<float>(height);
+                               buffer.setPixel((xScaled == yScaled) ? tcu::Vec4(0.0, 0.5, 0.5, 1.0) : ((xScaled > yScaled) ? greenColor : blueColor), x, y, z);
                                break;
+                       }
 
                        default:
                                break;
@@ -5370,6 +5374,77 @@ tcu::TestCaseGroup* createCopiesAndBlittingTests (tcu::TestContext& testCtx)
                }
        }
 
+       {
+               const std::string       description     ("Resolve from image to image of different size");
+               const std::string       testName        ("diff_image_size");
+
+               TestParams                      params;
+               params.src.image.imageType              =       VK_IMAGE_TYPE_2D;
+               params.src.image.format                 =       VK_FORMAT_R8G8B8A8_UNORM;
+               params.dst.image.imageType              =       VK_IMAGE_TYPE_2D;
+               params.dst.image.format                 =       VK_FORMAT_R8G8B8A8_UNORM;
+
+               {
+                       const VkImageSubresourceLayers  sourceLayer     =
+                       {
+                               VK_IMAGE_ASPECT_COLOR_BIT,      // VkImageAspectFlags   aspectMask;
+                               0u,                                                     // uint32_t                             mipLevel;
+                               0u,                                                     // uint32_t                             baseArrayLayer;
+                               1u                                                      // uint32_t                             layerCount;
+                       };
+                       const VkImageResolve                    testResolve     =
+                       {
+                               sourceLayer,    // VkImageSubresourceLayers     srcSubresource;
+                               {0, 0, 0},              // VkOffset3D                           srcOffset;
+                               sourceLayer,    // VkImageSubresourceLayers     dstSubresource;
+                               {0, 0, 0},              // VkOffset3D                           dstOffset;
+                               resolveExtent,  // VkExtent3D                           extent;
+                       };
+
+                       CopyRegion      imageResolve;
+                       imageResolve.imageResolve       = testResolve;
+                       params.regions.push_back(imageResolve);
+               }
+
+               const VkExtent3D imageExtents[]         =
+               {
+                       { resolveExtent.width + 10,     resolveExtent.height,           resolveExtent.depth },
+                       { resolveExtent.width,          resolveExtent.height * 2,       resolveExtent.depth },
+                       { resolveExtent.width,          resolveExtent.height,           resolveExtent.depth + 10 }
+               };
+
+               for (int srcImageExtentIndex = 0; srcImageExtentIndex < DE_LENGTH_OF_ARRAY(imageExtents); ++srcImageExtentIndex)
+               {
+                       const VkExtent3D&       srcImageSize    = imageExtents[srcImageExtentIndex];
+
+                       params.src.image.extent                         = srcImageSize;
+                       params.dst.image.extent                         = resolveExtent;
+
+                       for (int samplesIndex = 0; samplesIndex < DE_LENGTH_OF_ARRAY(samples); ++samplesIndex)
+                       {
+                               params.samples = samples[samplesIndex];
+                               std::ostringstream caseName;
+                               caseName << testName << "_src_" << srcImageSize.width << "_" << srcImageSize.height << "_" << srcImageSize.depth << "_" << getSampleCountCaseName(samples[samplesIndex]);
+                               resolveImageTests->addChild(new ResolveImageToImageTestCase(testCtx, caseName.str(), description, params));
+                       }
+               }
+
+               for (int dstImageExtentIndex = 0; dstImageExtentIndex < DE_LENGTH_OF_ARRAY(imageExtents); ++dstImageExtentIndex)
+               {
+                       const VkExtent3D&       dstImageSize    = imageExtents[dstImageExtentIndex];
+                       params.src.image.extent                         = resolveExtent;
+                       params.dst.image.extent                         = dstImageSize;
+
+                       for (int samplesIndex = 0; samplesIndex < DE_LENGTH_OF_ARRAY(samples); ++samplesIndex)
+                       {
+                               params.samples = samples[samplesIndex];
+                               std::ostringstream caseName;
+                               caseName << testName << "_dst_" << dstImageSize.width << "_" << dstImageSize.height << "_" << dstImageSize.depth << "_" << getSampleCountCaseName(samples[samplesIndex]);
+                               resolveImageTests->addChild(new ResolveImageToImageTestCase(testCtx, caseName.str(), description, params));
+                       }
+               }
+       }
+
        copiesAndBlittingTests->addChild(imageToImageTests.release());
        copiesAndBlittingTests->addChild(imageToBufferTests.release());
        copiesAndBlittingTests->addChild(bufferToImageTests.release());
index f0dc430..08642d9 100644 (file)
@@ -16124,6 +16124,42 @@ dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image_8_bit
 dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image_16_bit
 dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image_32_bit
 dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_266_256_1_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_512_1_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_src_256_256_11_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_266_256_1_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_512_1_64_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_2_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_4_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_8_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_16_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_32_bit
+dEQP-VK.api.copy_and_blit.resolve_image.diff_image_size_dst_256_256_11_64_bit
 dEQP-VK.api.image_clearing.clear_color_image.1d_r4g4_unorm_pack8
 dEQP-VK.api.image_clearing.clear_color_image.1d_r4g4b4a4_unorm_pack16
 dEQP-VK.api.image_clearing.clear_color_image.1d_b4g4r4a4_unorm_pack16