Dispatch base test does not enable pipeline flag
authorMarcin Rogucki <marcin.rogucki@mobica.com>
Tue, 10 Oct 2017 09:04:05 +0000 (11:04 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 10 Oct 2017 18:14:08 +0000 (14:14 -0400)
dEQP-VK.compute.device_group.dispatch_base does not enable pipeline flag which violates valid usage rule: If any of baseGroupX, baseGroupY, or baseGroupZ are not zero, then the currently bound
compute pipeline must have been created with the VK_PIPELINE_CREATE_DISPATCH_BASE flag.

An overloaded method vktComputeTestsUtil.cpp::makeComputePipeline was added that allows to pass additional parameters:
- flags for pipeline creation
- flags for compute shader creation
Old method redirected to call a new one with flags set to zero.

A method vktComputeTestsUtil.cpp::makePipelineLayout no longer takes useDeviceGroups parameter and always sets pipeline layout flags to 0.

New method used in test with proper flags passed in.

Component: Vulkan

VK-GL-CTS issue: 760

Affects: dEQP-VK.compute.device_group.dispatch_base

Change-Id: I2c7400a55809b28bb7096dcdfeba2095c1541e1b

external/vulkancts/modules/vulkan/compute/vktComputeBasicComputeShaderTests.cpp
external/vulkancts/modules/vulkan/compute/vktComputeTestsUtil.cpp
external/vulkancts/modules/vulkan/compute/vktComputeTestsUtil.hpp

index 2af2713..3961e32 100644 (file)
@@ -2654,8 +2654,8 @@ tcu::TestStatus DispatchBaseTestInstance::iterate (void)
                .update(vk, device);
 
        const Unique<VkShaderModule> shaderModule(createShaderModule(vk, device, m_context.getBinaryCollection().get("comp"), 0u));
-       const Unique<VkPipelineLayout> pipelineLayout(makePipelineLayout(vk, device, *descriptorSetLayout, true));
-       const Unique<VkPipeline> pipeline(makeComputePipeline(vk, device, *pipelineLayout, *shaderModule));
+       const Unique<VkPipelineLayout> pipelineLayout(makePipelineLayout(vk, device, *descriptorSetLayout));
+       const Unique<VkPipeline> pipeline(makeComputePipeline(vk, device, *pipelineLayout, static_cast<VkPipelineCreateFlags>(VK_PIPELINE_CREATE_DISPATCH_BASE), *shaderModule, static_cast<VkPipelineShaderStageCreateFlags>(0u)));
 
        const VkBufferMemoryBarrier hostWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *buffer, 0ull, bufferSizeBytes);
        const VkBufferMemoryBarrier hostUniformWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_UNIFORM_READ_BIT, *uniformBuffer, 0ull, uniformBufferSizeBytes);
@@ -2922,7 +2922,7 @@ tcu::TestStatus DeviceIndexTestInstance::iterate (void)
                .update(vk, device);
 
        const Unique<VkShaderModule> shaderModule(createShaderModule(vk, device, m_context.getBinaryCollection().get("comp"), 0u));
-       const Unique<VkPipelineLayout> pipelineLayout(makePipelineLayout(vk, device, *descriptorSetLayout, true));
+       const Unique<VkPipelineLayout> pipelineLayout(makePipelineLayout(vk, device, *descriptorSetLayout));
        const Unique<VkPipeline> pipeline(makeComputePipeline(vk, device, *pipelineLayout, *shaderModule));
 
        const VkBufferMemoryBarrier hostUniformWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_UNIFORM_READ_BIT, *uniformBuffer, 0ull, uniformBufferSizeBytes);
