1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2016 The Khronos Group Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Buffer and image memory requirements tests.
22 *//*--------------------------------------------------------------------*/
24 #include "vktMemoryRequirementsTests.hpp"
25 #include "vktTestCaseUtil.hpp"
26 #include "vktTestGroupUtil.hpp"
30 #include "vkRefUtil.hpp"
31 #include "vkMemUtil.hpp"
32 #include "vkQueryUtil.hpp"
33 #include "vkStrUtil.hpp"
34 #include "vkTypeUtil.hpp"
36 #include "deUniquePtr.hpp"
37 #include "deStringUtil.hpp"
38 #include "deSTLUtil.hpp"
40 #include "tcuResultCollector.hpp"
41 #include "tcuTestLog.hpp"
52 Move<VkBuffer> makeBuffer (const DeviceInterface& vk, const VkDevice device, const VkDeviceSize size, const VkBufferCreateFlags flags, const VkBufferUsageFlags usage)
54 const VkBufferCreateInfo createInfo =
56 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType;
57 DE_NULL, // const void* pNext;
58 flags, // VkBufferCreateFlags flags;
59 size, // VkDeviceSize size;
60 usage, // VkBufferUsageFlags usage;
61 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
62 0u, // uint32_t queueFamilyIndexCount;
63 DE_NULL, // const uint32_t* pQueueFamilyIndices;
65 return createBuffer(vk, device, &createInfo);
68 VkMemoryRequirements getBufferMemoryRequirements (const DeviceInterface& vk, const VkDevice device, const VkDeviceSize size, const VkBufferCreateFlags flags, const VkBufferUsageFlags usage)
70 const Unique<VkBuffer> buffer(makeBuffer(vk, device, size, flags, usage));
71 return getBufferMemoryRequirements(vk, device, *buffer);
74 VkMemoryRequirements getBufferMemoryRequirements2 (const DeviceInterface& vk, const VkDevice device, const VkDeviceSize size, const VkBufferCreateFlags flags, const VkBufferUsageFlags usage, void* next = DE_NULL)
76 const Unique<VkBuffer> buffer (makeBuffer(vk, device, size, flags, usage));
77 VkBufferMemoryRequirementsInfo2KHR info =
79 VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR, // VkStructureType sType
80 DE_NULL, // const void* pNext
81 *buffer // VkBuffer buffer
83 VkMemoryRequirements2KHR req2 =
85 VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR, // VkStructureType sType
87 {0, 0, 0} // VkMemoryRequirements memoryRequirements
90 vk.getBufferMemoryRequirements2KHR(device, &info, &req2);
92 return req2.memoryRequirements;
95 VkMemoryRequirements getImageMemoryRequirements2 (const DeviceInterface& vk, const VkDevice device, const VkImageCreateInfo& createInfo, void* next = DE_NULL)
97 const Unique<VkImage> image(createImage(vk, device, &createInfo));
99 VkImageMemoryRequirementsInfo2KHR info =
101 VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR, // VkStructureType sType
102 DE_NULL, // const void* pNext
103 *image // VkImage image
105 VkMemoryRequirements2KHR req2 =
107 VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR, // VkStructureType sType
109 {0, 0, 0} // VkMemoryRequirements memoryRequirements
112 vk.getImageMemoryRequirements2KHR(device, &info, &req2);
114 return req2.memoryRequirements;
117 //! Get an index of each set bit, starting from the least significant bit.
118 std::vector<deUint32> bitsToIndices (deUint32 bits)
120 std::vector<deUint32> indices;
121 for (deUint32 i = 0u; bits != 0u; ++i, bits >>= 1)
124 indices.push_back(i);
132 return static_cast<T>(static_cast<deUint32>(value) + 1);
139 return static_cast<T>(static_cast<deUint32>(value) << 1);
141 return static_cast<T>(1);
145 T nextFlagExcluding (T value, T excludedFlags)
147 deUint32 tmp = static_cast<deUint32>(value);
148 while ((tmp = nextFlag(tmp)) & static_cast<deUint32>(excludedFlags));
149 return static_cast<T>(tmp);
152 class IBufferMemoryRequirements
155 virtual void populateTestGroup (tcu::TestCaseGroup* group) = 0;
158 virtual void addFunctionTestCase (tcu::TestCaseGroup* group,
159 const std::string& name,
160 const std::string& desc,
161 VkBufferCreateFlags arg0) = 0;
163 virtual tcu::TestStatus execTest (Context& context,
164 const VkBufferCreateFlags bufferFlags) = 0;
166 virtual void preTestChecks (Context& context,
167 const InstanceInterface& vki,
168 const VkPhysicalDevice physDevice,
169 const VkBufferCreateFlags flags) = 0;
171 virtual void updateMemoryRequirements (const DeviceInterface& vk,
172 const VkDevice device,
173 const VkDeviceSize size,
174 const VkBufferCreateFlags flags,
175 const VkBufferUsageFlags usage,
178 virtual void verifyMemoryRequirements (tcu::ResultCollector& result,
179 const VkPhysicalDeviceMemoryProperties& deviceMemoryProperties,
180 const VkPhysicalDeviceLimits& limits,
181 const VkBufferCreateFlags bufferFlags,
182 const VkBufferUsageFlags usage) = 0;
185 class BufferMemoryRequirementsOriginal : public IBufferMemoryRequirements
187 static tcu::TestStatus testEntryPoint (Context& context,
188 const VkBufferCreateFlags bufferFlags);
191 virtual void populateTestGroup (tcu::TestCaseGroup* group);
194 virtual void addFunctionTestCase (tcu::TestCaseGroup* group,
195 const std::string& name,
196 const std::string& desc,
197 VkBufferCreateFlags arg0);
199 virtual tcu::TestStatus execTest (Context& context,
200 const VkBufferCreateFlags bufferFlags);
202 virtual void preTestChecks (Context& context,
203 const InstanceInterface& vki,
204 const VkPhysicalDevice physDevice,
205 const VkBufferCreateFlags flags);
207 virtual void updateMemoryRequirements (const DeviceInterface& vk,
208 const VkDevice device,
209 const VkDeviceSize size,
210 const VkBufferCreateFlags flags,
211 const VkBufferUsageFlags usage,
214 virtual void verifyMemoryRequirements (tcu::ResultCollector& result,
215 const VkPhysicalDeviceMemoryProperties& deviceMemoryProperties,
216 const VkPhysicalDeviceLimits& limits,
217 const VkBufferCreateFlags bufferFlags,
218 const VkBufferUsageFlags usage);
221 VkMemoryRequirements m_allUsageFlagsRequirements;
222 VkMemoryRequirements m_currentTestRequirements;
226 tcu::TestStatus BufferMemoryRequirementsOriginal::testEntryPoint (Context& context, const VkBufferCreateFlags bufferFlags)
228 BufferMemoryRequirementsOriginal test;
230 return test.execTest(context, bufferFlags);
233 void BufferMemoryRequirementsOriginal::populateTestGroup (tcu::TestCaseGroup* group)
237 VkBufferCreateFlags flags;
238 const char* const name;
241 { (VkBufferCreateFlags)0, "regular" },
242 { VK_BUFFER_CREATE_SPARSE_BINDING_BIT, "sparse" },
243 { VK_BUFFER_CREATE_SPARSE_BINDING_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT, "sparse_residency" },
244 { VK_BUFFER_CREATE_SPARSE_BINDING_BIT | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, "sparse_aliased" },
245 { VK_BUFFER_CREATE_SPARSE_BINDING_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, "sparse_residency_aliased" },
248 de::MovePtr<tcu::TestCaseGroup> bufferGroup(new tcu::TestCaseGroup(group->getTestContext(), "buffer", ""));
250 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(bufferCases); ++ndx)
251 addFunctionTestCase(bufferGroup.get(), bufferCases[ndx].name, "", bufferCases[ndx].flags);
253 group->addChild(bufferGroup.release());
256 void BufferMemoryRequirementsOriginal::addFunctionTestCase (tcu::TestCaseGroup* group,
257 const std::string& name,
258 const std::string& desc,
259 VkBufferCreateFlags arg0)
261 addFunctionCase(group, name, desc, testEntryPoint, arg0);
264 tcu::TestStatus BufferMemoryRequirementsOriginal::execTest (Context& context, const VkBufferCreateFlags bufferFlags)
266 const DeviceInterface& vk = context.getDeviceInterface();
267 const InstanceInterface& vki = context.getInstanceInterface();
268 const VkDevice device = context.getDevice();
269 const VkPhysicalDevice physDevice = context.getPhysicalDevice();
271 preTestChecks(context, vki, physDevice, bufferFlags);
273 const VkPhysicalDeviceMemoryProperties memoryProperties = getPhysicalDeviceMemoryProperties(vki, physDevice);
274 const VkPhysicalDeviceLimits limits = getPhysicalDeviceProperties(vki, physDevice).limits;
275 const VkBufferUsageFlags allUsageFlags = static_cast<VkBufferUsageFlags>((VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT << 1) - 1);
276 tcu::TestLog& log = context.getTestContext().getLog();
279 const VkDeviceSize sizeCases[] =
287 // Updates m_allUsageFlags* fields
288 updateMemoryRequirements(vk, device, 1024, bufferFlags, allUsageFlags, true); // doesn't depend on size
290 for (VkBufferUsageFlags usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; usage <= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT; usage = nextFlag(usage))
292 deUint32 previousMemoryTypeBits = 0u;
293 VkDeviceSize previousAlignment = 0u;
295 log << tcu::TestLog::Message << "Verify a buffer with usage flags: " << de::toString(getBufferUsageFlagsStr(usage)) << tcu::TestLog::EndMessage;
297 for (const VkDeviceSize* pSize = sizeCases; pSize < sizeCases + DE_LENGTH_OF_ARRAY(sizeCases); ++pSize)
299 log << tcu::TestLog::Message << "- size " << *pSize << " bytes" << tcu::TestLog::EndMessage;
301 tcu::ResultCollector result(log, "ERROR: ");
303 // Updates m_allUsageFlags* fields
304 updateMemoryRequirements(vk, device, *pSize, bufferFlags, usage, false);
307 // - requirements for a particular buffer usage
308 // - memoryTypeBits are a subset of bits for requirements with all usage flags combined
309 verifyMemoryRequirements(result, memoryProperties, limits, bufferFlags, usage);
311 // Check that for the same usage and create flags:
312 // - memoryTypeBits are the same
313 // - alignment is the same
314 if (pSize > sizeCases)
316 result.check(m_currentTestRequirements.memoryTypeBits == previousMemoryTypeBits,
317 "memoryTypeBits differ from the ones in the previous buffer size");
319 result.check(m_currentTestRequirements.alignment == previousAlignment,
320 "alignment differs from the one in the previous buffer size");
323 if (result.getResult() != QP_TEST_RESULT_PASS)
326 previousMemoryTypeBits = m_currentTestRequirements.memoryTypeBits;
327 previousAlignment = m_currentTestRequirements.alignment;
334 return allPass ? tcu::TestStatus::pass("Pass") : tcu::TestStatus::fail("Some memory requirements were incorrect");
337 void BufferMemoryRequirementsOriginal::preTestChecks (Context& ,
338 const InstanceInterface& vki,
339 const VkPhysicalDevice physDevice,
340 const VkBufferCreateFlags flags)
342 const VkPhysicalDeviceFeatures features = getPhysicalDeviceFeatures(vki, physDevice);
344 if ((flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) && !features.sparseBinding)
345 TCU_THROW(NotSupportedError, "Feature not supported: sparseBinding");
347 if ((flags & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) && !features.sparseResidencyBuffer)
348 TCU_THROW(NotSupportedError, "Feature not supported: sparseResidencyBuffer");
350 if ((flags & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT) && !features.sparseResidencyAliased)
351 TCU_THROW(NotSupportedError, "Feature not supported: sparseResidencyAliased");
354 void BufferMemoryRequirementsOriginal::updateMemoryRequirements (const DeviceInterface& vk,
355 const VkDevice device,
356 const VkDeviceSize size,
357 const VkBufferCreateFlags flags,
358 const VkBufferUsageFlags usage,
363 m_allUsageFlagsRequirements = getBufferMemoryRequirements(vk, device, size, flags, usage);
367 m_currentTestRequirements = getBufferMemoryRequirements(vk, device, size, flags, usage);
371 void BufferMemoryRequirementsOriginal::verifyMemoryRequirements (tcu::ResultCollector& result,
372 const VkPhysicalDeviceMemoryProperties& deviceMemoryProperties,
373 const VkPhysicalDeviceLimits& limits,
374 const VkBufferCreateFlags bufferFlags,
375 const VkBufferUsageFlags usage)
377 if (result.check(m_currentTestRequirements.memoryTypeBits != 0, "VkMemoryRequirements memoryTypeBits has no bits set"))
379 typedef std::vector<deUint32>::const_iterator IndexIterator;
380 const std::vector<deUint32> usedMemoryTypeIndices = bitsToIndices(m_currentTestRequirements.memoryTypeBits);
381 bool deviceLocalMemoryFound = false;
382 bool hostVisibleCoherentMemoryFound = false;
384 for (IndexIterator memoryTypeNdx = usedMemoryTypeIndices.begin(); memoryTypeNdx != usedMemoryTypeIndices.end(); ++memoryTypeNdx)
386 if (*memoryTypeNdx >= deviceMemoryProperties.memoryTypeCount)
388 result.fail("VkMemoryRequirements memoryTypeBits contains bits for non-existing memory types");
392 const VkMemoryPropertyFlags memoryPropertyFlags = deviceMemoryProperties.memoryTypes[*memoryTypeNdx].propertyFlags;
394 if (memoryPropertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
395 deviceLocalMemoryFound = true;
397 if (memoryPropertyFlags & (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT))
398 hostVisibleCoherentMemoryFound = true;
400 result.check((memoryPropertyFlags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT) == 0u,
401 "Memory type includes VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT");
404 result.check(deIsPowerOfTwo64(static_cast<deUint64>(m_currentTestRequirements.alignment)) == DE_TRUE,
405 "VkMemoryRequirements alignment isn't power of two");
407 if (usage & (VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT))
409 result.check(m_currentTestRequirements.alignment >= limits.minTexelBufferOffsetAlignment,
410 "VkMemoryRequirements alignment doesn't respect minTexelBufferOffsetAlignment");
413 if (usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT)
415 result.check(m_currentTestRequirements.alignment >= limits.minUniformBufferOffsetAlignment,
416 "VkMemoryRequirements alignment doesn't respect minUniformBufferOffsetAlignment");
419 if (usage & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)
421 result.check(m_currentTestRequirements.alignment >= limits.minStorageBufferOffsetAlignment,
422 "VkMemoryRequirements alignment doesn't respect minStorageBufferOffsetAlignment");
425 result.check(deviceLocalMemoryFound,
426 "None of the required memory types included VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT");
428 result.check((bufferFlags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) || hostVisibleCoherentMemoryFound,
429 "Required memory type doesn't include VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT and VK_MEMORY_PROPERTY_HOST_COHERENT_BIT");
431 result.check((m_currentTestRequirements.memoryTypeBits & m_allUsageFlagsRequirements.memoryTypeBits) == m_allUsageFlagsRequirements.memoryTypeBits,
432 "Memory type bits aren't a superset of memory type bits for all usage flags combined");
436 class BufferMemoryRequirementsExtended : public BufferMemoryRequirementsOriginal
438 static tcu::TestStatus testEntryPoint (Context& context,
439 const VkBufferCreateFlags bufferFlags);
442 virtual void addFunctionTestCase (tcu::TestCaseGroup* group,
443 const std::string& name,
444 const std::string& desc,
445 VkBufferCreateFlags arg0);
447 virtual void preTestChecks (Context& context,
448 const InstanceInterface& vki,
449 const VkPhysicalDevice physDevice,
450 const VkBufferCreateFlags flags);
452 virtual void updateMemoryRequirements (const DeviceInterface& vk,
453 const VkDevice device,
454 const VkDeviceSize size,
455 const VkBufferCreateFlags flags,
456 const VkBufferUsageFlags usage,
460 tcu::TestStatus BufferMemoryRequirementsExtended::testEntryPoint (Context& context, const VkBufferCreateFlags bufferFlags)
462 BufferMemoryRequirementsExtended test;
464 return test.execTest(context, bufferFlags);
467 void BufferMemoryRequirementsExtended::addFunctionTestCase (tcu::TestCaseGroup* group,
468 const std::string& name,
469 const std::string& desc,
470 VkBufferCreateFlags arg0)
472 addFunctionCase(group, name, desc, testEntryPoint, arg0);
475 void BufferMemoryRequirementsExtended::preTestChecks (Context& context,
476 const InstanceInterface& vki,
477 const VkPhysicalDevice physDevice,
478 const VkBufferCreateFlags flags)
480 const std::string extensionName("VK_KHR_get_memory_requirements2");
482 if (!de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), extensionName))
483 TCU_THROW(NotSupportedError, std::string(extensionName + " is not supported").c_str());
485 BufferMemoryRequirementsOriginal::preTestChecks(context, vki, physDevice, flags);
488 void BufferMemoryRequirementsExtended::updateMemoryRequirements (const DeviceInterface& vk,
489 const VkDevice device,
490 const VkDeviceSize size,
491 const VkBufferCreateFlags flags,
492 const VkBufferUsageFlags usage,
497 m_allUsageFlagsRequirements = getBufferMemoryRequirements2(vk, device, size, flags, usage);
501 m_currentTestRequirements = getBufferMemoryRequirements2(vk, device, size, flags, usage);
507 struct ImageTestParams
509 VkImageCreateFlags flags;
510 VkImageTiling tiling;
514 class IImageMemoryRequirements
517 virtual void populateTestGroup (tcu::TestCaseGroup* group) = 0;
520 virtual void addFunctionTestCase (tcu::TestCaseGroup* group,
521 const std::string& name,
522 const std::string& desc,
523 const ImageTestParams arg0) = 0;
525 virtual tcu::TestStatus execTest (Context& context,
526 const ImageTestParams bufferFlags) = 0;
528 virtual void preTestChecks (Context& context,
529 const InstanceInterface& vki,
530 const VkPhysicalDevice physDevice,
531 const VkImageCreateFlags flags) = 0;
533 virtual void updateMemoryRequirements (const DeviceInterface& vk,
534 const VkDevice device) = 0;
536 virtual void verifyMemoryRequirements (tcu::ResultCollector& result,
537 const VkPhysicalDeviceMemoryProperties& deviceMemoryProperties) = 0;
540 class ImageMemoryRequirementsOriginal : public IImageMemoryRequirements
542 static tcu::TestStatus testEntryPoint (Context& context,
543 const ImageTestParams params);
546 virtual void populateTestGroup (tcu::TestCaseGroup* group);
549 virtual void addFunctionTestCase (tcu::TestCaseGroup* group,
550 const std::string& name,
551 const std::string& desc,
552 const ImageTestParams arg0);
554 virtual tcu::TestStatus execTest (Context& context,
555 const ImageTestParams params);
557 virtual void preTestChecks (Context& context,
558 const InstanceInterface& vki,
559 const VkPhysicalDevice physDevice,
560 const VkImageCreateFlags flags);
562 virtual void updateMemoryRequirements (const DeviceInterface& vk,
563 const VkDevice device);
565 virtual void verifyMemoryRequirements (tcu::ResultCollector& result,
566 const VkPhysicalDeviceMemoryProperties& deviceMemoryProperties);
569 virtual bool isUsageMatchesFeatures (const VkImageUsageFlags usage,
570 const VkFormatFeatureFlags featureFlags);
572 virtual bool isImageSupported (const InstanceInterface& vki,
573 const VkPhysicalDevice physDevice,
574 const VkImageCreateInfo& info);
576 virtual VkExtent3D makeExtentForImage (const VkImageType imageType);
578 virtual bool isFormatMatchingAspect (const VkFormat format,
579 const VkImageAspectFlags aspect);
582 virtual std::string getImageInfoString (const VkImageCreateInfo& imageInfo);
585 VkImageCreateInfo m_currentTestImageInfo;
586 VkMemoryRequirements m_currentTestRequirements;
590 tcu::TestStatus ImageMemoryRequirementsOriginal::testEntryPoint (Context& context, const ImageTestParams params)
592 ImageMemoryRequirementsOriginal test;
594 return test.execTest(context, params);
597 void ImageMemoryRequirementsOriginal::populateTestGroup (tcu::TestCaseGroup* group)
601 VkImageCreateFlags flags;
603 const char* const name;
604 } imageFlagsCases[] =
606 { (VkImageCreateFlags)0, false, "regular" },
607 { (VkImageCreateFlags)0, true, "transient" },
608 { VK_IMAGE_CREATE_SPARSE_BINDING_BIT, false, "sparse" },
609 { VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT, false, "sparse_residency" },
610 { VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, false, "sparse_aliased" },
611 { VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, false, "sparse_residency_aliased" },
614 de::MovePtr<tcu::TestCaseGroup> imageGroup(new tcu::TestCaseGroup(group->getTestContext(), "image", ""));
616 for (int flagsNdx = 0; flagsNdx < DE_LENGTH_OF_ARRAY(imageFlagsCases); ++flagsNdx)
617 for (int tilingNdx = 0; tilingNdx <= 1; ++tilingNdx)
619 ImageTestParams params;
620 std::ostringstream caseName;
622 params.flags = imageFlagsCases[flagsNdx].flags;
623 params.transient = imageFlagsCases[flagsNdx].transient;
624 caseName << imageFlagsCases[flagsNdx].name;
628 params.tiling = VK_IMAGE_TILING_OPTIMAL;
629 caseName << "_tiling_optimal";
633 params.tiling = VK_IMAGE_TILING_LINEAR;
634 caseName << "_tiling_linear";
637 if ((params.flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) && (params.tiling == VK_IMAGE_TILING_LINEAR))
640 addFunctionTestCase(imageGroup.get(), caseName.str(), "", params);
643 group->addChild(imageGroup.release());
646 void ImageMemoryRequirementsOriginal::addFunctionTestCase (tcu::TestCaseGroup* group,
647 const std::string& name,
648 const std::string& desc,
649 const ImageTestParams arg0)
651 addFunctionCase(group, name, desc, testEntryPoint, arg0);
654 void ImageMemoryRequirementsOriginal::preTestChecks (Context& ,
655 const InstanceInterface& vki,
656 const VkPhysicalDevice physDevice,
657 const VkImageCreateFlags createFlags)
659 const VkPhysicalDeviceFeatures features = getPhysicalDeviceFeatures(vki, physDevice);
661 if ((createFlags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) && !features.sparseBinding)
662 TCU_THROW(NotSupportedError, "Feature not supported: sparseBinding");
664 if ((createFlags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) && !(features.sparseResidencyImage2D || features.sparseResidencyImage3D))
665 TCU_THROW(NotSupportedError, "Feature not supported: sparseResidencyImage (2D and 3D)");
667 if ((createFlags & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) && !features.sparseResidencyAliased)
668 TCU_THROW(NotSupportedError, "Feature not supported: sparseResidencyAliased");
671 void ImageMemoryRequirementsOriginal::updateMemoryRequirements (const DeviceInterface& vk,
672 const VkDevice device)
674 const Unique<VkImage> image(createImage(vk, device, &m_currentTestImageInfo));
676 m_currentTestRequirements = getImageMemoryRequirements(vk, device, *image);
679 void ImageMemoryRequirementsOriginal::verifyMemoryRequirements (tcu::ResultCollector& result,
680 const VkPhysicalDeviceMemoryProperties& deviceMemoryProperties)
682 if (result.check(m_currentTestRequirements.memoryTypeBits != 0, "VkMemoryRequirements memoryTypeBits has no bits set"))
684 typedef std::vector<deUint32>::const_iterator IndexIterator;
685 const std::vector<deUint32> usedMemoryTypeIndices = bitsToIndices(m_currentTestRequirements.memoryTypeBits);
686 bool deviceLocalMemoryFound = false;
687 bool hostVisibleCoherentMemoryFound = false;
689 for (IndexIterator memoryTypeNdx = usedMemoryTypeIndices.begin(); memoryTypeNdx != usedMemoryTypeIndices.end(); ++memoryTypeNdx)
691 if (*memoryTypeNdx >= deviceMemoryProperties.memoryTypeCount)
693 result.fail("VkMemoryRequirements memoryTypeBits contains bits for non-existing memory types");
697 const VkMemoryPropertyFlags memoryPropertyFlags = deviceMemoryProperties.memoryTypes[*memoryTypeNdx].propertyFlags;
699 if (memoryPropertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
700 deviceLocalMemoryFound = true;
702 if (memoryPropertyFlags & (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT))
703 hostVisibleCoherentMemoryFound = true;
705 if (memoryPropertyFlags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT)
707 result.check((m_currentTestImageInfo.usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0u,
708 "Memory type includes VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT for a non-transient attachment image");
712 result.check(deIsPowerOfTwo64(static_cast<deUint64>(m_currentTestRequirements.alignment)) == DE_TRUE,
713 "VkMemoryRequirements alignment isn't power of two");
715 result.check(deviceLocalMemoryFound,
716 "None of the required memory types included VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT");
718 result.check(m_currentTestImageInfo.tiling == VK_IMAGE_TILING_OPTIMAL || hostVisibleCoherentMemoryFound,
719 "Required memory type doesn't include VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT and VK_MEMORY_PROPERTY_HOST_COHERENT_BIT");
723 bool ImageMemoryRequirementsOriginal::isUsageMatchesFeatures (const VkImageUsageFlags usage, const VkFormatFeatureFlags featureFlags)
725 if ((usage & VK_IMAGE_USAGE_SAMPLED_BIT) && (featureFlags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
727 if ((usage & VK_IMAGE_USAGE_STORAGE_BIT) && (featureFlags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT))
729 if ((usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) && (featureFlags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT))
731 if ((usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) && (featureFlags & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
737 //! This catches both invalid as well as legal but unsupported combinations of image parameters
738 bool ImageMemoryRequirementsOriginal::isImageSupported (const InstanceInterface& vki, const VkPhysicalDevice physDevice, const VkImageCreateInfo& info)
740 DE_ASSERT(info.extent.width >= 1u && info.extent.height >= 1u && info.extent.depth >= 1u);
742 if (info.imageType == VK_IMAGE_TYPE_1D)
744 DE_ASSERT(info.extent.height == 1u && info.extent.depth == 1u);
746 else if (info.imageType == VK_IMAGE_TYPE_2D)
748 DE_ASSERT(info.extent.depth == 1u);
750 if (info.flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)
752 DE_ASSERT(info.extent.width == info.extent.height);
753 DE_ASSERT(info.arrayLayers >= 6u && (info.arrayLayers % 6u) == 0u);
757 if ((info.flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) && info.imageType != VK_IMAGE_TYPE_2D)
760 if ((info.samples != VK_SAMPLE_COUNT_1_BIT) &&
761 (info.imageType != VK_IMAGE_TYPE_2D || (info.flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) || info.tiling != VK_IMAGE_TILING_OPTIMAL || info.mipLevels > 1u))
764 if ((info.usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) &&
765 (info.usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) == 0u)
768 const VkPhysicalDeviceFeatures features = getPhysicalDeviceFeatures(vki, physDevice);
770 if (info.flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)
772 DE_ASSERT(info.tiling == VK_IMAGE_TILING_OPTIMAL);
774 if (info.imageType == VK_IMAGE_TYPE_2D && !features.sparseResidencyImage2D)
776 if (info.imageType == VK_IMAGE_TYPE_3D && !features.sparseResidencyImage3D)
778 if (info.samples == VK_SAMPLE_COUNT_2_BIT && !features.sparseResidency2Samples)
780 if (info.samples == VK_SAMPLE_COUNT_4_BIT && !features.sparseResidency4Samples)
782 if (info.samples == VK_SAMPLE_COUNT_8_BIT && !features.sparseResidency8Samples)
784 if (info.samples == VK_SAMPLE_COUNT_16_BIT && !features.sparseResidency16Samples)
786 if (info.samples == VK_SAMPLE_COUNT_32_BIT || info.samples == VK_SAMPLE_COUNT_64_BIT)
790 if (info.samples != VK_SAMPLE_COUNT_1_BIT && (info.usage & VK_IMAGE_USAGE_STORAGE_BIT) && !features.shaderStorageImageMultisample)
795 case VK_FORMAT_BC1_RGB_UNORM_BLOCK:
796 case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
797 case VK_FORMAT_BC1_RGBA_UNORM_BLOCK:
798 case VK_FORMAT_BC1_RGBA_SRGB_BLOCK:
799 case VK_FORMAT_BC2_UNORM_BLOCK:
800 case VK_FORMAT_BC2_SRGB_BLOCK:
801 case VK_FORMAT_BC3_UNORM_BLOCK:
802 case VK_FORMAT_BC3_SRGB_BLOCK:
803 case VK_FORMAT_BC4_UNORM_BLOCK:
804 case VK_FORMAT_BC4_SNORM_BLOCK:
805 case VK_FORMAT_BC5_UNORM_BLOCK:
806 case VK_FORMAT_BC5_SNORM_BLOCK:
807 case VK_FORMAT_BC6H_UFLOAT_BLOCK:
808 case VK_FORMAT_BC6H_SFLOAT_BLOCK:
809 case VK_FORMAT_BC7_UNORM_BLOCK:
810 case VK_FORMAT_BC7_SRGB_BLOCK:
811 if (!features.textureCompressionBC)
815 case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
816 case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
817 case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
818 case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
819 case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
820 case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
821 case VK_FORMAT_EAC_R11_UNORM_BLOCK:
822 case VK_FORMAT_EAC_R11_SNORM_BLOCK:
823 case VK_FORMAT_EAC_R11G11_UNORM_BLOCK:
824 case VK_FORMAT_EAC_R11G11_SNORM_BLOCK:
825 if (!features.textureCompressionETC2)
829 case VK_FORMAT_ASTC_4x4_UNORM_BLOCK:
830 case VK_FORMAT_ASTC_4x4_SRGB_BLOCK:
831 case VK_FORMAT_ASTC_5x4_UNORM_BLOCK:
832 case VK_FORMAT_ASTC_5x4_SRGB_BLOCK:
833 case VK_FORMAT_ASTC_5x5_UNORM_BLOCK:
834 case VK_FORMAT_ASTC_5x5_SRGB_BLOCK:
835 case VK_FORMAT_ASTC_6x5_UNORM_BLOCK:
836 case VK_FORMAT_ASTC_6x5_SRGB_BLOCK:
837 case VK_FORMAT_ASTC_6x6_UNORM_BLOCK:
838 case VK_FORMAT_ASTC_6x6_SRGB_BLOCK:
839 case VK_FORMAT_ASTC_8x5_UNORM_BLOCK:
840 case VK_FORMAT_ASTC_8x5_SRGB_BLOCK:
841 case VK_FORMAT_ASTC_8x6_UNORM_BLOCK:
842 case VK_FORMAT_ASTC_8x6_SRGB_BLOCK:
843 case VK_FORMAT_ASTC_8x8_UNORM_BLOCK:
844 case VK_FORMAT_ASTC_8x8_SRGB_BLOCK:
845 case VK_FORMAT_ASTC_10x5_UNORM_BLOCK:
846 case VK_FORMAT_ASTC_10x5_SRGB_BLOCK:
847 case VK_FORMAT_ASTC_10x6_UNORM_BLOCK:
848 case VK_FORMAT_ASTC_10x6_SRGB_BLOCK:
849 case VK_FORMAT_ASTC_10x8_UNORM_BLOCK:
850 case VK_FORMAT_ASTC_10x8_SRGB_BLOCK:
851 case VK_FORMAT_ASTC_10x10_UNORM_BLOCK:
852 case VK_FORMAT_ASTC_10x10_SRGB_BLOCK:
853 case VK_FORMAT_ASTC_12x10_UNORM_BLOCK:
854 case VK_FORMAT_ASTC_12x10_SRGB_BLOCK:
855 case VK_FORMAT_ASTC_12x12_UNORM_BLOCK:
856 case VK_FORMAT_ASTC_12x12_SRGB_BLOCK:
857 if (!features.textureCompressionASTC_LDR)
865 const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(vki, physDevice, info.format);
866 const VkFormatFeatureFlags formatFeatures = (info.tiling == VK_IMAGE_TILING_LINEAR ? formatProperties.linearTilingFeatures
867 : formatProperties.optimalTilingFeatures);
869 if (!isUsageMatchesFeatures(info.usage, formatFeatures))
872 VkImageFormatProperties imageFormatProperties;
873 const VkResult result = vki.getPhysicalDeviceImageFormatProperties(
874 physDevice, info.format, info.imageType, info.tiling, info.usage, info.flags, &imageFormatProperties);
876 if (result == VK_SUCCESS)
878 if (info.arrayLayers > imageFormatProperties.maxArrayLayers)
880 if (info.mipLevels > imageFormatProperties.maxMipLevels)
882 if ((info.samples & imageFormatProperties.sampleCounts) == 0u)
886 return result == VK_SUCCESS;
889 VkExtent3D ImageMemoryRequirementsOriginal::makeExtentForImage (const VkImageType imageType)
891 VkExtent3D extent = { 64u, 64u, 4u };
893 if (imageType == VK_IMAGE_TYPE_1D)
894 extent.height = extent.depth = 1u;
895 else if (imageType == VK_IMAGE_TYPE_2D)
901 bool ImageMemoryRequirementsOriginal::isFormatMatchingAspect (const VkFormat format, const VkImageAspectFlags aspect)
903 DE_ASSERT(aspect == VK_IMAGE_ASPECT_COLOR_BIT || aspect == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT));
905 // D/S formats are laid out next to each other in the enum
906 const bool isDepthStencilFormat = (format >= VK_FORMAT_D16_UNORM && format <= VK_FORMAT_D32_SFLOAT_S8_UINT);
908 return (aspect == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) == isDepthStencilFormat;
911 std::string ImageMemoryRequirementsOriginal::getImageInfoString (const VkImageCreateInfo& imageInfo)
913 std::ostringstream str;
915 switch (imageInfo.imageType)
917 case VK_IMAGE_TYPE_1D: str << "1D "; break;
918 case VK_IMAGE_TYPE_2D: str << "2D "; break;
919 case VK_IMAGE_TYPE_3D: str << "3D "; break;
923 switch (imageInfo.tiling)
925 case VK_IMAGE_TILING_OPTIMAL: str << "(optimal) "; break;
926 case VK_IMAGE_TILING_LINEAR: str << "(linear) "; break;
930 str << "extent:[" << imageInfo.extent.width << ", " << imageInfo.extent.height << ", " << imageInfo.extent.depth << "] ";
931 str << imageInfo.format << " ";
932 str << "samples:" << static_cast<deUint32>(imageInfo.samples) << " ";
933 str << "flags:" << static_cast<deUint32>(imageInfo.flags) << " ";
934 str << "usage:" << static_cast<deUint32>(imageInfo.usage) << " ";
939 tcu::TestStatus ImageMemoryRequirementsOriginal::execTest (Context& context, const ImageTestParams params)
941 const DeviceInterface& vk = context.getDeviceInterface();
942 const InstanceInterface& vki = context.getInstanceInterface();
943 const VkDevice device = context.getDevice();
944 const VkPhysicalDevice physDevice = context.getPhysicalDevice();
945 const VkImageCreateFlags sparseFlags = VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT;
946 const VkImageUsageFlags transientFlags = VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT;
948 preTestChecks(context, vki, physDevice, params.flags);
950 const VkPhysicalDeviceMemoryProperties memoryProperties = getPhysicalDeviceMemoryProperties(vki, physDevice);
951 const deUint32 notInitializedBits = ~0u;
952 const VkImageAspectFlags colorAspect = VK_IMAGE_ASPECT_COLOR_BIT;
953 const VkImageAspectFlags depthStencilAspect = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
954 const VkImageAspectFlags allAspects[2] = { colorAspect, depthStencilAspect };
955 tcu::TestLog& log = context.getTestContext().getLog();
957 deUint32 numCheckedImages = 0u;
959 log << tcu::TestLog::Message << "Verify memory requirements for the following parameter combinations:" << tcu::TestLog::EndMessage;
961 for (deUint32 loopAspectNdx = 0u; loopAspectNdx < DE_LENGTH_OF_ARRAY(allAspects); ++loopAspectNdx)
963 const VkImageAspectFlags aspect = allAspects[loopAspectNdx];
964 deUint32 previousMemoryTypeBits = notInitializedBits;
966 for (VkFormat loopFormat = VK_FORMAT_R4G4_UNORM_PACK8; loopFormat <= VK_FORMAT_ASTC_12x12_SRGB_BLOCK; loopFormat = nextEnum(loopFormat))
967 if (isFormatMatchingAspect(loopFormat, aspect))
969 // memoryTypeBits may differ between depth/stencil formats
970 if (aspect == depthStencilAspect)
971 previousMemoryTypeBits = notInitializedBits;
973 for (VkImageType loopImageType = VK_IMAGE_TYPE_1D; loopImageType != VK_IMAGE_TYPE_LAST; loopImageType = nextEnum(loopImageType))
974 for (VkImageCreateFlags loopCreateFlags = (VkImageCreateFlags)0; loopCreateFlags <= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; loopCreateFlags = nextFlagExcluding(loopCreateFlags, sparseFlags))
975 for (VkImageUsageFlags loopUsageFlags = VK_IMAGE_USAGE_TRANSFER_SRC_BIT; loopUsageFlags <= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT; loopUsageFlags = nextFlagExcluding(loopUsageFlags, transientFlags))
976 for (VkSampleCountFlagBits loopSampleCount = VK_SAMPLE_COUNT_1_BIT; loopSampleCount <= VK_SAMPLE_COUNT_16_BIT; loopSampleCount = nextFlag(loopSampleCount))
978 const VkImageCreateFlags actualCreateFlags = loopCreateFlags | params.flags;
979 const VkImageUsageFlags actualUsageFlags = loopUsageFlags | (params.transient ? VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT : (VkImageUsageFlagBits)0);
980 const bool isCube = (actualCreateFlags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) != 0u;
981 const VkImageCreateInfo imageInfo =
983 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
984 DE_NULL, // const void* pNext;
985 actualCreateFlags, // VkImageCreateFlags flags;
986 loopImageType, // VkImageType imageType;
987 loopFormat, // VkFormat format;
988 makeExtentForImage(loopImageType), // VkExtent3D extent;
989 1u, // uint32_t mipLevels;
990 (isCube ? 6u : 1u), // uint32_t arrayLayers;
991 loopSampleCount, // VkSampleCountFlagBits samples;
992 params.tiling, // VkImageTiling tiling;
993 actualUsageFlags, // VkImageUsageFlags usage;
994 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
995 0u, // uint32_t queueFamilyIndexCount;
996 DE_NULL, // const uint32_t* pQueueFamilyIndices;
997 VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout;
1000 m_currentTestImageInfo = imageInfo;
1002 if (!isImageSupported(vki, physDevice, m_currentTestImageInfo))
1005 log << tcu::TestLog::Message << "- " << getImageInfoString(m_currentTestImageInfo) << tcu::TestLog::EndMessage;
1008 tcu::ResultCollector result(log, "ERROR: ");
1010 updateMemoryRequirements(vk, device);
1012 verifyMemoryRequirements(result, memoryProperties);
1014 // For the same tiling, transient usage, and sparse flags, (and format, if D/S) memoryTypeBits must be the same for all images
1015 result.check((previousMemoryTypeBits == notInitializedBits) || (m_currentTestRequirements.memoryTypeBits == previousMemoryTypeBits),
1016 "memoryTypeBits differ from the ones in the previous image configuration");
1018 if (result.getResult() != QP_TEST_RESULT_PASS)
1021 previousMemoryTypeBits = m_currentTestRequirements.memoryTypeBits;
1026 if (numCheckedImages == 0u)
1027 log << tcu::TestLog::Message << "NOTE: No supported image configurations -- nothing to check" << tcu::TestLog::EndMessage;
1029 return allPass ? tcu::TestStatus::pass("Pass") : tcu::TestStatus::fail("Some memory requirements were incorrect");
1033 class ImageMemoryRequirementsExtended : public ImageMemoryRequirementsOriginal
1036 static tcu::TestStatus testEntryPoint (Context& context,
1037 const ImageTestParams params);
1040 virtual void addFunctionTestCase (tcu::TestCaseGroup* group,
1041 const std::string& name,
1042 const std::string& desc,
1043 const ImageTestParams arg0);
1045 virtual void preTestChecks (Context& context,
1046 const InstanceInterface& vki,
1047 const VkPhysicalDevice physDevice,
1048 const VkImageCreateFlags flags);
1050 virtual void updateMemoryRequirements (const DeviceInterface& vk,
1051 const VkDevice device);
1055 tcu::TestStatus ImageMemoryRequirementsExtended::testEntryPoint (Context& context, const ImageTestParams params)
1057 ImageMemoryRequirementsExtended test;
1059 return test.execTest(context, params);
1062 void ImageMemoryRequirementsExtended::addFunctionTestCase (tcu::TestCaseGroup* group,
1063 const std::string& name,
1064 const std::string& desc,
1065 const ImageTestParams arg0)
1067 addFunctionCase(group, name, desc, testEntryPoint, arg0);
1070 void ImageMemoryRequirementsExtended::preTestChecks (Context& context,
1071 const InstanceInterface& vki,
1072 const VkPhysicalDevice physDevice,
1073 const VkImageCreateFlags createFlags)
1075 const std::string extensionName("VK_KHR_get_memory_requirements2");
1077 if (!de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), extensionName))
1078 TCU_THROW(NotSupportedError, std::string(extensionName + " is not supported").c_str());
1080 ImageMemoryRequirementsOriginal::preTestChecks (context, vki, physDevice, createFlags);
1083 void ImageMemoryRequirementsExtended::updateMemoryRequirements (const DeviceInterface& vk,
1084 const VkDevice device)
1086 m_currentTestRequirements = getImageMemoryRequirements2(vk, device, m_currentTestImageInfo);
1090 void populateCoreTestGroup (tcu::TestCaseGroup* group)
1092 BufferMemoryRequirementsOriginal bufferTest;
1093 ImageMemoryRequirementsOriginal imageTest;
1095 bufferTest.populateTestGroup(group);
1096 imageTest.populateTestGroup(group);
1099 void populateExtendedTestGroup (tcu::TestCaseGroup* group)
1101 BufferMemoryRequirementsExtended bufferTest;
1102 ImageMemoryRequirementsExtended imageTest;
1104 bufferTest.populateTestGroup(group);
1105 imageTest.populateTestGroup(group);
1111 tcu::TestCaseGroup* createRequirementsTests (tcu::TestContext& testCtx)
1113 de::MovePtr<tcu::TestCaseGroup> requirementsGroup(new tcu::TestCaseGroup(testCtx, "requirements", "Buffer and image memory requirements"));
1115 requirementsGroup->addChild(createTestGroup(testCtx, "core", "Memory requirements tests with core functionality", populateCoreTestGroup));
1116 requirementsGroup->addChild(createTestGroup(testCtx, "extended", "Memory requirements tests with extension VK_KHR_get_memory_requirements2", populateExtendedTestGroup));
1118 return requirementsGroup.release();