Test storing protected data in workgroup memory
authorAri Suonpaa <ari.suonpaa@siru.fi>
Tue, 21 Aug 2018 11:47:59 +0000 (14:47 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 18 Oct 2018 07:21:23 +0000 (03:21 -0400)
Added tests where protected image contents are passed through
workgroup memory. Moved common functions to an utility file.

New tests:

dEQP-VK.protected_memory.workgroupstorage.*

Components: Vulkan

VK-GL-CTS issue: 1076
Change-Id: Icef3b0c6e8d520946b3fa4aea3f6ae9cc1f0f72d

12 files changed:
AndroidGen.mk
android/cts/master/vk-master.txt
external/vulkancts/modules/vulkan/protected_memory/CMakeLists.txt
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemShaderImageAccessTests.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemTests.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemUtils.cpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemUtils.hpp
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWorkgroupStorageTests.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWorkgroupStorageTests.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemYCbCrConversionTests.cpp
external/vulkancts/mustpass/1.1.3/vk-default-no-waivers.txt
external/vulkancts/mustpass/1.1.3/vk-default.txt

index b3e0978..2bf8d67 100644 (file)
@@ -204,6 +204,7 @@ LOCAL_SRC_FILES := \
        external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemStorageBufferTests.cpp \
        external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemTests.cpp \
        external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemUtils.cpp \
+       external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWorkgroupStorageTests.cpp \
        external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWsiSwapchainTests.cpp \
        external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemYCbCrConversionTests.cpp \
        external/vulkancts/modules/vulkan/query_pool/vktQueryPoolOcclusionTests.cpp \
index 2dedb7c..33fde1f 100755 (executable)
@@ -355123,6 +355123,12 @@ dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.y
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_cosited_disjoint
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_midpoint
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_midpoint_disjoint
+dEQP-VK.protected_memory.workgroupstorage.memsize_1
+dEQP-VK.protected_memory.workgroupstorage.memsize_4
+dEQP-VK.protected_memory.workgroupstorage.memsize_5
+dEQP-VK.protected_memory.workgroupstorage.memsize_60
+dEQP-VK.protected_memory.workgroupstorage.memsize_101
+dEQP-VK.protected_memory.workgroupstorage.memsize_503
 dEQP-VK.device_group.sfr
 dEQP-VK.device_group.sfr_sys
 dEQP-VK.device_group.sfr_dedicated
index 87afe54..8a9d653 100644 (file)
@@ -38,6 +38,8 @@ set(DEQP_VK_PROTECTED_MEMORY_SRCS
        vktProtectedMemWsiSwapchainTests.hpp
        vktProtectedMemYCbCrConversionTests.cpp
        vktProtectedMemYCbCrConversionTests.hpp
+       vktProtectedMemWorkgroupStorageTests.cpp
+       vktProtectedMemWorkgroupStorageTests.hpp
        vktProtectedMemTests.cpp
        vktProtectedMemTests.hpp
        )
index 73e6413..6648faf 100644 (file)
@@ -229,11 +229,6 @@ public:
 
 private:
        de::MovePtr<tcu::Texture2D>     createTestTexture2D             (void);
-       void                                            clearImage                              (vk::VkImage                    image);
-       void                                            uploadImage                             (vk::VkImage                    image,
-                                                                                                                const tcu::Texture2D&  texture2D);
-       void                                            copyToProtectedImage    (vk::VkImage                    srcImage,
-                                                                                                                vk::VkImage                    dstImage);
        void                                            calculateAtomicRef              (tcu::Texture2D&                texture2D);
        tcu::TestStatus                         validateResult                  (vk::VkImage                    image,
                                                                                                                 const tcu::Texture2D&  texture2D,
@@ -456,27 +451,6 @@ ImageAccessTestInstance::ImageAccessTestInstance (Context&                                 ctx,
 {
 }
 
-static void fillWithRandomColorTiles (const tcu::PixelBufferAccess& dst, const tcu::Vec4& minVal, const tcu::Vec4& maxVal, deUint32 seed)
-{
-       const int       numCols         = dst.getWidth()  >= 7 ? 7 : dst.getWidth();
-       const int       numRows         = dst.getHeight() >= 5 ? 5 : dst.getHeight();
-       de::Random      rnd                     (seed);
-
-       for (int slice = 0; slice < dst.getDepth(); slice++)
-       for (int row = 0; row < numRows; row++)
-       for (int col = 0; col < numCols; col++)
-       {
-               const int       yBegin  = (row + 0)*dst.getHeight() / numRows;
-               const int       yEnd    = (row + 1)*dst.getHeight() / numRows;
-               const int       xBegin  = (col + 0)*dst.getWidth() / numCols;
-               const int       xEnd    = (col + 1)*dst.getWidth() / numCols;
-               tcu::Vec4       color;
-               for (int i = 0; i < 4; i++)
-                       color[i] = rnd.getFloat(minVal[i], maxVal[i]);
-               tcu::clear(tcu::getSubregion(dst, xBegin, yBegin, slice, xEnd - xBegin, yEnd - yBegin, 1), color);
-       }
-}
-
 de::MovePtr<tcu::Texture2D> ImageAccessTestInstance::createTestTexture2D (void)
 {
        const tcu::TextureFormat                texFmt          = mapVkFormat(m_params.imageFormat);
@@ -502,295 +476,6 @@ de::MovePtr<tcu::Texture2D> ImageAccessTestInstance::createTestTexture2D (void)
        return texture2D;
 }
 
-void ImageAccessTestInstance::uploadImage (vk::VkImage image, const tcu::Texture2D& texture2D)
-{
-       ProtectedContext&                                       ctx                                     (m_protectedContext);
-       const vk::DeviceInterface&                      vk                                      = ctx.getDeviceInterface();
-       const vk::VkDevice                                      device                          = ctx.getDevice();
-       const vk::VkQueue                                       queue                           = ctx.getQueue();
-       const deUint32                                          queueFamilyIndex        = ctx.getQueueFamilyIndex();
-
-       vk::Unique<vk::VkCommandPool>           cmdPool                         (makeCommandPool(vk, device, PROTECTION_DISABLED, queueFamilyIndex));
-       vk::Unique<vk::VkCommandBuffer>         cmdBuffer                       (vk::allocateCommandBuffer(vk, device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
-
-       const deUint32                                          width                           = (deUint32)texture2D.getWidth();
-       const deUint32                                          height                          = (deUint32)texture2D.getHeight();
-       const deUint32                                          stagingBufferSize       = width * height * tcu::getPixelSize(texture2D.getFormat());
-
-       de::UniquePtr<vk::BufferWithMemory>     stagingBuffer           (makeBuffer(ctx,
-                                                                                                                                               PROTECTION_DISABLED,
-                                                                                                                                               queueFamilyIndex,
-                                                                                                                                               stagingBufferSize,
-                                                                                                                                               vk::VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
-                                                                                                                                               vk::MemoryRequirement::HostVisible));
-
-       {
-               const tcu::ConstPixelBufferAccess&      access          = texture2D.getLevel(0);
-               const tcu::PixelBufferAccess            destAccess      (access.getFormat(), access.getSize(), stagingBuffer->getAllocation().getHostPtr());
-
-               tcu::copy(destAccess, access);
-
-               vk::flushMappedMemoryRange(vk, device, stagingBuffer->getAllocation().getMemory(), stagingBuffer->getAllocation().getOffset(), stagingBufferSize);
-       }
-
-       const vk::VkImageSubresourceRange       subresourceRange        =
-       {
-               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask
-               0u,                                                             // uint32_t                             baseMipLevel
-               1u,                                                             // uint32_t                             levelCount
-               0u,                                                             // uint32_t                             baseArrayLayer
-               1u,                                                             // uint32_t                             layerCount
-       };
-
-       const vk::VkImageMemoryBarrier          preCopyBarrier          =
-       {
-               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
-               DE_NULL,                                                                                // const void*                          pNext;
-               0u,                                                                                             // VkAccessFlags                        srcAccessMask;
-               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
-               vk::VK_IMAGE_LAYOUT_UNDEFINED,                                  // VkImageLayout                        oldLayout;
-               vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,               // VkImageLayout                        newLayout;
-               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
-               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
-               image,                                                                                  // VkImage                                      image;
-               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
-       };
-
-       const vk::VkImageMemoryBarrier          postCopyBarrier         =
-       {
-               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
-               DE_NULL,                                                                                // const void*                          pNext;
-               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        srcAccessMask;
-               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
-               vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,               // VkImageLayout                        oldLayout;
-               vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        newLayout;
-               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
-               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
-               image,                                                                                  // VkImage                                      image;
-               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
-       };
-
-       const vk::VkImageSubresourceLayers      subresourceLayers       =
-       {
-               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask;
-               0u,                                                             // deUint32                             mipLevel;
-               0u,                                                             // deUint32                             baseArrayLayer;
-               1u                                                              // deUint32                             layerCount;
-       };
-
-       const vk::VkBufferImageCopy                     copyRegion                      =
-       {
-               0u,                                                             // VkDeviceSize                                 bufferOffset;
-               width,                                                  // deUint32                                             bufferRowLength;
-               height,                                                 // deUint32                                             bufferImageHeight;
-               subresourceLayers,                              // VkImageSubresourceLayers             imageSubresource;
-               { 0u, 0u, 0u },                                 // VkOffset3D                                   imageOffset;
-               { width, height, 1u }                   // VkExtent3D                                   imageExtent;
-       };
-
-       beginCommandBuffer(vk, *cmdBuffer);
-       vk.cmdPipelineBarrier(*cmdBuffer,
-                                                 (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_HOST_BIT,
-                                                 (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
-                                                 (vk::VkDependencyFlags)0u,
-                                                 0u, (const vk::VkMemoryBarrier*)DE_NULL,
-                                                 0u, (const vk::VkBufferMemoryBarrier*)DE_NULL,
-                                                 1u, &preCopyBarrier);
-       vk.cmdCopyBufferToImage(*cmdBuffer, **stagingBuffer, image, vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1u, &copyRegion);
-       vk.cmdPipelineBarrier(*cmdBuffer,
-                                                 (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
-                                                 (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
-                                                 (vk::VkDependencyFlags)0u,
-                                                 0u, (const vk::VkMemoryBarrier*)DE_NULL,
-                                                 0u, (const vk::VkBufferMemoryBarrier*)DE_NULL,
-                                                 1u, &postCopyBarrier);
-       endCommandBuffer(vk, *cmdBuffer);
-
-       {
-               const vk::Unique<vk::VkFence>   fence           (createFence(vk, device));
-               VK_CHECK(queueSubmit(ctx, PROTECTION_DISABLED, queue, *cmdBuffer, *fence, ~0ull));
-       }
-}
-
-void ImageAccessTestInstance::copyToProtectedImage (vk::VkImage srcImage, vk::VkImage dstImage)
-{
-       ProtectedContext&                                       ctx                                     (m_protectedContext);
-       const vk::DeviceInterface&                      vk                                      = ctx.getDeviceInterface();
-       const vk::VkDevice                                      device                          = ctx.getDevice();
-       const vk::VkQueue                                       queue                           = ctx.getQueue();
-       const deUint32                                          queueFamilyIndex        = ctx.getQueueFamilyIndex();
-
-       vk::Unique<vk::VkCommandPool>           cmdPool                         (makeCommandPool(vk, device, PROTECTION_ENABLED, queueFamilyIndex));
-       vk::Unique<vk::VkCommandBuffer>         cmdBuffer                       (vk::allocateCommandBuffer(vk, device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
-
-       const vk::VkImageSubresourceRange       subresourceRange        =
-       {
-               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask
-               0u,                                                             // uint32_t                             baseMipLevel
-               1u,                                                             // uint32_t                             levelCount
-               0u,                                                             // uint32_t                             baseArrayLayer
-               1u,                                                             // uint32_t                             layerCount
-       };
-
-       const vk::VkImageMemoryBarrier          preImageBarriers[]      =
-       {
-               // source image
-               {
-                       vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
-                       DE_NULL,                                                                                // const void*                          pNext;
-                       vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        srcAccessMask;
-                       vk::VK_ACCESS_TRANSFER_READ_BIT,                                // VkAccessFlags                        dstAccessMask;
-                       vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        oldLayout;
-                       vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        newLayout;
-                       queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
-                       queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
-                       srcImage,                                                                               // VkImage                                      image;
-                       subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
-               },
-               // destination image
-               {
-                       vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
-                       DE_NULL,                                                                                // const void*                          pNext;
-                       0,                                                                                              // VkAccessFlags                        srcAccessMask;
-                       vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
-                       vk::VK_IMAGE_LAYOUT_UNDEFINED,                                  // VkImageLayout                        oldLayout;
-                       vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        newLayout;
-                       queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
-                       queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
-                       dstImage,                                                                               // VkImage                                      image;
-                       subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
-               }
-       };
-
-       const vk::VkImageMemoryBarrier          postImgBarrier          =
-       {
-               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
-               DE_NULL,                                                                                // const void*                          pNext;
-               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        srcAccessMask;
-               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
-               vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        oldLayout;
-               vk::VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,   // VkImageLayout                        newLayout;
-               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
-               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
-               dstImage,                                                                               // VkImage                                      image;
-               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
-       };
-
-       const vk::VkImageSubresourceLayers      subresourceLayers       =
-       {
-               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask;
-               0u,                                                             // deUint32                             mipLevel;
-               0u,                                                             // deUint32                             baseArrayLayer;
-               1u                                                              // deUint32                             layerCount;
-       };
-
-       const vk::VkImageCopy                           copyImageRegion         =
-       {
-               subresourceLayers,                                                                              // VkImageSubresourceCopy       srcSubresource;
-               { 0, 0, 0 },                                                                                    // VkOffset3D                           srcOffset;
-               subresourceLayers,                                                                              // VkImageSubresourceCopy       destSubresource;
-               { 0, 0, 0 },                                                                                    // VkOffset3D                           destOffset;
-               { (deUint32)IMAGE_WIDTH, (deUint32)IMAGE_HEIGHT, 1u },  // VkExtent3D                           extent;
-       };
-
-       beginCommandBuffer(vk, *cmdBuffer);
-       vk.cmdPipelineBarrier(*cmdBuffer,
-                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
-                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
-                                                 (vk::VkDependencyFlags)0,
-                                                 0, (const vk::VkMemoryBarrier*)DE_NULL,
-                                                 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
-                                                 DE_LENGTH_OF_ARRAY(preImageBarriers), preImageBarriers);
-       vk.cmdCopyImage(*cmdBuffer, srcImage, vk::VK_IMAGE_LAYOUT_GENERAL, dstImage, vk::VK_IMAGE_LAYOUT_GENERAL, 1u, &copyImageRegion);
-       vk.cmdPipelineBarrier(*cmdBuffer,
-                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
-                                                 vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
-                                                 (vk::VkDependencyFlags)0,
-                                                 0, (const vk::VkMemoryBarrier*)DE_NULL,
-                                                 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
-                                                 1, &postImgBarrier);
-       endCommandBuffer(vk, *cmdBuffer);
-
-       {
-               const vk::Unique<vk::VkFence>   fence           (createFence(vk, device));
-               VK_CHECK(queueSubmit(ctx, PROTECTION_ENABLED, queue, *cmdBuffer, *fence, ~0ull));
-       }
-}
-
-void ImageAccessTestInstance::clearImage (vk::VkImage image)
-{
-       ProtectedContext&                                       ctx                                     (m_protectedContext);
-       const vk::DeviceInterface&                      vk                                      = ctx.getDeviceInterface();
-       const vk::VkDevice                                      device                          = ctx.getDevice();
-       const vk::VkQueue                                       queue                           = ctx.getQueue();
-       const deUint32                                          queueFamilyIndex        = ctx.getQueueFamilyIndex();
-
-       vk::Unique<vk::VkCommandPool>           cmdPool                         (makeCommandPool(vk, device, PROTECTION_ENABLED, queueFamilyIndex));
-       vk::Unique<vk::VkCommandBuffer>         cmdBuffer                       (vk::allocateCommandBuffer(vk, device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
-
-       const vk::VkClearColorValue                     clearColor                      = { { 0.0f, 0.0f, 0.0f, 0.0f } };
-
-       const vk::VkImageSubresourceRange       subresourceRange        =
-       {
-               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask
-               0u,                                                             // uint32_t                             baseMipLevel
-               1u,                                                             // uint32_t                             levelCount
-               0u,                                                             // uint32_t                             baseArrayLayer
-               1u,                                                             // uint32_t                             layerCount
-       };
-
-       const vk::VkImageMemoryBarrier          preImageBarrier         =
-       {
-               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
-               DE_NULL,                                                                                // const void*                          pNext;
-               0u,                                                                                             // VkAccessFlags                        srcAccessMask;
-               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
-               vk::VK_IMAGE_LAYOUT_UNDEFINED,                                  // VkImageLayout                        oldLayout;
-               vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,               // VkImageLayout                        newLayout;
-               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
-               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
-               image,                                                                                  // VkImage                                      image;
-               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
-       };
-
-       const vk::VkImageMemoryBarrier          postImageBarrier        =
-       {
-               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
-               DE_NULL,                                                                                // const void*                          pNext;
-               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        srcAccessMask;
-               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
-               vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,               // VkImageLayout                        oldLayout;
-               vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        newLayout;
-               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
-               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
-               image,                                                                                  // VkImage                                      image;
-               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
-       };
-
-       beginCommandBuffer(vk, *cmdBuffer);
-       vk.cmdPipelineBarrier(*cmdBuffer,
-                                                 vk::VK_PIPELINE_STAGE_HOST_BIT,
-                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
-                                                 (vk::VkDependencyFlags)0,
-                                                 0, (const vk::VkMemoryBarrier*)DE_NULL,
-                                                 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
-                                                 1, &preImageBarrier);
-       vk.cmdClearColorImage(*cmdBuffer, image, vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clearColor, 1, &subresourceRange);
-       vk.cmdPipelineBarrier(*cmdBuffer,
-                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
-                                                 vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
-                                                 (vk::VkDependencyFlags)0,
-                                                 0, (const vk::VkMemoryBarrier*)DE_NULL,
-                                                 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
-                                                 1, &postImageBarrier);
-       endCommandBuffer(vk, *cmdBuffer);
-
-       {
-               const vk::Unique<vk::VkFence>   fence           (createFence(vk, device));
-               VK_CHECK(queueSubmit(ctx, PROTECTION_ENABLED, queue, *cmdBuffer, *fence, ~0ull));
-       }
-}
-
 tcu::TestStatus ImageAccessTestInstance::iterate (void)
 {
        switch (m_params.shaderType)
@@ -858,15 +543,15 @@ tcu::TestStatus ImageAccessTestInstance::executeComputeTest (void)
                                                                                                                                                                vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT | vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT);
 
                // Upload data to an unprotected image
-               uploadImage(**unprotectedImage, *texture2D);
+               uploadImage(m_protectedContext, **unprotectedImage, *texture2D);
 
                // Copy unprotected image to protected image
-               copyToProtectedImage(**unprotectedImage, **imageSrc);
+               copyToProtectedImage(m_protectedContext, **unprotectedImage, **imageSrc, IMAGE_WIDTH, IMAGE_HEIGHT);
        }
 
        // Clear dst image
        if (m_params.accessType != ACCESS_TYPE_IMAGE_ATOMICS)
-               clearImage(**imageDst);
+               clearImage(m_protectedContext, **imageDst);
 
        // Create descriptors
        {
@@ -1068,15 +753,15 @@ tcu::TestStatus ImageAccessTestInstance::executeFragmentTest (void)
                                                                                                                                                                vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT | vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT);
 
                // Upload data to an unprotected image
-               uploadImage(**unprotectedImage, *texture2D);
+               uploadImage(m_protectedContext, **unprotectedImage, *texture2D);
 
                // Copy unprotected image to protected image
-               copyToProtectedImage(**unprotectedImage, **imageSrc);
+               copyToProtectedImage(m_protectedContext, **unprotectedImage, **imageSrc, IMAGE_WIDTH, IMAGE_HEIGHT);
        }
 
        // Clear dst image
        if (m_params.accessType == ACCESS_TYPE_IMAGE_STORE)
-               clearImage(**imageDst);
+               clearImage(m_protectedContext, **imageDst);
 
        // Create descriptors
        {
index dd65d41..12ce141 100644 (file)
@@ -39,6 +39,7 @@
 #include "vktProtectedMemShaderImageAccessTests.hpp"
 #include "vktProtectedMemWsiSwapchainTests.hpp"
 #include "vktProtectedMemYCbCrConversionTests.hpp"
+#include "vktProtectedMemWorkgroupStorageTests.hpp"
 
 namespace vkt
 {
@@ -94,6 +95,8 @@ tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
                protectedTests->addChild(interactionTestGroup.release());
        }
 
+       protectedTests->addChild(createWorkgroupStorageTests(testCtx));
+
        return protectedTests.release();
 
 }
index db529f0..695abf7 100644 (file)
@@ -25,6 +25,7 @@
 #include "vktProtectedMemUtils.hpp"
 
 #include "deString.h"
+#include "deRandom.hpp"
 
 #include "vkDeviceUtil.hpp"
 #include "vkQueryUtil.hpp"
@@ -79,7 +80,6 @@ std::vector<std::string> getValidationLayers (const vk::PlatformInterface& vkp)
        return enabledLayers;
 }
 
-
 vk::Move<vk::VkInstance> makeProtectedMemInstance (const vk::PlatformInterface& vkp, const vkt::Context& context, const std::vector<std::string>& extraExtensions)
 {
        const Extensions                        supportedExtensions(vk::enumerateInstanceExtensionProperties(vkp, DE_NULL));
@@ -291,6 +291,7 @@ de::MovePtr<vk::ImageWithMemory>    createImage2D           (ProtectedContext&              context,
                                                                                                ? vk::VK_IMAGE_CREATE_PROTECTED_BIT
                                                                                                : (vk::VkImageCreateFlagBits)0u;
 #else
+       DE_UNREF(protectionMode);
        deUint32                                        flags           = 0u;
 #endif
 
@@ -341,6 +342,7 @@ de::MovePtr<vk::BufferWithMemory> makeBuffer (ProtectedContext&                     context,
                                                                                                        : (vk::VkBufferCreateFlagBits)0u;
        vk::MemoryRequirement                   requirement     = memReq;
 #else
+       DE_UNREF(protectionMode);
        deUint32                                                flags           = 0u;
        vk::MemoryRequirement                   requirement     = memReq & (
                                                                                                        vk::MemoryRequirement::HostVisible
@@ -444,7 +446,6 @@ void beginSecondaryCommandBuffer (const vk::DeviceInterface&                                vk,
        VK_CHECK(vk.beginCommandBuffer(secondaryCmdBuffer, &beginInfo));
 }
 
-
 vk::VkResult queueSubmit (ProtectedContext&            context,
                                                  ProtectionMode                protectionMode,
                                                  vk::VkQueue                   queue,
@@ -469,6 +470,7 @@ vk::VkResult queueSubmit (ProtectedContext&         context,
                DE_NULL,                                                                        // pSignalSemaphores
        };
 
+#ifndef NOT_PROTECTED
        // Protected extension submit info
        const vk::VkProtectedSubmitInfo         protectedInfo   =
        {
@@ -476,10 +478,11 @@ vk::VkResult queueSubmit (ProtectedContext&               context,
                DE_NULL,                                                                                        // pNext
                VK_TRUE,                                                                                        // protectedSubmit
        };
-#ifndef NOT_PROTECTED
        if (protectionMode == PROTECTION_ENABLED) {
                submitInfo.pNext = &protectedInfo;
        }
+#else
+       DE_UNREF(protectionMode);
 #endif
 
        VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, fence));
@@ -502,7 +505,6 @@ vk::Move<vk::VkDescriptorSet> makeDescriptorSet (const vk::DeviceInterface&                 vk
        return vk::allocateDescriptorSet(vk, device, &allocateParams);
 }
 
-
 vk::Move<vk::VkPipelineLayout> makePipelineLayout (const vk::DeviceInterface&          vk,
                                                                                                   const vk::VkDevice                           device,
                                                                                                   const vk::VkDescriptorSetLayout      descriptorSetLayout)
@@ -588,6 +590,9 @@ vk::Move<vk::VkCommandPool> makeCommandPool (const vk::DeviceInterface&     vk,
                                                                        | ((protectionMode == PROTECTION_ENABLED) ? vk::VK_COMMAND_POOL_CREATE_PROTECTED_BIT : 0x0)
 #endif
                                                                        ;
+#ifdef NOT_PROTECTED
+       DE_UNREF(protectionMode);
+#endif
 
        return vk::createCommandPool(vk, device, poolFlags, queueFamilyIdx);
 }
@@ -645,5 +650,312 @@ const char* getCmdBufferTypeStr (const CmdBufferType cmdBufferType)
        }
 }
 
+void clearImage (ProtectedContext& ctx, vk::VkImage image)
+{
+       const vk::DeviceInterface&                      vk                                      = ctx.getDeviceInterface();
+       const vk::VkDevice                                      device                          = ctx.getDevice();
+       const vk::VkQueue                                       queue                           = ctx.getQueue();
+       const deUint32                                          queueFamilyIndex        = ctx.getQueueFamilyIndex();
+
+       vk::Unique<vk::VkCommandPool>           cmdPool                         (makeCommandPool(vk, device, PROTECTION_ENABLED, queueFamilyIndex));
+       vk::Unique<vk::VkCommandBuffer>         cmdBuffer                       (vk::allocateCommandBuffer(vk, device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
+
+       const vk::VkClearColorValue                     clearColor                      = { { 0.0f, 0.0f, 0.0f, 0.0f } };
+
+       const vk::VkImageSubresourceRange       subresourceRange        =
+       {
+               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask
+               0u,                                                             // uint32_t                             baseMipLevel
+               1u,                                                             // uint32_t                             levelCount
+               0u,                                                             // uint32_t                             baseArrayLayer
+               1u,                                                             // uint32_t                             layerCount
+       };
+
+       const vk::VkImageMemoryBarrier          preImageBarrier         =
+       {
+               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
+               DE_NULL,                                                                                // const void*                          pNext;
+               0u,                                                                                             // VkAccessFlags                        srcAccessMask;
+               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
+               vk::VK_IMAGE_LAYOUT_UNDEFINED,                                  // VkImageLayout                        oldLayout;
+               vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,               // VkImageLayout                        newLayout;
+               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
+               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
+               image,                                                                                  // VkImage                                      image;
+               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
+       };
+
+       const vk::VkImageMemoryBarrier          postImageBarrier        =
+       {
+               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
+               DE_NULL,                                                                                // const void*                          pNext;
+               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        srcAccessMask;
+               vk::VK_ACCESS_SHADER_WRITE_BIT,                                 // VkAccessFlags                        dstAccessMask;
+               vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,               // VkImageLayout                        oldLayout;
+               vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        newLayout;
+               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
+               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
+               image,                                                                                  // VkImage                                      image;
+               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
+       };
+
+       beginCommandBuffer(vk, *cmdBuffer);
+       vk.cmdPipelineBarrier(*cmdBuffer,
+                                                 vk::VK_PIPELINE_STAGE_HOST_BIT,
+                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                                 (vk::VkDependencyFlags)0,
+                                                 0, (const vk::VkMemoryBarrier*)DE_NULL,
+                                                 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
+                                                 1, &preImageBarrier);
+       vk.cmdClearColorImage(*cmdBuffer, image, vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clearColor, 1, &subresourceRange);
+       vk.cmdPipelineBarrier(*cmdBuffer,
+                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                                 vk::VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
+                                                 (vk::VkDependencyFlags)0,
+                                                 0, (const vk::VkMemoryBarrier*)DE_NULL,
+                                                 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
+                                                 1, &postImageBarrier);
+       endCommandBuffer(vk, *cmdBuffer);
+
+       {
+               const vk::Unique<vk::VkFence>   fence           (createFence(vk, device));
+               VK_CHECK(queueSubmit(ctx, PROTECTION_ENABLED, queue, *cmdBuffer, *fence, ~0ull));
+       }
+}
+
+void uploadImage (ProtectedContext& ctx, vk::VkImage image, const tcu::Texture2D& texture2D)
+{
+       const vk::DeviceInterface&                      vk                                      = ctx.getDeviceInterface();
+       const vk::VkDevice                                      device                          = ctx.getDevice();
+       const vk::VkQueue                                       queue                           = ctx.getQueue();
+       const deUint32                                          queueFamilyIndex        = ctx.getQueueFamilyIndex();
+
+       vk::Unique<vk::VkCommandPool>           cmdPool                         (makeCommandPool(vk, device, PROTECTION_DISABLED, queueFamilyIndex));
+       vk::Unique<vk::VkCommandBuffer>         cmdBuffer                       (vk::allocateCommandBuffer(vk, device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
+
+       const deUint32                                          width                           = (deUint32)texture2D.getWidth();
+       const deUint32                                          height                          = (deUint32)texture2D.getHeight();
+       const deUint32                                          stagingBufferSize       = width * height * tcu::getPixelSize(texture2D.getFormat());
+
+       de::UniquePtr<vk::BufferWithMemory>     stagingBuffer           (makeBuffer(ctx,
+                                                                                                                                               PROTECTION_DISABLED,
+                                                                                                                                               queueFamilyIndex,
+                                                                                                                                               stagingBufferSize,
+                                                                                                                                               vk::VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
+                                                                                                                                               vk::MemoryRequirement::HostVisible));
+
+       {
+               const tcu::ConstPixelBufferAccess&      access          = texture2D.getLevel(0);
+               const tcu::PixelBufferAccess            destAccess      (access.getFormat(), access.getSize(), stagingBuffer->getAllocation().getHostPtr());
+
+               tcu::copy(destAccess, access);
+
+               vk::flushMappedMemoryRange(vk, device, stagingBuffer->getAllocation().getMemory(), stagingBuffer->getAllocation().getOffset(), stagingBufferSize);
+       }
+
+       const vk::VkImageSubresourceRange       subresourceRange        =
+       {
+               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask
+               0u,                                                             // uint32_t                             baseMipLevel
+               1u,                                                             // uint32_t                             levelCount
+               0u,                                                             // uint32_t                             baseArrayLayer
+               1u,                                                             // uint32_t                             layerCount
+       };
+
+       const vk::VkImageMemoryBarrier          preCopyBarrier          =
+       {
+               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
+               DE_NULL,                                                                                // const void*                          pNext;
+               0u,                                                                                             // VkAccessFlags                        srcAccessMask;
+               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
+               vk::VK_IMAGE_LAYOUT_UNDEFINED,                                  // VkImageLayout                        oldLayout;
+               vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,               // VkImageLayout                        newLayout;
+               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
+               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
+               image,                                                                                  // VkImage                                      image;
+               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
+       };
+
+       const vk::VkImageMemoryBarrier          postCopyBarrier         =
+       {
+               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
+               DE_NULL,                                                                                // const void*                          pNext;
+               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        srcAccessMask;
+               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
+               vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,               // VkImageLayout                        oldLayout;
+               vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        newLayout;
+               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
+               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
+               image,                                                                                  // VkImage                                      image;
+               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
+       };
+
+       const vk::VkImageSubresourceLayers      subresourceLayers       =
+       {
+               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask;
+               0u,                                                             // deUint32                             mipLevel;
+               0u,                                                             // deUint32                             baseArrayLayer;
+               1u                                                              // deUint32                             layerCount;
+       };
+
+       const vk::VkBufferImageCopy                     copyRegion                      =
+       {
+               0u,                                                             // VkDeviceSize                                 bufferOffset;
+               width,                                                  // deUint32                                             bufferRowLength;
+               height,                                                 // deUint32                                             bufferImageHeight;
+               subresourceLayers,                              // VkImageSubresourceLayers             imageSubresource;
+               { 0u, 0u, 0u },                                 // VkOffset3D                                   imageOffset;
+               { width, height, 1u }                   // VkExtent3D                                   imageExtent;
+       };
+
+       beginCommandBuffer(vk, *cmdBuffer);
+       vk.cmdPipelineBarrier(*cmdBuffer,
+                                                 (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_HOST_BIT,
+                                                 (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                                 (vk::VkDependencyFlags)0u,
+                                                 0u, (const vk::VkMemoryBarrier*)DE_NULL,
+                                                 0u, (const vk::VkBufferMemoryBarrier*)DE_NULL,
+                                                 1u, &preCopyBarrier);
+       vk.cmdCopyBufferToImage(*cmdBuffer, **stagingBuffer, image, vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1u, &copyRegion);
+       vk.cmdPipelineBarrier(*cmdBuffer,
+                                                 (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                                 (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                                 (vk::VkDependencyFlags)0u,
+                                                 0u, (const vk::VkMemoryBarrier*)DE_NULL,
+                                                 0u, (const vk::VkBufferMemoryBarrier*)DE_NULL,
+                                                 1u, &postCopyBarrier);
+       endCommandBuffer(vk, *cmdBuffer);
+
+       {
+               const vk::Unique<vk::VkFence>   fence           (createFence(vk, device));
+               VK_CHECK(queueSubmit(ctx, PROTECTION_DISABLED, queue, *cmdBuffer, *fence, ~0ull));
+       }
+}
+
+void copyToProtectedImage (ProtectedContext& ctx, vk::VkImage srcImage, vk::VkImage dstImage, deUint32 width, deUint32 height)
+{
+       const vk::DeviceInterface&                      vk                                      = ctx.getDeviceInterface();
+       const vk::VkDevice                                      device                          = ctx.getDevice();
+       const vk::VkQueue                                       queue                           = ctx.getQueue();
+       const deUint32                                          queueFamilyIndex        = ctx.getQueueFamilyIndex();
+
+       vk::Unique<vk::VkCommandPool>           cmdPool                         (makeCommandPool(vk, device, PROTECTION_ENABLED, queueFamilyIndex));
+       vk::Unique<vk::VkCommandBuffer>         cmdBuffer                       (vk::allocateCommandBuffer(vk, device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
+
+       const vk::VkImageSubresourceRange       subresourceRange        =
+       {
+               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask
+               0u,                                                             // uint32_t                             baseMipLevel
+               1u,                                                             // uint32_t                             levelCount
+               0u,                                                             // uint32_t                             baseArrayLayer
+               1u,                                                             // uint32_t                             layerCount
+       };
+
+       const vk::VkImageMemoryBarrier          preImageBarriers[]      =
+       {
+               // source image
+               {
+                       vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
+                       DE_NULL,                                                                                // const void*                          pNext;
+                       vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        srcAccessMask;
+                       vk::VK_ACCESS_TRANSFER_READ_BIT,                                // VkAccessFlags                        dstAccessMask;
+                       vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        oldLayout;
+                       vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        newLayout;
+                       queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
+                       queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
+                       srcImage,                                                                               // VkImage                                      image;
+                       subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
+               },
+               // destination image
+               {
+                       vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
+                       DE_NULL,                                                                                // const void*                          pNext;
+                       0,                                                                                              // VkAccessFlags                        srcAccessMask;
+                       vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        dstAccessMask;
+                       vk::VK_IMAGE_LAYOUT_UNDEFINED,                                  // VkImageLayout                        oldLayout;
+                       vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        newLayout;
+                       queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
+                       queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
+                       dstImage,                                                                               // VkImage                                      image;
+                       subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
+               }
+       };
+
+       const vk::VkImageMemoryBarrier          postImgBarrier          =
+       {
+               vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,             // VkStructureType                      sType;
+               DE_NULL,                                                                                // const void*                          pNext;
+               vk::VK_ACCESS_TRANSFER_WRITE_BIT,                               // VkAccessFlags                        srcAccessMask;
+               vk::VK_ACCESS_SHADER_READ_BIT,                                  // VkAccessFlags                        dstAccessMask;
+               vk::VK_IMAGE_LAYOUT_GENERAL,                                    // VkImageLayout                        oldLayout;
+               vk::VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,   // VkImageLayout                        newLayout;
+               queueFamilyIndex,                                                               // deUint32                                     srcQueueFamilyIndex;
+               queueFamilyIndex,                                                               // deUint32                                     dstQueueFamilyIndex;
+               dstImage,                                                                               // VkImage                                      image;
+               subresourceRange                                                                // VkImageSubresourceRange      subresourceRange;
+       };
+
+       const vk::VkImageSubresourceLayers      subresourceLayers       =
+       {
+               vk::VK_IMAGE_ASPECT_COLOR_BIT,  // VkImageAspectFlags   aspectMask;
+               0u,                                                             // deUint32                             mipLevel;
+               0u,                                                             // deUint32                             baseArrayLayer;
+               1u                                                              // deUint32                             layerCount;
+       };
+
+       const vk::VkImageCopy                           copyImageRegion         =
+       {
+               subresourceLayers,              // VkImageSubresourceCopy       srcSubresource;
+               { 0, 0, 0 },                    // VkOffset3D                           srcOffset;
+               subresourceLayers,              // VkImageSubresourceCopy       destSubresource;
+               { 0, 0, 0 },                    // VkOffset3D                           destOffset;
+               { width, height, 1u },  // VkExtent3D                           extent;
+       };
+
+       beginCommandBuffer(vk, *cmdBuffer);
+       vk.cmdPipelineBarrier(*cmdBuffer,
+                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                                 (vk::VkDependencyFlags)0,
+                                                 0, (const vk::VkMemoryBarrier*)DE_NULL,
+                                                 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
+                                                 DE_LENGTH_OF_ARRAY(preImageBarriers), preImageBarriers);
+       vk.cmdCopyImage(*cmdBuffer, srcImage, vk::VK_IMAGE_LAYOUT_GENERAL, dstImage, vk::VK_IMAGE_LAYOUT_GENERAL, 1u, &copyImageRegion);
+       vk.cmdPipelineBarrier(*cmdBuffer,
+                                                 vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                                 vk::VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
+                                                 (vk::VkDependencyFlags)0,
+                                                 0, (const vk::VkMemoryBarrier*)DE_NULL,
+                                                 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
+                                                 1, &postImgBarrier);
+       endCommandBuffer(vk, *cmdBuffer);
+
+       {
+               const vk::Unique<vk::VkFence>   fence           (createFence(vk, device));
+               VK_CHECK(queueSubmit(ctx, PROTECTION_ENABLED, queue, *cmdBuffer, *fence, ~0ull));
+       }
+}
+
+void fillWithRandomColorTiles (const tcu::PixelBufferAccess& dst, const tcu::Vec4& minVal, const tcu::Vec4& maxVal, deUint32 seed)
+{
+       const int       numCols         = dst.getWidth()  >= 7 ? 7 : dst.getWidth();
+       const int       numRows         = dst.getHeight() >= 5 ? 5 : dst.getHeight();
+       de::Random      rnd                     (seed);
+
+       for (int slice = 0; slice < dst.getDepth(); slice++)
+       for (int row = 0; row < numRows; row++)
+       for (int col = 0; col < numCols; col++)
+       {
+               const int       yBegin  = (row + 0)*dst.getHeight() / numRows;
+               const int       yEnd    = (row + 1)*dst.getHeight() / numRows;
+               const int       xBegin  = (col + 0)*dst.getWidth() / numCols;
+               const int       xEnd    = (col + 1)*dst.getWidth() / numCols;
+               tcu::Vec4       color;
+               for (int i = 0; i < 4; i++)
+                       color[i] = rnd.getFloat(minVal[i], maxVal[i]);
+               tcu::clear(tcu::getSubregion(dst, xBegin, yBegin, slice, xEnd - xBegin, yEnd - yBegin, 1), color);
+       }
+}
+
 } // ProtectedMem
 } // vkt
index f087b9a..565b0a8 100644 (file)
@@ -33,7 +33,9 @@
 #include "vkPlatform.hpp"
 #include "vkBufferWithMemory.hpp"
 #include "vkImageWithMemory.hpp"
+#include "vkCmdUtil.hpp"
 #include "tcuVector.hpp"
+#include "tcuTextureUtil.hpp"
 
 // enable the define to disable protected memory
 //#define NOT_PROTECTED        1
@@ -161,6 +163,24 @@ vk::Move<vk::VkPipeline>                   makeGraphicsPipeline                            (const vk::DeviceInterface&
                                                                                                                                                 const tcu::UVec2&                                      renderSize,
                                                                                                                                                 const vk::VkPrimitiveTopology          topology);
 
+void                                                           clearImage                                                      (ProtectedContext&                                      ctx,
+                                                                                                                                                vk::VkImage                                            image);
+
+void                                                           uploadImage                                                     (ProtectedContext&                                      ctx,
+                                                                                                                                                vk::VkImage                                            image,
+                                                                                                                                                const tcu::Texture2D&                          texture2D);
+
+void                                                           copyToProtectedImage                            (ProtectedContext&                                      ctx,
+                                                                                                                                                vk::VkImage                                            srcImage,
+                                                                                                                                                vk::VkImage                                            dstImage,
+                                                                                                                                                deUint32                                                       width,
+                                                                                                                                                deUint32                                                       height);
+
+void                                                           fillWithRandomColorTiles                        (const tcu::PixelBufferAccess&          dst,
+                                                                                                                                                const tcu::Vec4&                                       minVal,
+                                                                                                                                                const tcu::Vec4&                                       maxVal,
+                                                                                                                                                deUint32                                                       seed);
+
 } // ProtectedMem
 } // vkt
 
diff --git a/external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWorkgroupStorageTests.cpp b/external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWorkgroupStorageTests.cpp
new file mode 100644 (file)
index 0000000..c00531b
--- /dev/null
@@ -0,0 +1,373 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2018 The Khronos Group Inc.
+ * Copyright (c) 2018 Google Inc.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Protected memory workgroup storage tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktProtectedMemWorkgroupStorageTests.hpp"
+
+#include "vktProtectedMemContext.hpp"
+#include "vktProtectedMemUtils.hpp"
+#include "vktProtectedMemImageValidator.hpp"
+#include "vktTestCase.hpp"
+#include "vktTestGroupUtil.hpp"
+
+#include "vkPrograms.hpp"
+#include "vkTypeUtil.hpp"
+#include "vkBuilderUtil.hpp"
+#include "vkImageUtil.hpp"
+#include "vkCmdUtil.hpp"
+
+#include "tcuTestLog.hpp"
+#include "tcuVector.hpp"
+#include "tcuTextureUtil.hpp"
+#include "tcuStringTemplate.hpp"
+
+#include "gluTextureTestUtil.hpp"
+
+#include "deRandom.hpp"
+
+namespace vkt
+{
+namespace ProtectedMem
+{
+
+namespace
+{
+
+struct Params
+{
+       deUint32                        sharedMemorySize;
+       deUint32                        imageWidth;
+       deUint32                        imageHeight;
+
+       Params (deUint32        sharedMemorySize_)
+               : sharedMemorySize      (sharedMemorySize_)
+       {
+               // Find suitable image dimensions based on shared memory size
+               imageWidth = 1;
+               imageHeight = 1;
+               bool increaseWidth = true;
+               while (imageWidth * imageHeight < sharedMemorySize)
+               {
+                       if (increaseWidth)
+                               imageWidth *= 2;
+                       else
+                               imageHeight *= 2;
+
+                       increaseWidth = !increaseWidth;
+               }
+       }
+};
+
+deUint32 getSeedValue (const Params& params)
+{
+       return deInt32Hash(params.sharedMemorySize);
+}
+
+class WorkgroupStorageTestInstance : public ProtectedTestInstance
+{
+public:
+                                                               WorkgroupStorageTestInstance    (Context&                               ctx,
+                                                                                                                                const ImageValidator&  validator,
+                                                                                                                                const Params&                  params);
+       virtual tcu::TestStatus         iterate                                                 (void);
+
+private:
+       de::MovePtr<tcu::Texture2D>     createTestTexture2D                             (void);
+       tcu::TestStatus                         validateResult                                  (vk::VkImage                    image,
+                                                                                                                                const tcu::Texture2D&  texture2D,
+                                                                                                                                const tcu::Sampler&    refSampler);
+       void                                            calculateRef                                    (tcu::Texture2D&                texture2D);
+
+       const ImageValidator&           m_validator;
+       const Params&                           m_params;
+};
+
+class WorkgroupStorageTestCase : public TestCase
+{
+public:
+                                                               WorkgroupStorageTestCase        (tcu::TestContext&              testCtx,
+                                                                                                                        const std::string&             name,
+                                                                                                                        const std::string&             description,
+                                                                                                                        const Params&                  params)
+                                                                       : TestCase              (testCtx, name, description)
+                                                                       , m_validator   (vk::VK_FORMAT_R8G8B8A8_UNORM)
+                                                                       , m_params              (params)
+                                                               {
+                                                               }
+
+       virtual                                         ~WorkgroupStorageTestCase       (void) {}
+       virtual TestInstance*           createInstance                          (Context& ctx) const
+                                                               {
+                                                                       return new WorkgroupStorageTestInstance(ctx, m_validator, m_params);
+                                                               }
+       virtual void                            initPrograms                            (vk::SourceCollections& programCollection) const;
+
+private:
+       ImageValidator                          m_validator;
+       Params                                          m_params;
+};
+
+void WorkgroupStorageTestCase::initPrograms (vk::SourceCollections& programCollection) const
+{
+       m_validator.initPrograms(programCollection);
+
+       // Fill shared data array with source image data. Output result color with results from
+       // shared memory written by another invocation.
+       std::string comp =
+               std::string() +
+               "#version 450\n"
+               "layout(local_size_x = " + de::toString(m_params.imageWidth) + ", local_size_y = " + de::toString(m_params.imageHeight) + ", local_size_z = 1) in;\n"
+               "layout(set = 0, binding = 0, rgba8) writeonly uniform highp image2D u_resultImage;\n"
+               "layout(set = 0, binding = 1, rgba8) readonly uniform highp image2D u_srcImage;\n"
+               "shared vec4 sharedData[" + de::toString(m_params.sharedMemorySize) + "];\n"
+               "\n"
+               "void main() {\n"
+               "    int gx = int(gl_GlobalInvocationID.x);\n"
+               "    int gy = int(gl_GlobalInvocationID.y);\n"
+               "    int s = " + de::toString(m_params.sharedMemorySize) + ";\n"
+               "    int idx0 = gy * " + de::toString(m_params.imageWidth) + " + gx;\n"
+               "    int idx1 = (idx0 + 1) % s;\n"
+               "    vec4 color = imageLoad(u_srcImage, ivec2(gx, gy));\n"
+               "    if (idx0 < s)\n"
+               "    {\n"
+               "        sharedData[idx0] = color;\n"
+               "    }\n"
+               "    barrier();\n"
+               "    vec4 outColor = sharedData[idx1];\n"
+               "    imageStore(u_resultImage, ivec2(gx, gy), outColor);\n"
+               "}\n";
+
+       programCollection.glslSources.add("comp") << glu::ComputeSource(comp);
+}
+
+WorkgroupStorageTestInstance::WorkgroupStorageTestInstance (Context&                           ctx,
+                                                                                                                       const ImageValidator&   validator,
+                                                                                                                       const Params&                   params)
+       : ProtectedTestInstance (ctx)
+       , m_validator                   (validator)
+       , m_params                              (params)
+{
+}
+
+de::MovePtr<tcu::Texture2D> WorkgroupStorageTestInstance::createTestTexture2D (void)
+{
+       const tcu::TextureFormat                texFmt          = mapVkFormat(vk::VK_FORMAT_R8G8B8A8_UNORM);
+       const tcu::TextureFormatInfo    fmtInfo         = tcu::getTextureFormatInfo(texFmt);
+       de::MovePtr<tcu::Texture2D>             texture2D       (new tcu::Texture2D(texFmt, m_params.imageWidth, m_params.imageHeight));
+
+       texture2D->allocLevel(0);
+
+       const tcu::PixelBufferAccess&   level           = texture2D->getLevel(0);
+
+       fillWithRandomColorTiles(level, fmtInfo.valueMin, fmtInfo.valueMax, getSeedValue(m_params));
+
+       return texture2D;
+}
+
+tcu::TestStatus WorkgroupStorageTestInstance::iterate (void)
+{
+       ProtectedContext&                                               ctx                                     (m_protectedContext);
+       const vk::DeviceInterface&                              vk                                      = ctx.getDeviceInterface();
+       const vk::VkDevice                                              device                          = ctx.getDevice();
+       const vk::VkQueue                                               queue                           = ctx.getQueue();
+       const deUint32                                                  queueFamilyIndex        = ctx.getQueueFamilyIndex();
+       const vk::VkPhysicalDeviceProperties    properties                      = vk::getPhysicalDeviceProperties(ctx.getInstanceDriver(), ctx.getPhysicalDevice());
+
+       vk::Unique<vk::VkCommandPool>                   cmdPool                         (makeCommandPool(vk, device, PROTECTION_ENABLED, queueFamilyIndex));
+
+       de::MovePtr<tcu::Texture2D>                             texture2D                       = createTestTexture2D();
+       const tcu::Sampler                                              refSampler                      = tcu::Sampler(tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE,
+                                                                                                                                                          tcu::Sampler::NEAREST, tcu::Sampler::NEAREST);
+
+       vk::Unique<vk::VkShaderModule>                  computeShader           (vk::createShaderModule(vk, device, ctx.getBinaryCollection().get("comp"), 0));
+
+       de::MovePtr<vk::ImageWithMemory>                imageSrc;
+       de::MovePtr<vk::ImageWithMemory>                imageDst;
+       vk::Move<vk::VkSampler>                                 sampler;
+       vk::Move<vk::VkImageView>                               imageViewSrc;
+       vk::Move<vk::VkImageView>                               imageViewDst;
+
+       vk::Move<vk::VkDescriptorSetLayout>             descriptorSetLayout;
+       vk::Move<vk::VkDescriptorPool>                  descriptorPool;
+       vk::Move<vk::VkDescriptorSet>                   descriptorSet;
+
+       // Check there is enough shared memory supported
+       if (properties.limits.maxComputeSharedMemorySize < m_params.sharedMemorySize * 4 * 4)
+               throw tcu::NotSupportedError("Not enough shared memory supported.");
+
+       // Check the number of invocations supported
+       if (properties.limits.maxComputeWorkGroupInvocations < m_params.imageWidth * m_params.imageHeight)
+               throw tcu::NotSupportedError("Not enough compute workgroup invocations supported.");
+
+       // Create src and dst images
+       {
+               vk::VkImageUsageFlags imageUsageFlags = vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT     |
+                                                                                               vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT     |
+                                                                                               vk::VK_IMAGE_USAGE_SAMPLED_BIT          |
+                                                                                               vk::VK_IMAGE_USAGE_STORAGE_BIT;
+
+               imageSrc = createImage2D(ctx, PROTECTION_ENABLED, queueFamilyIndex,
+                                                                m_params.imageWidth, m_params.imageHeight,
+                                                                vk::VK_FORMAT_R8G8B8A8_UNORM,
+                                                                imageUsageFlags);
+
+               imageDst = createImage2D(ctx, PROTECTION_ENABLED, queueFamilyIndex,
+                                                                m_params.imageWidth, m_params.imageHeight,
+                                                                vk::VK_FORMAT_R8G8B8A8_UNORM,
+                                                                imageUsageFlags);
+       }
+
+       // Upload source image
+       {
+               de::MovePtr<vk::ImageWithMemory>        unprotectedImage        = createImage2D(ctx, PROTECTION_DISABLED, queueFamilyIndex,
+                                                                                                                                                               m_params.imageWidth, m_params.imageHeight,
+                                                                                                                                                               vk::VK_FORMAT_R8G8B8A8_UNORM,
+                                                                                                                                                               vk::VK_IMAGE_USAGE_TRANSFER_SRC_BIT | vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT);
+
+               // Upload data to an unprotected image
+               uploadImage(m_protectedContext, **unprotectedImage, *texture2D);
+
+               // Copy unprotected image to protected image
+               copyToProtectedImage(m_protectedContext, **unprotectedImage, **imageSrc, m_params.imageWidth, m_params.imageHeight);
+       }
+
+       // Clear dst image
+       clearImage(m_protectedContext, **imageDst);
+
+       // Create descriptors
+       {
+               vk::DescriptorSetLayoutBuilder  layoutBuilder;
+               vk::DescriptorPoolBuilder               poolBuilder;
+
+               layoutBuilder.addSingleBinding(vk::VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, vk::VK_SHADER_STAGE_COMPUTE_BIT);
+               layoutBuilder.addSingleBinding(vk::VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, vk::VK_SHADER_STAGE_COMPUTE_BIT);
+               poolBuilder.addType(vk::VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 2u);
+
+               descriptorSetLayout             = layoutBuilder.build(vk, device);
+               descriptorPool                  = poolBuilder.build(vk, device, vk::VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u);
+               descriptorSet                   = makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout);
+       }
+
+       // Create pipeline layout
+       vk::Unique<vk::VkPipelineLayout>        pipelineLayout          (makePipelineLayout(vk, device, *descriptorSetLayout));
+
+       // Create image views
+       {
+               imageViewSrc = createImageView(ctx, **imageSrc, vk::VK_FORMAT_R8G8B8A8_UNORM);
+               imageViewDst = createImageView(ctx, **imageDst, vk::VK_FORMAT_R8G8B8A8_UNORM);
+       }
+
+       // Update descriptor set information
+       {
+               vk::DescriptorSetUpdateBuilder  updateBuilder;
+
+               vk::VkDescriptorImageInfo               descStorageImgDst       = makeDescriptorImageInfo((vk::VkSampler)0, *imageViewDst, vk::VK_IMAGE_LAYOUT_GENERAL);
+               vk::VkDescriptorImageInfo               descStorageImgSrc       = makeDescriptorImageInfo((vk::VkSampler)0, *imageViewSrc, vk::VK_IMAGE_LAYOUT_GENERAL);
+
+               updateBuilder.writeSingle(*descriptorSet, vk::DescriptorSetUpdateBuilder::Location::binding(0u), vk::VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, &descStorageImgDst);
+               updateBuilder.writeSingle(*descriptorSet, vk::DescriptorSetUpdateBuilder::Location::binding(1u), vk::VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, &descStorageImgSrc);
+
+               updateBuilder.update(vk, device);
+       }
+
+       // Create compute commands & submit
+       {
+               const vk::Unique<vk::VkFence>           fence           (vk::createFence(vk, device));
+               vk::Unique<vk::VkPipeline>                      pipeline        (makeComputePipeline(vk, device, *pipelineLayout, *computeShader, DE_NULL));
+               vk::Unique<vk::VkCommandBuffer>         cmdBuffer       (vk::allocateCommandBuffer(vk, device, *cmdPool, vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY));
+
+               beginCommandBuffer(vk, *cmdBuffer);
+
+               vk.cmdBindPipeline(*cmdBuffer, vk::VK_PIPELINE_BIND_POINT_COMPUTE, *pipeline);
+               vk.cmdBindDescriptorSets(*cmdBuffer, vk::VK_PIPELINE_BIND_POINT_COMPUTE, *pipelineLayout, 0u, 1u, &*descriptorSet, 0u, DE_NULL);
+               vk.cmdDispatch(*cmdBuffer, 1u, 1u, 1u);
+               endCommandBuffer(vk, *cmdBuffer);
+
+               VK_CHECK(queueSubmit(ctx, PROTECTION_ENABLED, queue, *cmdBuffer, *fence, ~0ull));
+       }
+
+       // Calculate reference image
+       calculateRef(*texture2D);
+
+       // Validate result
+       return validateResult(**imageDst, *texture2D, refSampler);
+}
+
+void WorkgroupStorageTestInstance::calculateRef (tcu::Texture2D& texture2D)
+{
+       const tcu::PixelBufferAccess&   reference       = texture2D.getLevel(0);
+
+       std::vector<tcu::IVec4> sharedData(m_params.sharedMemorySize);
+       for (deUint32 dataIdx = 0; dataIdx < m_params.sharedMemorySize; ++dataIdx)
+               sharedData[dataIdx] = reference.getPixelInt(dataIdx % reference.getWidth(), dataIdx / reference.getWidth());
+
+       for (int x = 0; x < reference.getWidth(); ++x)
+       for (int y = 0; y < reference.getHeight(); ++y)
+       {
+               const int idx = (y * reference.getWidth() + x + 1) % m_params.sharedMemorySize;
+
+               reference.setPixel(sharedData[idx], x, y);
+       }
+}
+
+tcu::TestStatus WorkgroupStorageTestInstance::validateResult (vk::VkImage image, const tcu::Texture2D& texture2D, const tcu::Sampler& refSampler)
+{
+       de::Random                      rnd                     (getSeedValue(m_params));
+       ValidationData          refData;
+
+       for (int ndx = 0; ndx < 4; ++ndx)
+       {
+               const float             lod             = 0.0f;
+               const float             cx              = rnd.getFloat(0.0f, 1.0f);
+               const float             cy              = rnd.getFloat(0.0f, 1.0f);
+
+               refData.coords[ndx] = tcu::Vec4(cx, cy, 0.0f, 0.0f);
+               refData.values[ndx] = texture2D.sample(refSampler, cx, cy, lod);
+       }
+
+       if (!m_validator.validateImage(m_protectedContext, refData, image, vk::VK_FORMAT_R8G8B8A8_UNORM))
+               return tcu::TestStatus::fail("Result validation failed");
+       else
+               return tcu::TestStatus::pass("Pass");
+}
+
+} // anonymous
+
+tcu::TestCaseGroup*    createWorkgroupStorageTests (tcu::TestContext& testCtx)
+{
+       de::MovePtr<tcu::TestCaseGroup> workgroupGroup (new tcu::TestCaseGroup(testCtx, "workgroupstorage", "Workgroup storage tests"));
+
+       static const deUint32 sharedMemSizes[] = { 1, 4, 5, 60, 101, 503 };
+
+       for (int sharedMemSizeIdx = 0; sharedMemSizeIdx < DE_LENGTH_OF_ARRAY(sharedMemSizes); ++sharedMemSizeIdx)
+       {
+               std::string testName = std::string("memsize_") + de::toString(sharedMemSizes[sharedMemSizeIdx]);
+               workgroupGroup->addChild(new WorkgroupStorageTestCase(testCtx, testName, "", Params(sharedMemSizes[sharedMemSizeIdx])));
+       }
+
+       return workgroupGroup.release();
+}
+
+} // ProtectedMem
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWorkgroupStorageTests.hpp b/external/vulkancts/modules/vulkan/protected_memory/vktProtectedMemWorkgroupStorageTests.hpp
new file mode 100644 (file)
index 0000000..cbd7264
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _VKTPROTECTEDMEMWORKGROUPSTORAGETESTS_HPP
+#define _VKTPROTECTEDMEMWORKGROUPSTORAGETESTS_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2018 The Khronos Group Inc.
+ * Copyright (c) 2018 Google Inc.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Protected memory workgroup storage tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace ProtectedMem
+{
+
+tcu::TestCaseGroup*            createWorkgroupStorageTests     (tcu::TestContext& testCtx);
+
+} // ProtectedMem
+} // vkt
+
+#endif // _VKTPROTECTEDMEMWORKGROUPSTORAGETESTS_HPP
index 1364c12..376da74 100644 (file)
@@ -773,6 +773,7 @@ de::MovePtr<vk::YCbCrImageWithMemory>       createYcbcrImage2D      (ProtectedContext&                              c
 #else
        const deUint32                          flags           = 0x0;
        const vk::MemoryRequirement     memReq          = vk::MemoryRequirement::Any;
+       DE_UNREF(protectionMode);
 #endif
 
        const vk::VkImageCreateInfo     params          =
index 4837b3c..5ebd135 100644 (file)
@@ -355462,6 +355462,12 @@ dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.y
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_cosited_disjoint
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_midpoint
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_midpoint_disjoint
+dEQP-VK.protected_memory.workgroupstorage.memsize_1
+dEQP-VK.protected_memory.workgroupstorage.memsize_4
+dEQP-VK.protected_memory.workgroupstorage.memsize_5
+dEQP-VK.protected_memory.workgroupstorage.memsize_60
+dEQP-VK.protected_memory.workgroupstorage.memsize_101
+dEQP-VK.protected_memory.workgroupstorage.memsize_503
 dEQP-VK.device_group.sfr
 dEQP-VK.device_group.sfr_sys
 dEQP-VK.device_group.sfr_dedicated
index 215cb25..2ccff81 100644 (file)
@@ -355423,6 +355423,12 @@ dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.y
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_cosited_disjoint
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_midpoint
 dEQP-VK.protected_memory.interaction.ycbcr.g16_b16r16_2plane_420_unorm.compute.ycbcr_2020.itu_narrow.tiling_optimal_midpoint_disjoint
+dEQP-VK.protected_memory.workgroupstorage.memsize_1
+dEQP-VK.protected_memory.workgroupstorage.memsize_4
+dEQP-VK.protected_memory.workgroupstorage.memsize_5
+dEQP-VK.protected_memory.workgroupstorage.memsize_60
+dEQP-VK.protected_memory.workgroupstorage.memsize_101
+dEQP-VK.protected_memory.workgroupstorage.memsize_503
 dEQP-VK.device_group.sfr
 dEQP-VK.device_group.sfr_sys
 dEQP-VK.device_group.sfr_dedicated