index 3e8066d..d08c58e 100644 (file)
@@ -105,7 +105,7 @@ Move<VkPipelineLayout> makePipelineLayout (const DeviceInterface&           vk,
        {
                VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,          // VkStructureType                                      sType;
                DE_NULL,                                                                                        // const void*                                          pNext;
-               0u,                                                                                                     // VkPipelineLayoutCreateFlags          flags;
+               static_cast<VkPipelineLayoutCreateFlags>(0u),           // VkPipelineLayoutCreateFlags          flags;
                0u,                                                                                                     // deUint32                                                     setLayoutCount;
                DE_NULL,                                                                                        // const VkDescriptorSetLayout*         pSetLayouts;
                0u,                                                                                                     // deUint32                                                     pushConstantRangeCount;
@@ -116,33 +116,33 @@ Move<VkPipelineLayout> makePipelineLayout (const DeviceInterface&         vk,
 
 Move<VkPipelineLayout> makePipelineLayout (const DeviceInterface&              vk,
                                                                                   const VkDevice                               device,
-                                                                                  const VkDescriptorSetLayout  descriptorSetLayout,
-                                                                                  const bool                                   useDeviceGroups)
+                                                                                  const VkDescriptorSetLayout  descriptorSetLayout)
 {
        const VkPipelineLayoutCreateInfo pipelineLayoutParams =
        {
-               VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,                                  // VkStructureType                                      sType;
-               DE_NULL,                                                                                                                // const void*                                          pNext;
-               useDeviceGroups ? VK_PIPELINE_CREATE_DISPATCH_BASE_KHR :
-                       (VkPipelineCreateFlagBits)0u,                                                           // VkPipelineLayoutCreateFlags          flags;
-               1u,                                                                                                                             // deUint32                                                     setLayoutCount;
-               &descriptorSetLayout,                                                                                   // const VkDescriptorSetLayout*         pSetLayouts;
-               0u,                                                                                                                             // deUint32                                                     pushConstantRangeCount;
-               DE_NULL,                                                                                                                // const VkPushConstantRange*           pPushConstantRanges;
+               VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,          // VkStructureType                                      sType;
+               DE_NULL,                                                                                        // const void*                                          pNext;
+               static_cast<VkPipelineLayoutCreateFlags>(0u),           // VkPipelineLayoutCreateFlags          flags;
+               1u,                                                                                                     // deUint32                                                     setLayoutCount;
+               &descriptorSetLayout,                                                           // const VkDescriptorSetLayout*         pSetLayouts;
+               0u,                                                                                                     // deUint32                                                     pushConstantRangeCount;
+               DE_NULL,                                                                                        // const VkPushConstantRange*           pPushConstantRanges;
        };
        return createPipelineLayout(vk, device, &pipelineLayoutParams);
 }
 
-Move<VkPipeline> makeComputePipeline (const DeviceInterface&   vk,
-                                                                         const VkDevice                        device,
-                                                                         const VkPipelineLayout        pipelineLayout,
-                                                                         const VkShaderModule          shaderModule)
+Move<VkPipeline> makeComputePipeline (const DeviceInterface&                                   vk,
+                                                                         const VkDevice                                                        device,
+                                                                         const VkPipelineLayout                                        pipelineLayout,
+                                                                         const VkPipelineCreateFlags                           pipelineFlags,
+                                                                         const VkShaderModule                                          shaderModule,
+                                                                         const VkPipelineShaderStageCreateFlags        shaderFlags)
 {
        const VkPipelineShaderStageCreateInfo pipelineShaderStageParams =
        {
                VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,    // VkStructureType                                              sType;
                DE_NULL,                                                                                                // const void*                                                  pNext;
-               0u,                                                                                                             // VkPipelineShaderStageCreateFlags             flags;
+               shaderFlags,                                                                                    // VkPipelineShaderStageCreateFlags             flags;
                VK_SHADER_STAGE_COMPUTE_BIT,                                                    // VkShaderStageFlagBits                                stage;
                shaderModule,                                                                                   // VkShaderModule                                               module;
                "main",                                                                                                 // const char*                                                  pName;
@@ -152,7 +152,7 @@ Move<VkPipeline> makeComputePipeline (const DeviceInterface&        vk,
        {
                VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,         // VkStructureType                                      sType;
                DE_NULL,                                                                                        // const void*                                          pNext;
-               0u,                                                                                                     // VkPipelineCreateFlags                        flags;
+               pipelineFlags,                                                                          // VkPipelineCreateFlags                        flags;
                pipelineShaderStageParams,                                                      // VkPipelineShaderStageCreateInfo      stage;
                pipelineLayout,                                                                         // VkPipelineLayout                                     layout;
                DE_NULL,                                                                                        // VkPipeline                                           basePipelineHandle;
@@ -161,6 +161,14 @@ Move<VkPipeline> makeComputePipeline (const DeviceInterface&       vk,
        return createComputePipeline(vk, device, DE_NULL , &pipelineCreateInfo);
 }
 
+Move<VkPipeline> makeComputePipeline (const DeviceInterface&   vk,
+                                                                         const VkDevice                        device,
+                                                                         const VkPipelineLayout        pipelineLayout,
+                                                                         const VkShaderModule          shaderModule)
+{
+       return makeComputePipeline(vk, device, pipelineLayout, static_cast<VkPipelineCreateFlags>(0u), shaderModule, static_cast<VkPipelineShaderStageCreateFlags>(0u));
+}
+
 Move<VkBufferView> makeBufferView (const DeviceInterface&      vk,
                                                                   const VkDevice                       vkDevice,
                                                                   const VkBuffer                       buffer,
index 5188ae9..8d78451 100644 (file)
@@ -78,73 +78,79 @@ private:
        Image&                                                  operator=               (const Image&);
 };
 
-vk::Move<vk::VkCommandPool>                    makeCommandPool                         (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkDevice                                     device,
-                                                                                                                                const deUint32                                         queueFamilyIndex);
-
-vk::Move<vk::VkPipelineLayout> makePipelineLayout                              (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkDevice                                     device);
-
-vk::Move<vk::VkPipelineLayout> makePipelineLayout                              (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkDevice                                     device,
-                                                                                                                                const vk::VkDescriptorSetLayout        descriptorSetLayout,
-                                                                                                                                const bool                                                     useDeviceGroups = false);
-
-vk::Move<vk::VkPipeline>               makeComputePipeline                             (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkDevice                                     device,
-                                                                                                                                const vk::VkPipelineLayout                     pipelineLayout,
-                                                                                                                                const vk::VkShaderModule                       shaderModule);
-
-vk::Move<vk::VkBufferView>             makeBufferView                                  (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkDevice                                     device,
-                                                                                                                                const vk::VkBuffer                                     buffer,
-                                                                                                                                const vk::VkFormat                                     format,
-                                                                                                                                const vk::VkDeviceSize                         offset,
-                                                                                                                                const vk::VkDeviceSize                         size);
-
-vk::Move<vk::VkImageView>              makeImageView                                   (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkDevice                                     device,
-                                                                                                                                const vk::VkImage                                      image,
-                                                                                                                                const vk::VkImageViewType                      imageViewType,
-                                                                                                                                const vk::VkFormat                                     format,
-                                                                                                                                const vk::VkImageSubresourceRange      subresourceRange);
-
-vk::Move<vk::VkDescriptorSet>  makeDescriptorSet                               (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkDevice                                     device,
-                                                                                                                                const vk::VkDescriptorPool                     descriptorPool,
-                                                                                                                                const vk::VkDescriptorSetLayout        setLayout);
-
-vk::VkBufferCreateInfo                 makeBufferCreateInfo                    (const vk::VkDeviceSize                         bufferSize,
-                                                                                                                                const vk::VkBufferUsageFlags           usage);
-
-vk::VkBufferImageCopy                  makeBufferImageCopy                             (const vk::VkExtent3D                           extent,
-                                                                                                                                const deUint32                                         arraySize);
-
-vk::VkBufferMemoryBarrier              makeBufferMemoryBarrier                 (const vk::VkAccessFlags                        srcAccessMask,
-                                                                                                                                const vk::VkAccessFlags                        dstAccessMask,
-                                                                                                                                const vk::VkBuffer                                     buffer,
-                                                                                                                                const vk::VkDeviceSize                         offset,
-                                                                                                                                const vk::VkDeviceSize                         bufferSizeBytes);
-
-vk::VkImageMemoryBarrier               makeImageMemoryBarrier                  (const vk::VkAccessFlags                        srcAccessMask,
-                                                                                                                                const vk::VkAccessFlags                        dstAccessMask,
-                                                                                                                                const vk::VkImageLayout                        oldLayout,
-                                                                                                                                const vk::VkImageLayout                        newLayout,
-                                                                                                                                const vk::VkImage                                      image,
-                                                                                                                                const vk::VkImageSubresourceRange      subresourceRange);
-
-void                                                   beginCommandBuffer                              (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkCommandBuffer                      cmdBuffer);
-
-void                                                   endCommandBuffer                                (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkCommandBuffer                      cmdBuffer);
-
-void                                                   submitCommandsAndWait                   (const vk::DeviceInterface&                     vk,
-                                                                                                                                const vk::VkDevice                                     device,
-                                                                                                                                const vk::VkQueue                                      queue,
-                                                                                                                                const vk::VkCommandBuffer                      cmdBuffer,
-                                                                                                                                const bool                                                     useDeviceGroups = false,
-                                                                                                                                const deUint32                                         deviceMask = 1);
+vk::Move<vk::VkCommandPool>                    makeCommandPool                         (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device,
+                                                                                                                                const deUint32                                                         queueFamilyIndex);
+
+vk::Move<vk::VkPipelineLayout> makePipelineLayout                              (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device);
+
+vk::Move<vk::VkPipelineLayout> makePipelineLayout                              (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device,
+                                                                                                                                const vk::VkDescriptorSetLayout                        descriptorSetLayout);
+
+vk::Move<vk::VkPipeline>               makeComputePipeline                             (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device,
+                                                                                                                                const vk::VkPipelineLayout                                     pipelineLayout,
+                                                                                                                                const vk::VkShaderModule                                       shaderModule);
+
+vk::Move<vk::VkPipeline>               makeComputePipeline                             (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device,
+                                                                                                                                const vk::VkPipelineLayout                                     pipelineLayout,
+                                                                                                                                const vk::VkPipelineCreateFlags                        pipelineFlags,
+                                                                                                                                const vk::VkShaderModule                                       shaderModule,
+                                                                                                                                const vk::VkPipelineShaderStageCreateFlags     shaderFlags);
+
+vk::Move<vk::VkBufferView>             makeBufferView                                  (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device,
+                                                                                                                                const vk::VkBuffer                                                     buffer,
+                                                                                                                                const vk::VkFormat                                                     format,
+                                                                                                                                const vk::VkDeviceSize                                         offset,
+                                                                                                                                const vk::VkDeviceSize                                         size);
+
+vk::Move<vk::VkImageView>              makeImageView                                   (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device,
+                                                                                                                                const vk::VkImage                                                      image,
+                                                                                                                                const vk::VkImageViewType                                      imageViewType,
+                                                                                                                                const vk::VkFormat                                                     format,
+                                                                                                                                const vk::VkImageSubresourceRange                      subresourceRange);
+
+vk::Move<vk::VkDescriptorSet>  makeDescriptorSet                               (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device,
+                                                                                                                                const vk::VkDescriptorPool                                     descriptorPool,
+                                                                                                                                const vk::VkDescriptorSetLayout                        setLayout);
+
+vk::VkBufferCreateInfo                 makeBufferCreateInfo                    (const vk::VkDeviceSize                                         bufferSize,
+                                                                                                                                const vk::VkBufferUsageFlags                           usage);
+
+vk::VkBufferImageCopy                  makeBufferImageCopy                             (const vk::VkExtent3D                                           extent,
+                                                                                                                                const deUint32                                                         arraySize);
+
+vk::VkBufferMemoryBarrier              makeBufferMemoryBarrier                 (const vk::VkAccessFlags                                        srcAccessMask,
+                                                                                                                                const vk::VkAccessFlags                                        dstAccessMask,
+                                                                                                                                const vk::VkBuffer                                                     buffer,
+                                                                                                                                const vk::VkDeviceSize                                         offset,
+                                                                                                                                const vk::VkDeviceSize                                         bufferSizeBytes);
+
+vk::VkImageMemoryBarrier               makeImageMemoryBarrier                  (const vk::VkAccessFlags                                        srcAccessMask,
+                                                                                                                                const vk::VkAccessFlags                                        dstAccessMask,
+                                                                                                                                const vk::VkImageLayout                                        oldLayout,
+                                                                                                                                const vk::VkImageLayout                                        newLayout,
+                                                                                                                                const vk::VkImage                                                      image,
+                                                                                                                                const vk::VkImageSubresourceRange                      subresourceRange);
+
+void                                                   beginCommandBuffer                              (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkCommandBuffer                                      cmdBuffer);
+
+void                                                   endCommandBuffer                                (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkCommandBuffer                                      cmdBuffer);
+
+void                                                   submitCommandsAndWait                   (const vk::DeviceInterface&                                     vk,
+                                                                                                                                const vk::VkDevice                                                     device,
+                                                                                                                                const vk::VkQueue                                                      queue,
+                                                                                                                                const vk::VkCommandBuffer                                      cmdBuffer,
+                                                                                                                                const bool                                                                     useDeviceGroups = false,
+                                                                                                                                const deUint32                                                         deviceMask = 1);
 
 inline vk::VkExtent3D makeExtent3D (const tcu::IVec3& vec)
 {