Lines Matching defs:const
73 T multiplyComponents (const tcu::Vector<T, size>& v)
82 inline T squared (const T& a)
87 inline VkImageCreateInfo make2DImageCreateInfo (const tcu::IVec2& imageSize, const VkImageUsageFlags usage)
89 const VkImageCreateInfo imageParams =
92 DE_NULL, // const void* pNext;
104 DE_NULL, // const deUint32* pQueueFamilyIndices;
110 inline VkBufferImageCopy makeBufferImageCopy(const tcu::IVec2& imageSize)
125 const std::string& name,
126 const tcu::IVec3& localSize,
127 const tcu::IVec3& workSize,
128 const vk::ComputePipelineConstructionType computePipelineConstructionType);
130 virtual void checkSupport (Context& context) const;
131 void initPrograms (SourceCollections& sourceCollections) const;
132 TestInstance* createInstance (Context& context) const;
135 const tcu::IVec3 m_localSize;
136 const tcu::IVec3 m_workSize;
144 const tcu::IVec3& localSize,
145 const tcu::IVec3& workSize,
146 const vk::ComputePipelineConstructionType computePipelineConstructionType);
151 const tcu::IVec3 m_localSize;
152 const tcu::IVec3 m_workSize;
157 const std::string& name,
158 const tcu::IVec3& localSize,
159 const tcu::IVec3& workSize,
160 const vk::ComputePipelineConstructionType computePipelineConstructionType)
168 void SharedVarTest::checkSupport (Context& context) const
173 void SharedVarTest::initPrograms (SourceCollections& sourceCollections) const
175 const int workGroupSize = multiplyComponents(m_localSize);
176 const int workGroupCount = multiplyComponents(m_workSize);
177 const int numValues = workGroupSize * workGroupCount;
201 TestInstance* SharedVarTest::createInstance (Context& context) const
206 SharedVarTestInstance::SharedVarTestInstance (Context& context, const tcu::IVec3& localSize, const tcu::IVec3& workSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
216 const DeviceInterface& vk = m_context.getDeviceInterface();
217 const VkDevice device = m_context.getDevice();
218 const VkQueue queue = m_context.getUniversalQueue();
219 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
222 const int workGroupSize = multiplyComponents(m_localSize);
223 const int workGroupCount = multiplyComponents(m_workSize);
227 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * workGroupSize * workGroupCount;
228 const BufferWithMemory buffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
232 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
237 const Unique<VkDescriptorPool> descriptorPool(
242 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
244 const VkDescriptorBufferInfo descriptorInfo = makeDescriptorBufferInfo(*buffer, 0ull, bufferSizeBytes);
255 const VkBufferMemoryBarrier computeFinishBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *buffer, 0ull, bufferSizeBytes);
257 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
258 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
269 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &computeFinishBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
279 const Allocation& bufferAllocation = buffer.getAllocation();
282 const deUint32* bufferPtr = static_cast<deUint32*>(bufferAllocation.getHostPtr());
286 const int globalOffset = groupNdx * workGroupSize;
289 const deUint32 res = bufferPtr[globalOffset + localOffset];
290 const deUint32 ref = globalOffset + squared(workGroupSize - localOffset - 1);
307 const std::string& name,
308 const tcu::IVec3& localSize,
309 const tcu::IVec3& workSize,
310 const vk::ComputePipelineConstructionType computePipelineConstructionType);
312 virtual void checkSupport (Context& context) const;
313 void initPrograms (SourceCollections& sourceCollections) const;
314 TestInstance* createInstance (Context& context) const;
317 const tcu::IVec3 m_localSize;
318 const tcu::IVec3 m_workSize;
326 const tcu::IVec3& localSize,
327 const tcu::IVec3& workSize,
328 const vk::ComputePipelineConstructionType computePipelineConstructionType);
333 const tcu::IVec3 m_localSize;
334 const tcu::IVec3 m_workSize;
339 const std::string& name,
340 const tcu::IVec3& localSize,
341 const tcu::IVec3& workSize,
342 const vk::ComputePipelineConstructionType computePipelineConstructionType)
350 void SharedVarAtomicOpTest::checkSupport (Context& context) const
355 void SharedVarAtomicOpTest::initPrograms (SourceCollections& sourceCollections) const
357 const int workGroupSize = multiplyComponents(m_localSize);
358 const int workGroupCount = multiplyComponents(m_workSize);
359 const int numValues = workGroupSize * workGroupCount;
383 TestInstance* SharedVarAtomicOpTest::createInstance (Context& context) const
388 SharedVarAtomicOpTestInstance::SharedVarAtomicOpTestInstance (Context& context, const tcu::IVec3& localSize, const tcu::IVec3& workSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
398 const DeviceInterface& vk = m_context.getDeviceInterface();
399 const VkDevice device = m_context.getDevice();
400 const VkQueue queue = m_context.getUniversalQueue();
401 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
404 const int workGroupSize = multiplyComponents(m_localSize);
405 const int workGroupCount = multiplyComponents(m_workSize);
409 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * workGroupSize * workGroupCount;
410 const BufferWithMemory buffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
414 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
419 const Unique<VkDescriptorPool> descriptorPool(
424 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
426 const VkDescriptorBufferInfo descriptorInfo = makeDescriptorBufferInfo(*buffer, 0ull, bufferSizeBytes);
437 const VkBufferMemoryBarrier computeFinishBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *buffer, 0ull, bufferSizeBytes);
439 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
440 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
451 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1u, &computeFinishBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
461 const Allocation& bufferAllocation = buffer.getAllocation();
464 const deUint32* bufferPtr = static_cast<deUint32*>(bufferAllocation.getHostPtr());
468 const int globalOffset = groupNdx * workGroupSize;
471 const deUint32 res = bufferPtr[globalOffset + localOffset];
472 const deUint32 ref = localOffset + 1;
489 const std::string& name,
490 const tcu::IVec3& localSize,
491 const tcu::IVec3& workSize,
492 const vk::ComputePipelineConstructionType computePipelineConstructionType
495 virtual void checkSupport (Context& context) const;
496 void initPrograms (SourceCollections& sourceCollections) const;
497 TestInstance* createInstance (Context& context) const;
500 const tcu::IVec3 m_localSize;
501 const tcu::IVec3 m_workSize;
509 const tcu::IVec3& localSize,
510 const tcu::IVec3& workSize,
511 const vk::ComputePipelineConstructionType computePipelineConstructionType);
516 const tcu::IVec3 m_localSize;
517 const tcu::IVec3 m_workSize;
522 const std::string& name,
523 const tcu::IVec3& localSize,
524 const tcu::IVec3& workSize,
525 const vk::ComputePipelineConstructionType computePipelineConstructionType)
533 void SSBOLocalBarrierTest::checkSupport (Context& context) const
538 void SSBOLocalBarrierTest::initPrograms (SourceCollections& sourceCollections) const
540 const int workGroupSize = multiplyComponents(m_localSize);
541 const int workGroupCount = multiplyComponents(m_workSize);
542 const int numValues = workGroupSize * workGroupCount;
568 TestInstance* SSBOLocalBarrierTest::createInstance (Context& context) const
573 SSBOLocalBarrierTestInstance::SSBOLocalBarrierTestInstance (Context& context, const tcu::IVec3& localSize, const tcu::IVec3& workSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
583 const DeviceInterface& vk = m_context.getDeviceInterface();
584 const VkDevice device = m_context.getDevice();
585 const VkQueue queue = m_context.getUniversalQueue();
586 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
589 const int workGroupSize = multiplyComponents(m_localSize);
590 const int workGroupCount = multiplyComponents(m_workSize);
594 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * workGroupSize * workGroupCount;
595 const BufferWithMemory buffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
599 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
604 const Unique<VkDescriptorPool> descriptorPool(
609 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
611 const VkDescriptorBufferInfo descriptorInfo = makeDescriptorBufferInfo(*buffer, 0ull, bufferSizeBytes);
622 const VkBufferMemoryBarrier computeFinishBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *buffer, 0ull, bufferSizeBytes);
624 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
625 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
636 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &computeFinishBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
646 const Allocation& bufferAllocation = buffer.getAllocation();
649 const deUint32* bufferPtr = static_cast<deUint32*>(bufferAllocation.getHostPtr());
653 const int globalOffset = groupNdx * workGroupSize;
656 const deUint32 res = bufferPtr[globalOffset + localOffset];
657 const int offs0 = localOffset - 1 < 0 ? ((localOffset + workGroupSize - 1) % workGroupSize) : ((localOffset - 1) % workGroupSize);
658 const int offs1 = localOffset - 2 < 0 ? ((localOffset + workGroupSize - 2) % workGroupSize) : ((localOffset - 2) % workGroupSize);
659 const deUint32 ref = static_cast<deUint32>(globalOffset + offs0 + offs1);
676 const std::string& name,
677 const tcu::IVec2& localSize,
678 const tcu::IVec2& imageSize,
679 const vk::ComputePipelineConstructionType computePipelineConstructionType);
681 virtual void checkSupport (Context& context) const;
682 void initPrograms (SourceCollections& sourceCollections) const;
683 TestInstance* createInstance (Context& context) const;
686 const tcu::IVec2 m_localSize;
687 const tcu::IVec2 m_imageSize;
695 const tcu::IVec2& localSize,
696 const tcu::IVec2& imageSize,
697 const vk::ComputePipelineConstructionType computePipelineConstructionType);
702 const tcu::IVec2 m_localSize;
703 const tcu::IVec2 m_imageSize;
708 const std::string& name,
709 const tcu::IVec2& localSize,
710 const tcu::IVec2& imageSize,
711 const vk::ComputePipelineConstructionType computePipelineConstructionType)
721 void CopyImageToSSBOTest::checkSupport (Context& context) const
726 void CopyImageToSSBOTest::initPrograms (SourceCollections& sourceCollections) const
744 TestInstance* CopyImageToSSBOTest::createInstance (Context& context) const
749 CopyImageToSSBOTestInstance::CopyImageToSSBOTestInstance (Context& context, const tcu::IVec2& localSize, const tcu::IVec2& imageSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
759 const DeviceInterface& vk = m_context.getDeviceInterface();
760 const VkDevice device = m_context.getDevice();
761 const VkQueue queue = m_context.getUniversalQueue();
762 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
767 const VkImageCreateInfo imageParams = make2DImageCreateInfo(m_imageSize, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_STORAGE_BIT);
768 const ImageWithMemory image(vk, device, allocator, imageParams, MemoryRequirement::Any);
770 const VkImageSubresourceRange subresourceRange = makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u);
771 const Unique<VkImageView> imageView(makeImageView(vk, device, *image, VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_R32_UINT, subresourceRange));
775 const deUint32 imageArea = multiplyComponents(m_imageSize);
776 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * imageArea;
778 const BufferWithMemory stagingBuffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_TRANSFER_SRC_BIT), MemoryRequirement::HostVisible);
783 const Allocation& stagingBufferAllocation = stagingBuffer.getAllocation();
793 const BufferWithMemory outputBuffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
797 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
803 const Unique<VkDescriptorPool> descriptorPool(
809 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
813 const VkDescriptorImageInfo imageDescriptorInfo = makeDescriptorImageInfo(DE_NULL, *imageView, VK_IMAGE_LAYOUT_GENERAL);
814 const VkDescriptorBufferInfo bufferDescriptorInfo = makeDescriptorBufferInfo(*outputBuffer, 0ull, bufferSizeBytes);
827 const VkBufferMemoryBarrier computeFinishBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *outputBuffer, 0ull, bufferSizeBytes);
828 const tcu::IVec2 workSize = m_imageSize / m_localSize;
832 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
833 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
842 const std::vector<VkBufferImageCopy> bufferImageCopy(1, makeBufferImageCopy(m_imageSize));
846 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &computeFinishBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
857 const Allocation& outputBufferAllocation = outputBuffer.getAllocation();
860 const deUint32* bufferPtr = static_cast<deUint32*>(outputBufferAllocation.getHostPtr());
861 const deUint32* refBufferPtr = static_cast<deUint32*>(stagingBuffer.getAllocation().getHostPtr());
865 const deUint32 res = *(bufferPtr + ndx);
866 const deUint32 ref = *(refBufferPtr + ndx);
882 const std::string& name,
883 const tcu::IVec2& localSize,
884 const tcu::IVec2& imageSize,
885 const vk::ComputePipelineConstructionType computePipelineConstructionType);
887 virtual void checkSupport (Context& context) const;
888 void initPrograms (SourceCollections& sourceCollections) const;
889 TestInstance* createInstance (Context& context) const;
892 const tcu::IVec2 m_localSize;
893 const tcu::IVec2 m_imageSize;
901 const tcu::IVec2& localSize,
902 const tcu::IVec2& imageSize,
903 const vk::ComputePipelineConstructionType computePipelineConstructionType);
908 const tcu::IVec2 m_localSize;
909 const tcu::IVec2 m_imageSize;
914 const std::string& name,
915 const tcu::IVec2& localSize,
916 const tcu::IVec2& imageSize,
917 const vk::ComputePipelineConstructionType computePipelineConstructionType)
927 void CopySSBOToImageTest::checkSupport (Context& context) const
932 void CopySSBOToImageTest::initPrograms (SourceCollections& sourceCollections) const
950 TestInstance* CopySSBOToImageTest::createInstance (Context& context) const
955 CopySSBOToImageTestInstance::CopySSBOToImageTestInstance (Context& context, const tcu::IVec2& localSize, const tcu::IVec2& imageSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
966 const DeviceInterface& vkd = data.vkd;
969 const VkImageSubresourceRange subresourceRange = makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u);
974 const deUint32 imageArea = multiplyComponents(m_imageSize);
975 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * imageArea;
977 const BufferWithMemory inputBuffer(vkd, data.device, data.allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
982 const Allocation& inputBufferAllocation = inputBuffer.getAllocation();
991 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
997 const Unique<VkDescriptorPool> descriptorPool(
1003 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vkd, data.device, *descriptorPool, *descriptorSetLayout));
1007 const VkDescriptorImageInfo imageDescriptorInfo = makeDescriptorImageInfo(DE_NULL, imageWithBuffer.getImageView(), VK_IMAGE_LAYOUT_GENERAL);
1008 const VkDescriptorBufferInfo bufferDescriptorInfo = makeDescriptorBufferInfo(*inputBuffer, 0ull, bufferSizeBytes);
1021 const VkBufferMemoryBarrier inputBufferPostHostWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *inputBuffer, 0ull, bufferSizeBytes);
1023 const VkImageMemoryBarrier imageLayoutBarrier = makeImageMemoryBarrier(
1028 const tcu::IVec2 workSize = m_imageSize / m_localSize;
1032 const Unique<VkCommandPool> cmdPool(makeCommandPool(vkd, data.device, data.qfIndex));
1033 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vkd, data.device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
1042 vkd.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &inputBufferPostHostWriteBarrier, 1, &imageLayoutBarrier);
1056 const Allocation& outputBufferAllocation = imageWithBuffer.getBufferAllocation();
1059 const deUint32* bufferPtr = static_cast<deUint32*>(outputBufferAllocation.getHostPtr());
1060 const deUint32* refBufferPtr = static_cast<deUint32*>(inputBuffer.getAllocation().getHostPtr());
1064 const deUint32 res = *(bufferPtr + ndx);
1065 const deUint32 ref = *(refBufferPtr + ndx);
1080 virtual void checkSupport (Context& context) const;
1081 void initPrograms (SourceCollections& sourceCollections) const;
1082 TestInstance* createInstance (Context& context) const;
1085 const std::string& name,
1086 const deUint32 numValues,
1087 const tcu::IVec3& localSize,
1088 const tcu::IVec3& workSize,
1089 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1092 const std::string& name,
1093 const deUint32 numValues,
1094 const tcu::IVec3& localSize,
1095 const tcu::IVec3& workSize,
1096 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1100 const std::string& name,
1101 const deUint32 numValues,
1102 const tcu::IVec3& localSize,
1103 const tcu::IVec3& workSize,
1104 const BufferType bufferType,
1105 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1107 const BufferType m_bufferType;
1108 const deUint32 m_numValues;
1109 const tcu::IVec3 m_localSize;
1110 const tcu::IVec3 m_workSize;
1118 const deUint32 numValues,
1119 const tcu::IVec3& localSize,
1120 const tcu::IVec3& workSize,
1121 const BufferType bufferType,
1122 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1127 const BufferType m_bufferType;
1128 const deUint32 m_numValues;
1129 const tcu::IVec3 m_localSize;
1130 const tcu::IVec3 m_workSize;
1135 const std::string& name,
1136 const deUint32 numValues,
1137 const tcu::IVec3& localSize,
1138 const tcu::IVec3& workSize,
1139 const BufferType bufferType,
1140 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1153 const std::string& name,
1154 const deUint32 numValues,
1155 const tcu::IVec3& localSize,
1156 const tcu::IVec3& workSize,
1157 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1163 const std::string& name,
1164 const deUint32 numValues,
1165 const tcu::IVec3& localSize,
1166 const tcu::IVec3& workSize,
1167 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1172 void BufferToBufferInvertTest::checkSupport (Context& context) const
1177 void BufferToBufferInvertTest::initPrograms (SourceCollections& sourceCollections) const
1224 TestInstance* BufferToBufferInvertTest::createInstance (Context& context) const
1230 const deUint32 numValues,
1231 const tcu::IVec3& localSize,
1232 const tcu::IVec3& workSize,
1233 const BufferType bufferType,
1234 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1246 const DeviceInterface& vk = m_context.getDeviceInterface();
1247 const VkDevice device = m_context.getDevice();
1248 const VkQueue queue = m_context.getUniversalQueue();
1249 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
1254 const VkBufferUsageFlags inputBufferUsageFlags = (m_bufferType == BUFFER_TYPE_UNIFORM ? VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT : VK_BUFFER_USAGE_STORAGE_BUFFER_BIT);
1255 const VkDescriptorType inputBufferDescriptorType = (m_bufferType == BUFFER_TYPE_UNIFORM ? VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER : VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
1256 const deUint32 randomSeed = (m_bufferType == BUFFER_TYPE_UNIFORM ? 0x111223f : 0x124fef);
1260 const VkDeviceSize bufferSizeBytes = sizeof(tcu::UVec4) * m_numValues;
1261 const BufferWithMemory inputBuffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, inputBufferUsageFlags), MemoryRequirement::HostVisible);
1266 const Allocation& inputBufferAllocation = inputBuffer.getAllocation();
1276 const BufferWithMemory outputBuffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
1280 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
1286 const Unique<VkDescriptorPool> descriptorPool(
1292 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
1294 const VkDescriptorBufferInfo inputBufferDescriptorInfo = makeDescriptorBufferInfo(*inputBuffer, 0ull, bufferSizeBytes);
1295 const VkDescriptorBufferInfo outputBufferDescriptorInfo = makeDescriptorBufferInfo(*outputBuffer, 0ull, bufferSizeBytes);
1307 const VkBufferMemoryBarrier hostWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *inputBuffer, 0ull, bufferSizeBytes);
1309 const VkBufferMemoryBarrier shaderWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *outputBuffer, 0ull, bufferSizeBytes);
1311 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
1312 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
1321 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &hostWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
1323 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &shaderWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
1333 const Allocation& outputBufferAllocation = outputBuffer.getAllocation();
1336 const tcu::UVec4* bufferPtr = static_cast<tcu::UVec4*>(outputBufferAllocation.getHostPtr());
1337 const tcu::UVec4* refBufferPtr = static_cast<tcu::UVec4*>(inputBuffer.getAllocation().getHostPtr());
1341 const deUint32 res = bufferPtr[ndx].x();
1342 const deUint32 ref = ~refBufferPtr[ndx].x();
1358 const std::string& name,
1359 const deUint32 numValues,
1360 const bool sized,
1361 const tcu::IVec3& localSize,
1362 const tcu::IVec3& workSize,
1363 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1365 virtual void checkSupport (Context& context) const;
1366 void initPrograms (SourceCollections& sourceCollections) const;
1367 TestInstance* createInstance (Context& context) const;
1370 const deUint32 m_numValues;
1371 const bool m_sized;
1372 const tcu::IVec3 m_localSize;
1373 const tcu::IVec3 m_workSize;
1381 const deUint32 numValues,
1382 const tcu::IVec3& localSize,
1383 const tcu::IVec3& workSize,
1384 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1389 const deUint32 m_numValues;
1390 const tcu::IVec3 m_localSize;
1391 const tcu::IVec3 m_workSize;
1396 const std::string& name,
1397 const deUint32 numValues,
1398 const bool sized,
1399 const tcu::IVec3& localSize,
1400 const tcu::IVec3& workSize,
1401 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1412 void InvertSSBOInPlaceTest::checkSupport (Context& context) const
1417 void InvertSSBOInPlaceTest::initPrograms (SourceCollections& sourceCollections) const
1438 TestInstance* InvertSSBOInPlaceTest::createInstance (Context& context) const
1444 const deUint32 numValues,
1445 const tcu::IVec3& localSize,
1446 const tcu::IVec3& workSize,
1447 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1458 const DeviceInterface& vk = m_context.getDeviceInterface();
1459 const VkDevice device = m_context.getDevice();
1460 const VkQueue queue = m_context.getUniversalQueue();
1461 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
1466 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * m_numValues;
1467 const BufferWithMemory buffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
1476 const Allocation& bufferAllocation = buffer.getAllocation();
1486 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
1491 const Unique<VkDescriptorPool> descriptorPool(
1496 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
1498 const VkDescriptorBufferInfo bufferDescriptorInfo = makeDescriptorBufferInfo(*buffer, 0ull, bufferSizeBytes);
1509 const VkBufferMemoryBarrier hostWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *buffer, 0ull, bufferSizeBytes);
1511 const VkBufferMemoryBarrier shaderWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *buffer, 0ull, bufferSizeBytes);
1513 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
1514 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
1523 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &hostWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
1525 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &shaderWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
1535 const Allocation& bufferAllocation = buffer.getAllocation();
1538 const deUint32* bufferPtr = static_cast<deUint32*>(bufferAllocation.getHostPtr());
1542 const deUint32 res = bufferPtr[ndx];
1543 const deUint32 ref = ~inputData[ndx];
1559 const std::string& name,
1560 const deUint32 numValues,
1561 const bool sized,
1562 const tcu::IVec3& localSize,
1563 const tcu::IVec3& workSize,
1564 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1566 virtual void checkSupport (Context& context) const;
1567 void initPrograms (SourceCollections& sourceCollections) const;
1568 TestInstance* createInstance (Context& context) const;
1571 const deUint32 m_numValues;
1572 const bool m_sized;
1573 const tcu::IVec3 m_localSize;
1574 const tcu::IVec3 m_workSize;
1582 const deUint32 numValues,
1583 const tcu::IVec3& localSize,
1584 const tcu::IVec3& workSize,
1585 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1590 const deUint32 m_numValues;
1591 const tcu::IVec3 m_localSize;
1592 const tcu::IVec3 m_workSize;
1597 const std::string& name,
1598 const deUint32 numValues,
1599 const bool sized,
1600 const tcu::IVec3& localSize,
1601 const tcu::IVec3& workSize,
1602 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1613 void WriteToMultipleSSBOTest::checkSupport (Context& context) const
1618 void WriteToMultipleSSBOTest::initPrograms (SourceCollections& sourceCollections) const
1652 TestInstance* WriteToMultipleSSBOTest::createInstance (Context& context) const
1658 const deUint32 numValues,
1659 const tcu::IVec3& localSize,
1660 const tcu::IVec3& workSize,
1661 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1672 const DeviceInterface& vk = m_context.getDeviceInterface();
1673 const VkDevice device = m_context.getDevice();
1674 const VkQueue queue = m_context.getUniversalQueue();
1675 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
1680 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * m_numValues;
1681 const BufferWithMemory buffer0(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
1682 const BufferWithMemory buffer1(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
1686 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
1692 const Unique<VkDescriptorPool> descriptorPool(
1697 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
1699 const VkDescriptorBufferInfo buffer0DescriptorInfo = makeDescriptorBufferInfo(*buffer0, 0ull, bufferSizeBytes);
1700 const VkDescriptorBufferInfo buffer1DescriptorInfo = makeDescriptorBufferInfo(*buffer1, 0ull, bufferSizeBytes);
1712 const VkBufferMemoryBarrier shaderWriteBarriers[] =
1718 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
1719 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
1729 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, DE_LENGTH_OF_ARRAY(shaderWriteBarriers), shaderWriteBarriers, 0, (const VkImageMemoryBarrier*)DE_NULL);
1739 const Allocation& buffer0Allocation = buffer0.getAllocation();
1741 const deUint32* buffer0Ptr = static_cast<deUint32*>(buffer0Allocation.getHostPtr());
1745 const deUint32 res = buffer0Ptr[ndx];
1746 const deUint32 ref = ndx;
1757 const Allocation& buffer1Allocation = buffer1.getAllocation();
1759 const deUint32* buffer1Ptr = static_cast<deUint32*>(buffer1Allocation.getHostPtr());
1763 const deUint32 res = buffer1Ptr[ndx];
1764 const deUint32 ref = m_numValues - ndx;
1781 const std::string& name,
1782 const tcu::IVec3& workSize,
1783 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1785 virtual void checkSupport (Context& context) const;
1786 void initPrograms (SourceCollections& sourceCollections) const;
1787 TestInstance* createInstance (Context& context) const;
1790 const tcu::IVec3 m_workSize;
1798 const tcu::IVec3& workSize,
1799 const vk::ComputePipelineConstructionType computePipelineConstructionType);
1804 const tcu::IVec3 m_workSize;
1809 const std::string& name,
1810 const tcu::IVec3& workSize,
1811 const vk::ComputePipelineConstructionType computePipelineConstructionType)
1818 void SSBOBarrierTest::checkSupport (Context& context) const
1823 void SSBOBarrierTest::initPrograms (SourceCollections& sourceCollections) const
1855 TestInstance* SSBOBarrierTest::createInstance (Context& context) const
1860 SSBOBarrierTestInstance::SSBOBarrierTestInstance (Context& context, const tcu::IVec3& workSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
1869 const DeviceInterface& vk = m_context.getDeviceInterface();
1870 const VkDevice device = m_context.getDevice();
1871 const VkQueue queue = m_context.getUniversalQueue();
1872 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
1877 const int workGroupCount = multiplyComponents(m_workSize);
1878 const VkDeviceSize workBufferSizeBytes = sizeof(deUint32) * workGroupCount;
1879 const BufferWithMemory workBuffer(vk, device, allocator, makeBufferCreateInfo(workBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::Any);
1883 const VkDeviceSize outputBufferSizeBytes = sizeof(deUint32);
1884 const BufferWithMemory outputBuffer(vk, device, allocator, makeBufferCreateInfo(outputBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
1888 const Allocation& outputBufferAllocation = outputBuffer.getAllocation();
1896 const VkDeviceSize uniformBufferSizeBytes = sizeof(deUint32);
1897 const BufferWithMemory uniformBuffer(vk, device, allocator, makeBufferCreateInfo(uniformBufferSizeBytes, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT), MemoryRequirement::HostVisible);
1901 const deUint32 baseValue = 127;
1903 const Allocation& uniformBufferAllocation = uniformBuffer.getAllocation();
1912 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
1919 const Unique<VkDescriptorPool> descriptorPool(
1925 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
1927 const VkDescriptorBufferInfo workBufferDescriptorInfo = makeDescriptorBufferInfo(*workBuffer, 0ull, workBufferSizeBytes);
1928 const VkDescriptorBufferInfo outputBufferDescriptorInfo = makeDescriptorBufferInfo(*outputBuffer, 0ull, outputBufferSizeBytes);
1929 const VkDescriptorBufferInfo uniformBufferDescriptorInfo = makeDescriptorBufferInfo(*uniformBuffer, 0ull, uniformBufferSizeBytes);
1946 const VkBufferMemoryBarrier writeUniformConstantsBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_UNIFORM_READ_BIT, *uniformBuffer, 0ull, uniformBufferSizeBytes);
1948 const VkBufferMemoryBarrier betweenShadersBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *workBuffer, 0ull, workBufferSizeBytes);
1950 const VkBufferMemoryBarrier afterComputeBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *outputBuffer, 0ull, outputBufferSizeBytes);
1952 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
1953 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
1962 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &writeUniformConstantsBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
1965 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &betweenShadersBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
1971 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &afterComputeBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
1981 const Allocation& outputBufferAllocation = outputBuffer.getAllocation();
1984 const deUint32* bufferPtr = static_cast<deUint32*>(outputBufferAllocation.getHostPtr());
1985 const deUint32 res = *bufferPtr;
2004 const std::string& name,
2005 const deUint32 localSize,
2006 const tcu::IVec2& imageSize,
2007 const vk::ComputePipelineConstructionType computePipelineConstructionType);
2009 virtual void checkSupport (Context& context) const;
2010 void initPrograms (SourceCollections& sourceCollections) const;
2011 TestInstance* createInstance (Context& context) const;
2014 const deUint32 m_localSize;
2015 const tcu::IVec2 m_imageSize;
2023 const deUint32 localSize,
2024 const tcu::IVec2& imageSize,
2025 const vk::ComputePipelineConstructionType computePipelineConstructionType);
2030 const deUint32 m_localSize;
2031 const tcu::IVec2 m_imageSize;
2036 const std::string& name,
2037 const deUint32 localSize,
2038 const tcu::IVec2& imageSize,
2039 const vk::ComputePipelineConstructionType computePipelineConstructionType)
2047 void ImageAtomicOpTest::checkSupport (Context& context) const
2052 void ImageAtomicOpTest::initPrograms (SourceCollections& sourceCollections) const
2076 TestInstance* ImageAtomicOpTest::createInstance (Context& context) const
2081 ImageAtomicOpTestInstance::ImageAtomicOpTestInstance (Context& context, const deUint32 localSize, const tcu::IVec2& imageSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
2091 const DeviceInterface& vk = m_context.getDeviceInterface();
2092 const VkDevice device = m_context.getDevice();
2093 const VkQueue queue = m_context.getUniversalQueue();
2094 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
2099 const VkImageCreateInfo imageParams = make2DImageCreateInfo(m_imageSize, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_STORAGE_BIT);
2100 const ImageWithMemory image(vk, device, allocator, imageParams, MemoryRequirement::Any);
2102 const VkImageSubresourceRange subresourceRange = makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u);
2103 const Unique<VkImageView> imageView(makeImageView(vk, device, *image, VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_R32_UINT, subresourceRange));
2107 const deUint32 numInputValues = multiplyComponents(m_imageSize) * m_localSize;
2108 const VkDeviceSize inputBufferSizeBytes = sizeof(deUint32) * numInputValues;
2110 const BufferWithMemory inputBuffer(vk, device, allocator, makeBufferCreateInfo(inputBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
2115 const Allocation& inputBufferAllocation = inputBuffer.getAllocation();
2125 const deUint32 imageArea = multiplyComponents(m_imageSize);
2126 const VkDeviceSize outputBufferSizeBytes = sizeof(deUint32) * imageArea;
2127 const BufferWithMemory outputBuffer(vk, device, allocator, makeBufferCreateInfo(outputBufferSizeBytes, VK_BUFFER_USAGE_TRANSFER_DST_BIT), MemoryRequirement::HostVisible);
2131 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
2137 const Unique<VkDescriptorPool> descriptorPool(
2143 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
2147 const VkDescriptorImageInfo imageDescriptorInfo = makeDescriptorImageInfo(DE_NULL, *imageView, VK_IMAGE_LAYOUT_GENERAL);
2148 const VkDescriptorBufferInfo bufferDescriptorInfo = makeDescriptorBufferInfo(*inputBuffer, 0ull, inputBufferSizeBytes);
2161 const VkBufferMemoryBarrier inputBufferPostHostWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *inputBuffer, 0ull, inputBufferSizeBytes);
2163 const VkImageMemoryBarrier imageLayoutBarrier = makeImageMemoryBarrier(
2170 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
2171 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
2180 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &inputBufferPostHostWriteBarrier, 1, &imageLayoutBarrier);
2194 const Allocation& outputBufferAllocation = outputBuffer.getAllocation();
2197 const deUint32* bufferPtr = static_cast<deUint32*>(outputBufferAllocation.getHostPtr());
2198 const deUint32* refBufferPtr = static_cast<deUint32*>(inputBuffer.getAllocation().getHostPtr());
2202 const deUint32 res = bufferPtr[pixelNdx];
2222 const std::string& name,
2223 const tcu::IVec2& imageSize,
2224 const vk::ComputePipelineConstructionType computePipelineConstructionType);
2226 virtual void checkSupport (Context& context) const;
2227 void initPrograms (SourceCollections& sourceCollections) const;
2228 TestInstance* createInstance (Context& context) const;
2231 const tcu::IVec2 m_imageSize;
2239 const tcu::IVec2& imageSize,
2240 const vk::ComputePipelineConstructionType computePipelineConstructionType);
2245 const tcu::IVec2 m_imageSize;
2250 const std::string& name,
2251 const tcu::IVec2& imageSize,
2252 const vk::ComputePipelineConstructionType computePipelineConstructionType)
2259 void ImageBarrierTest::checkSupport (Context& context) const
2264 void ImageBarrierTest::initPrograms (SourceCollections& sourceCollections) const
2291 TestInstance* ImageBarrierTest::createInstance (Context& context) const
2296 ImageBarrierTestInstance::ImageBarrierTestInstance (Context& context, const tcu::IVec2& imageSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
2305 const DeviceInterface& vk = m_context.getDeviceInterface();
2306 const VkDevice device = m_context.getDevice();
2307 const VkQueue queue = m_context.getUniversalQueue();
2308 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
2313 const VkImageCreateInfo imageParams = make2DImageCreateInfo(m_imageSize, VK_IMAGE_USAGE_STORAGE_BIT);
2314 const ImageWithMemory image(vk, device, allocator, imageParams, MemoryRequirement::Any);
2316 const VkImageSubresourceRange subresourceRange = makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u);
2317 const Unique<VkImageView> imageView(makeImageView(vk, device, *image, VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_R32_UINT, subresourceRange));
2321 const VkDeviceSize outputBufferSizeBytes = sizeof(deUint32);
2322 const BufferWithMemory outputBuffer(vk, device, allocator, makeBufferCreateInfo(outputBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
2326 const Allocation& outputBufferAllocation = outputBuffer.getAllocation();
2334 const VkDeviceSize uniformBufferSizeBytes = sizeof(deUint32);
2335 const BufferWithMemory uniformBuffer(vk, device, allocator, makeBufferCreateInfo(uniformBufferSizeBytes, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT), MemoryRequirement::HostVisible);
2339 const deUint32 baseValue = 127;
2341 const Allocation& uniformBufferAllocation = uniformBuffer.getAllocation();
2350 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
2357 const Unique<VkDescriptorPool> descriptorPool(
2364 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
2366 const VkDescriptorImageInfo imageDescriptorInfo = makeDescriptorImageInfo(DE_NULL, *imageView, VK_IMAGE_LAYOUT_GENERAL);
2367 const VkDescriptorBufferInfo outputBufferDescriptorInfo = makeDescriptorBufferInfo(*outputBuffer, 0ull, outputBufferSizeBytes);
2368 const VkDescriptorBufferInfo uniformBufferDescriptorInfo = makeDescriptorBufferInfo(*uniformBuffer, 0ull, uniformBufferSizeBytes);
2384 const VkBufferMemoryBarrier writeUniformConstantsBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_UNIFORM_READ_BIT, *uniformBuffer, 0ull, uniformBufferSizeBytes);
2386 const VkImageMemoryBarrier imageLayoutBarrier = makeImageMemoryBarrier(
2391 const VkImageMemoryBarrier imageBarrierBetweenShaders = makeImageMemoryBarrier(
2396 const VkBufferMemoryBarrier afterComputeBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *outputBuffer, 0ull, outputBufferSizeBytes);
2398 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, queueFamilyIndex));
2399 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
2408 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &writeUniformConstantsBarrier, 1, &imageLayoutBarrier);
2411 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, 1, &imageBarrierBetweenShaders);
2417 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &afterComputeBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
2427 const Allocation& outputBufferAllocation = outputBuffer.getAllocation();
2430 const int numValues = multiplyComponents(m_imageSize);
2431 const deUint32* bufferPtr = static_cast<deUint32*>(outputBufferAllocation.getHostPtr());
2432 const deUint32 res = *bufferPtr;
2464 const vk::DeviceInterface& getDeviceInterface (void) { return *m_deviceDriver; }
2487 const tcu::CommandLine& cmdLine = m_context.getTestContext().getCommandLine();
2488 const deUint32 devGroupIdx = cmdLine.getVKDeviceGroupId() - 1;
2489 const deUint32 physDeviceIdx = cmdLine.getVKDeviceId() - 1;
2490 const float queuePriority = 1.0f;
2491 const std::vector<std::string> requiredExtensions (1, "VK_KHR_device_group_creation");
2495 std::vector<const char*> deviceExtensions;
2507 const InstanceDriver& instance (m_deviceGroupInstance.getDriver());
2509 const VkPhysicalDeviceFeatures deviceFeatures = getPhysicalDeviceFeatures(instance, deviceGroupInfo.pPhysicalDevices[physDeviceIdx]);
2510 const std::vector<VkQueueFamilyProperties> queueProps = getPhysicalDeviceQueueFamilyProperties(instance, devGroupProperties[devGroupIdx].physicalDevices[physDeviceIdx]);
2539 DE_NULL, // const void* pNext;
2543 &queuePriority // const float* pQueuePriorities;
2567 DE_NULL, // const void* pNext;
2571 m_context.getResourceInterface()->getCacheData() // const void* pInitialData;
2587 const VkDeviceCreateInfo deviceInfo =
2590 pNext, // const void* pNext;
2593 &queueInfo, // const VkDeviceQueueCreateInfo* pQueueCreateInfos;
2595 DE_NULL, // const char* const* ppEnabledLayerNames;
2597 (deviceExtensions.empty() ? DE_NULL : &deviceExtensions[0]), // const char* const* ppEnabledExtensionNames;
2598 deviceFeatures2.pNext == DE_NULL ? &deviceFeatures : DE_NULL, // const VkPhysicalDeviceFeatures* pEnabledFeatures;
2613 const std::string& name,
2614 const deUint32 numValues,
2615 const tcu::IVec3& localsize,
2616 const tcu::IVec3& worksize,
2617 const tcu::IVec3& splitsize,
2618 const vk::ComputePipelineConstructionType computePipelineConstructionType,
2619 const bool useMaintenance5);
2621 virtual void checkSupport (Context& context) const;
2622 void initPrograms (SourceCollections& sourceCollections) const;
2623 TestInstance* createInstance (Context& context) const;
2626 const deUint32 m_numValues;
2627 const tcu::IVec3 m_localSize;
2628 const tcu::IVec3 m_workSize;
2629 const tcu::IVec3 m_splitSize;
2631 const bool m_useMaintenance5;
2638 const deUint32 numValues,
2639 const tcu::IVec3& localsize,
2640 const tcu::IVec3& worksize,
2641 const tcu::IVec3& splitsize,
2642 const vk::ComputePipelineConstructionType computePipelineConstructionType,
2643 const bool useMaintenance5);
2645 bool isInputVectorValid (const tcu::IVec3& small, const tcu::IVec3& big);
2649 const deUint32 m_numValues;
2650 const tcu::IVec3 m_localSize;
2651 const tcu::IVec3 m_workSize;
2652 const tcu::IVec3 m_splitWorkSize;
2653 const bool m_useMaintenance5;
2657 const std::string& name,
2658 const deUint32 numValues,
2659 const tcu::IVec3& localsize,
2660 const tcu::IVec3& worksize,
2661 const tcu::IVec3& splitsize,
2662 const vk::ComputePipelineConstructionType computePipelineConstructionType,
2663 const bool useMaintenance5)
2674 void DispatchBaseTest::checkSupport (Context& context) const
2681 void DispatchBaseTest::initPrograms (SourceCollections& sourceCollections) const
2707 TestInstance* DispatchBaseTest::createInstance (Context& context) const
2713 const deUint32 numValues,
2714 const tcu::IVec3& localsize,
2715 const tcu::IVec3& worksize,
2716 const tcu::IVec3& splitsize,
2717 const vk::ComputePipelineConstructionType computePipelineConstructionType,
2718 const bool useMaintenance5)
2751 bool DispatchBaseTestInstance::isInputVectorValid(const tcu::IVec3& small, const tcu::IVec3& big)
2761 const DeviceInterface& vk = getDeviceInterface();
2762 const VkDevice device = getDevice();
2763 const VkQueue queue = getDeviceQueue(vk, device, m_queueFamilyIndex, 0);
2768 const deUint32 uniformBufSize = 3; // Pass the compute grid size
2769 const VkDeviceSize uniformBufferSizeBytes = sizeof(deUint32) * uniformBufSize;
2770 const BufferWithMemory uniformBuffer(vk, device, allocator, makeBufferCreateInfo(uniformBufferSizeBytes, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT), MemoryRequirement::HostVisible);
2772 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * m_numValues;
2773 const BufferWithMemory buffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
2781 const Allocation& bufferAllocation = uniformBuffer.getAllocation();
2791 const Allocation& bufferAllocation = buffer.getAllocation();
2800 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
2806 const Unique<VkDescriptorPool> descriptorPool(
2812 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
2814 const VkDescriptorBufferInfo bufferDescriptorInfo = makeDescriptorBufferInfo(*buffer, 0ull, bufferSizeBytes);
2815 const VkDescriptorBufferInfo uniformBufferDescriptorInfo = makeDescriptorBufferInfo(*uniformBuffer, 0ull, uniformBufferSizeBytes);
2840 const VkBufferMemoryBarrier hostWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *buffer, 0ull, bufferSizeBytes);
2841 const VkBufferMemoryBarrier hostUniformWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_UNIFORM_READ_BIT, *uniformBuffer, 0ull, uniformBufferSizeBytes);
2843 const VkBufferMemoryBarrier shaderWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *buffer, 0ull, bufferSizeBytes);
2845 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, m_queueFamilyIndex));
2846 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
2854 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &hostUniformWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
2856 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &hostWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
2884 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &shaderWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
2893 const Allocation& bufferAllocation = buffer.getAllocation();
2895 const deUint32* bufferPtr = static_cast<deUint32*>(bufferAllocation.getHostPtr());
2899 const deUint32 res = bufferPtr[ndx];
2900 const deUint32 ref = ~inputData[ndx];
2916 const std::string& name,
2917 const deUint32 numValues,
2918 const tcu::IVec3& localsize,
2919 const tcu::IVec3& splitsize,
2920 const vk::ComputePipelineConstructionType computePipelineConstructionType);
2922 virtual void checkSupport (Context& context) const;
2923 void initPrograms (SourceCollections& sourceCollections) const;
2924 TestInstance* createInstance (Context& context) const;
2927 const deUint32 m_numValues;
2928 const tcu::IVec3 m_localSize;
2929 const tcu::IVec3 m_workSize;
2930 const tcu::IVec3 m_splitSize;
2938 const deUint32 numValues,
2939 const tcu::IVec3& localsize,
2940 const tcu::IVec3& worksize,
2941 const vk::ComputePipelineConstructionType computePipelineConstructionType);
2944 const deUint32 m_numValues;
2945 const tcu::IVec3 m_localSize;
2950 const std::string& name,
2951 const deUint32 numValues,
2952 const tcu::IVec3& localsize,
2953 const tcu::IVec3& worksize,
2954 const vk::ComputePipelineConstructionType computePipelineConstructionType)
2963 void DeviceIndexTest::checkSupport (Context& context) const
2968 void DeviceIndexTest::initPrograms (SourceCollections& sourceCollections) const
2995 TestInstance* DeviceIndexTest::createInstance (Context& context) const
3001 const deUint32 numValues,
3002 const tcu::IVec3& localsize,
3003 const tcu::IVec3& worksize,
3004 const vk::ComputePipelineConstructionType computePipelineConstructionType)
3014 const DeviceInterface& vk = getDeviceInterface();
3015 const VkDevice device = getDevice();
3016 const VkQueue queue = getDeviceQueue(vk, device, m_queueFamilyIndex, 0);
3018 const deUint32 allocDeviceMask = (1 << m_numPhysDevices) - 1;
3024 const deUint32 uniformBufSize = 4 * (1 + VK_MAX_DEVICE_GROUP_SIZE);
3025 const VkDeviceSize uniformBufferSizeBytes = sizeof(deUint32) * uniformBufSize;
3026 const BufferWithMemory uniformBuffer(vk, device, allocator, makeBufferCreateInfo(uniformBufferSizeBytes, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT), MemoryRequirement::HostVisible);
3028 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * m_numValues;
3029 const BufferWithMemory checkBuffer(vk, device, allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_TRANSFER_DST_BIT), MemoryRequirement::HostVisible);
3033 const VkBufferCreateInfo sboBufferParams =
3048 const VkPhysicalDeviceMemoryProperties deviceMemProps = getPhysicalDeviceMemoryProperties(m_context.getInstanceInterface(), getPhysicalDevice());
3058 const VkMemoryAllocateFlagsInfo allocDeviceMaskInfo =
3083 const Allocation& bufferAllocation = uniformBuffer.getAllocation();
3092 const Unique<VkDescriptorSetLayout> descriptorSetLayout(
3098 const Unique<VkDescriptorPool> descriptorPool(
3104 const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
3106 const VkDescriptorBufferInfo bufferDescriptorInfo = makeDescriptorBufferInfo(*sboBuffer, 0ull, bufferSizeBytes);
3107 const VkDescriptorBufferInfo uniformBufferDescriptorInfo = makeDescriptorBufferInfo(*uniformBuffer, 0ull, uniformBufferSizeBytes);
3118 const VkBufferMemoryBarrier hostUniformWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_UNIFORM_READ_BIT, *uniformBuffer, 0ull, uniformBufferSizeBytes);
3119 const VkBufferMemoryBarrier shaderWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT , *sboBuffer, 0ull, bufferSizeBytes);
3121 const Unique<VkCommandPool> cmdPool(makeCommandPool(vk, device, m_queueFamilyIndex));
3122 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
3129 const Allocation& bufferAllocation = uniformBuffer.getAllocation();
3138 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &hostUniformWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
3143 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &shaderWriteBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
3150 const VkBufferMemoryBarrier srcBufferBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT , *sboBuffer, 0ull, bufferSizeBytes);
3151 const VkBufferMemoryBarrier dstBufferBarrier = makeBufferMemoryBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *checkBuffer, 0ull, bufferSizeBytes);
3152 const VkBufferCopy copyParams =
3164 const deUint32 deviceMask = 1 << physDevIdx;
3168 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT , VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &srcBufferBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
3170 vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &dstBufferBarrier, 0, (const VkImageMemoryBarrier*)DE_NULL);
3175 const Allocation& bufferAllocation = checkBuffer.getAllocation();
3177 const deUint32* bufferPtr = static_cast<deUint32*>(bufferAllocation.getHostPtr());
3181 const deUint32 res = bufferPtr[ndx];
3182 const deUint32 ref = constantValPerLoop + uniformInputData[4 * (physDevIdx + 1)];
3201 const std::string& name,
3202 const vk::ComputePipelineConstructionType computePipelineConstructionType);
3205 virtual void checkSupport (Context& context) const;
3206 void initPrograms (SourceCollections& sourceCollections) const;
3207 TestInstance* createInstance (Context& context) const;
3215 ConcurrentComputeInstance (Context& context, const vk::ComputePipelineConstructionType computePipelineConstructionType);
3223 const std::string& name,
3224 const vk::ComputePipelineConstructionType computePipelineConstructionType)
3230 void ConcurrentCompute::checkSupport (Context& context) const
3235 void ConcurrentCompute::initPrograms (SourceCollections& sourceCollections) const
3256 TestInstance* ConcurrentCompute::createInstance (Context& context) const
3261 ConcurrentComputeInstance::ConcurrentComputeInstance (Context& context, const vk::ComputePipelineConstructionType computePipelineConstructionType)
3282 // const DeviceInterface& vk = m_context.getDeviceInterface();
3283 const deUint32 numValues = 1024;
3284 const CustomInstance instance (createCustomInstanceFromContext(m_context));
3285 const InstanceDriver& instanceDriver (instance.getDriver());
3286 const VkPhysicalDevice physicalDevice = chooseDevice(instanceDriver, instance, m_context.getTestContext().getCommandLine());
3293 const float queuePriorities[2] = {1.0f, 0.0f};
3346 std::vector<const char*> deviceExtensions;
3380 DE_NULL, // const void* pNext;
3384 m_context.getResourceInterface()->getCacheData() // const void* pInitialData;
3427 const VkPhysicalDeviceMemoryProperties memoryProperties = vk::getPhysicalDeviceMemoryProperties(instanceDriver, physicalDevice);
3430 const VkDeviceSize bufferSizeBytes = sizeof(deUint32) * numValues;
3431 const BufferWithMemory buffer1(vk, *logicalDevice, *allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
3432 const BufferWithMemory buffer2(vk, *logicalDevice, *allocator, makeBufferCreateInfo(bufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);
3441 const Allocation& bufferAllocation1 = buffer1.getAllocation();
3442 const Allocation& bufferAllocation2 = buffer2.getAllocation();
3460 const Unique<VkDescriptorSetLayout> descriptorSetLayout1(
3465 const Unique<VkDescriptorPool> descriptorPool1(
3470 const Unique<VkDescriptorSet> descriptorSet1(makeDescriptorSet(vk, *logicalDevice, *descriptorPool1, *descriptorSetLayout1));
3472 const VkDescriptorBufferInfo bufferDescriptorInfo1 = makeDescriptorBufferInfo(*buffer1, 0ull, bufferSizeBytes);
3477 const Unique<VkDescriptorSetLayout> descriptorSetLayout2(
3482 const Unique<VkDescriptorPool> descriptorPool2(
3487 const Unique<VkDescriptorSet> descriptorSet2(makeDescriptorSet(vk, *logicalDevice, *descriptorPool2, *descriptorSetLayout2));
3489 const VkDescriptorBufferInfo bufferDescriptorInfo2 = makeDescriptorBufferInfo(*buffer2, 0ull, bufferSizeBytes);
3496 const Unique<VkShaderModule> shaderModule(createShaderModule(vk, *logicalDevice, m_context.getBinaryCollection().get("comp"), 0u));
3501 const VkBufferMemoryBarrier hostWriteBarrier1 = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *buffer1, 0ull, bufferSizeBytes);
3502 const VkBufferMemoryBarrier shaderWriteBarrier1 = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *buffer1, 0ull, bufferSizeBytes);
3503 const Unique<VkCommandPool> cmdPool1(makeCommandPool(vk, *logicalDevice, queues[0].queueFamilyIndex));
3504 const Unique<VkCommandBuffer> cmdBuffer1(allocateCommandBuffer(vk, *logicalDevice, *cmdPool1, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
3509 const VkBufferMemoryBarrier hostWriteBarrier2 = makeBufferMemoryBarrier(VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, *buffer2, 0ull, bufferSizeBytes);
3510 const VkBufferMemoryBarrier shaderWriteBarrier2 = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *buffer2, 0ull, bufferSizeBytes);
3511 const Unique<VkCommandPool> cmdPool2(makeCommandPool(vk, *logicalDevice, queues[1].queueFamilyIndex));
3512 const Unique<VkCommandBuffer> cmdBuffer2(allocateCommandBuffer(vk, *logicalDevice, *cmdPool2, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
3519 vk.cmdPipelineBarrier(*cmdBuffer1, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &hostWriteBarrier1, 0, (const VkImageMemoryBarrier*)DE_NULL);
3521 vk.cmdPipelineBarrier(*cmdBuffer1, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &shaderWriteBarrier1, 0, (const VkImageMemoryBarrier*)DE_NULL);
3529 vk.cmdPipelineBarrier(*cmdBuffer2, VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &hostWriteBarrier2, 0, (const VkImageMemoryBarrier*)DE_NULL);
3531 vk.cmdPipelineBarrier(*cmdBuffer2, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 1, &shaderWriteBarrier2, 0, (const VkImageMemoryBarrier*)DE_NULL);
3540 (const VkPipelineStageFlags*)DE_NULL, // pWaitDstStageMask
3553 (const VkPipelineStageFlags*)DE_NULL, // pWaitDstStageMask
3561 const Unique<VkFence> fence1(createFence(vk, *logicalDevice));
3562 const Unique<VkFence> fence2(createFence(vk, *logicalDevice));
3591 const Allocation& bufferAllocation1 = buffer1.getAllocation();
3593 const deUint32* bufferPtr1 = static_cast<deUint32*>(bufferAllocation1.getHostPtr());
3595 const Allocation& bufferAllocation2 = buffer2.getAllocation();
3597 const deUint32* bufferPtr2 = static_cast<deUint32*>(bufferAllocation2.getHostPtr());
3601 const deUint32 res1 = bufferPtr1[ndx];
3602 const deUint32 res2 = bufferPtr2[ndx];
3603 const deUint32 inp = inputData[ndx];
3604 const deUint32 ref = ~inp;
3623 EmptyWorkGroupCase (tcu::TestContext& testCtx, const std::string& name, const tcu::UVec3& dispatchSize, const vk::ComputePipelineConstructionType computePipelineConstructionType);
3626 virtual void checkSupport (Context& context) const override;
3627 TestInstance* createInstance (Context& context) const override;
3628 void initPrograms (vk::SourceCollections& programCollection) const override;
3631 const tcu::UVec3 m_dispatchSize;
3638 EmptyWorkGroupInstance (Context& context, const tcu::UVec3& dispatchSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
3648 const tcu::UVec3 m_dispatchSize;
3652 EmptyWorkGroupCase::EmptyWorkGroupCase (tcu::TestContext& testCtx, const std::string& name, const tcu::UVec3& dispatchSize, const vk::ComputePipelineConstructionType computePipelineConstructionType)
3660 void EmptyWorkGroupCase::checkSupport (Context& context) const
3665 TestInstance* EmptyWorkGroupCase::createInstance (Context& context) const
3670 void EmptyWorkGroupCase::initPrograms (vk::SourceCollections& programCollection) const
3684 const auto& vkd = m_context.getDeviceInterface();
3685 const auto device = m_context.getDevice();
3687 const auto queueIndex = m_context.getUniversalQueueFamilyIndex();
3688 const auto queue = m_context.getUniversalQueue();
3690 const auto verifBufferSize = static_cast<VkDeviceSize>(sizeof(uint32_t));
3691 const auto verifBufferInfo = makeBufferCreateInfo(verifBufferSize, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT);
3701 const auto descriptorSetLayout = layoutBuilder.build(vkd, device);
3709 const auto descriptorPool = poolBuilder.build(vkd, device, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u);
3710 const auto descriptorSet = makeDescriptorSet(vkd, device, descriptorPool.get(), descriptorSetLayout.get());
3713 const auto verifBufferDescInfo = makeDescriptorBufferInfo(verifBuffer.get(), 0ull, verifBufferSize);
3717 const auto cmdPool = makeCommandPool(vkd, device, queueIndex);
3718 const auto cmdBufferPtr = allocateCommandBuffer(vkd, device, cmdPool.get(), VK_COMMAND_BUFFER_LEVEL_PRIMARY);
3719 const auto cmdBuffer = cmdBufferPtr.get();
3726 const auto readWriteAccess = (VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT);
3727 const auto computeToCompute = makeMemoryBarrier(readWriteAccess, readWriteAccess);
3732 const auto computeToHost = makeMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT);
3763 MaxWorkGroupSizeTest (tcu::TestContext& testCtx, const std::string& name, const Params& params, const vk::ComputePipelineConstructionType computePipelineConstructionType);
3766 virtual void initPrograms (vk::SourceCollections& programCollection) const;
3767 virtual TestInstance* createInstance (Context& context) const;
3768 virtual void checkSupport (Context& context) const;
3774 static deUint32 getInvocations (const Params& params, const vk::InstanceInterface& vki, vk::VkPhysicalDevice physicalDevice, const vk::VkPhysicalDeviceProperties* devProperties = nullptr);
3787 MaxWorkGroupSizeInstance (Context& context, const MaxWorkGroupSizeTest::Params& params, const vk::ComputePipelineConstructionType computePipelineConstructionType);
3799 const int ret = static_cast<int>(axis);
3804 deUint32 MaxWorkGroupSizeTest::getInvocations (const Params& params, const vk::InstanceInterface& vki, vk::VkPhysicalDevice physicalDevice, const vk::VkPhysicalDeviceProperties* devProperties)
3806 const auto axis = getIndex(params.axis);
3818 MaxWorkGroupSizeTest::MaxWorkGroupSizeTest (tcu::TestContext& testCtx, const std::string& name, const Params& params, const vk::ComputePipelineConstructionType computePipelineConstructionType)
3824 void MaxWorkGroupSizeTest::initPrograms (vk::SourceCollections& programCollection) const
3832 << "layout(constant_id=0) const int local_size_x_val = 1;\n"
3833 << "layout(constant_id=1) const int local_size_y_val = 1;\n"
3834 << "layout(constant_id=2) const int local_size_z_val = 1;\n"
3850 TestInstance* MaxWorkGroupSizeTest::createInstance (Context& context) const
3855 void MaxWorkGroupSizeTest::checkSupport (Context& context) const
3857 const auto& vki = context.getInstanceInterface();
3858 const auto physicalDevice = context.getPhysicalDevice();
3860 const auto properties = vk::getPhysicalDeviceProperties(vki, physicalDevice);
3861 const auto invocations = getInvocations(m_params, vki, physicalDevice, &properties);
3872 MaxWorkGroupSizeInstance::MaxWorkGroupSizeInstance (Context& context, const MaxWorkGroupSizeTest::Params& params, const vk::ComputePipelineConstructionType computePipelineConstructionType)
3880 const auto& vki = m_context.getInstanceInterface();
3881 const auto& vkd = m_context.getDeviceInterface();
3882 const auto physicalDevice = m_context.getPhysicalDevice();
3883 const auto device = m_context.getDevice();
3885 const auto queueIndex = m_context.getUniversalQueueFamilyIndex();
3886 const auto queue = m_context.getUniversalQueue();
3889 const auto axis = MaxWorkGroupSizeTest::getIndex(m_params.axis);
3890 const auto invocations = MaxWorkGroupSizeTest::getInvocations(m_params, vki, physicalDevice);
3891 const auto ssboSize = static_cast<vk::VkDeviceSize>(MaxWorkGroupSizeTest::getSSBOSize(invocations));
3900 const auto ssboInfo = vk::makeBufferCreateInfo(ssboSize, vk::VK_BUFFER_USAGE_STORAGE_BUFFER_BIT);
3906 const auto descriptorSetLayout = layoutBuilder.build(vkd, device);
3909 const auto entrySize = static_cast<deUintptr>(sizeof(deInt32));
3913 const vk::VkSpecializationMapEntry specializationMaps[3] =
3932 const vk::VkSpecializationInfo specializationInfo =
3935 specializationMaps, // const VkSpecializationMapEntry* pMapEntries;
3937 specializationData, // const void* pData;
3948 const auto descriptorPool = poolBuilder.build(vkd, device, vk::VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u);
3949 const auto descriptorSet = vk::makeDescriptorSet(vkd, device, descriptorPool.get(), descriptorSetLayout.get());
3952 const vk::VkDescriptorBufferInfo ssboBufferInfo =
3970 const auto cmdPool = vk::makeCommandPool(vkd, device, queueIndex);
3971 const auto cmdBUfferPtr = vk::allocateCommandBuffer(vkd, device, cmdPool.get(), vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY);
3972 const auto cmdBuffer = cmdBUfferPtr.get();
3977 const auto hostToComputeBarrier = vk::makeBufferMemoryBarrier(vk::VK_ACCESS_HOST_WRITE_BIT, vk::VK_ACCESS_SHADER_WRITE_BIT, ssbo.get(), 0ull, VK_WHOLE_SIZE);
3984 const auto computeToHostBarrier = vk::makeBufferMemoryBarrier(vk::VK_ACCESS_SHADER_WRITE_BIT, vk::VK_ACCESS_HOST_READ_BIT, ssbo.get(), 0ull, VK_WHOLE_SIZE);
4033 const DeviceInterface& vk = context.getDeviceInterface();
4034 const VkDevice device = context.getDevice();
4035 const VkQueue queue = context.getUniversalQueue();
4036 const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
4041 const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
4042 const Unique<VkCommandBuffer> cmdBuffer (allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
4050 const tcu::IVec3 workGroups(1, 1, 1);
4072 for (const auto &queueFamily: queueFamilies)
4094 const auto& instanceDriver = context.getInstanceInterface();
4095 const auto physicalDevice = context.getPhysicalDevice();
4096 const auto queueFamilies = getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
4101 const float queuePriority = 1.0f;
4102 const VkDeviceQueueCreateInfo deviceQueueCreateInfos = {
4104 nullptr, // const void* pNext;
4108 &queuePriority, // const float* pQueuePriorities;
4126 nullptr, // const void* pNext;
4130 context.getResourceInterface()->getCacheData() // const void* pInitialData;
4143 const VkDeviceCreateInfo deviceCreateInfo =
4146 pNext, // const void* pNext;
4149 &deviceQueueCreateInfos, // const VkDeviceQueueCreateInfo* pQueueCreateInfos;
4151 nullptr, // const char* const* ppEnabledLayerNames;
4153 nullptr, // const char* const* ppEnabledExtensionNames;
4154 nullptr, // const VkPhysicalDeviceFeatures* pEnabledFeatures;
4165 SecondaryCommandBufferComputeOnlyTest(tcu::TestContext& context, const std::string& name)
4169 void initPrograms (SourceCollections& programCollection) const override;
4170 TestInstance* createInstance (Context& context) const override;
4171 void checkSupport (Context& context) const override;
4181 void SecondaryCommandBufferComputeOnlyTest::initPrograms(SourceCollections& collection) const {
4199 TestInstance* SecondaryCommandBufferComputeOnlyTest::createInstance(Context& context) const {
4203 void SecondaryCommandBufferComputeOnlyTest::checkSupport(Context& context) const {
4211 const InstanceInterface& vki = m_context.getInstanceInterface();
4229 const DeviceInterface& vkdi = *deviceDriver;
4234 const auto bufferSize = static_cast<VkDeviceSize>(sizeof(uint32_t));
4247 const auto descriptorPool = poolBuilder.build(vkdi, device, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1);
4248 const auto descriptorSetBuffer = makeDescriptorSet(vkdi, device, descriptorPool.get(), descriptorSetLayout.get());
4253 const auto bufferInfo = makeDescriptorBufferInfo(buffer.get(), 0ull, bufferSize);
4260 const Unique<VkPipelineLayout> pipelineLayout(makePipelineLayout(vkdi, device, *descriptorSetLayout));
4261 const Unique<VkPipeline> computePipeline(makeComputePipeline(vkdi, device, *pipelineLayout, *shader));
4264 const Unique<VkCommandPool> cmdPool(makeCommandPool(vkdi, device, queueFamilyIndex));
4265 const Unique<VkCommandBuffer> cmdBuffer(allocateCommandBuffer(vkdi, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
4266 const Unique<VkCommandBuffer> cmdBuffer2(allocateCommandBuffer(vkdi, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_SECONDARY));
4268 const VkCommandBufferInheritanceInfo bufferInheritanceInfo
4271 nullptr, // const void* pNext;
4281 const VkCommandBufferBeginInfo commandBufBeginParams
4284 nullptr, // const void* pNext;
4296 const VkBufferMemoryBarrier renderBufferBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, buffer.get(), 0ull, bufferSize);
4319 const std::string& name,