1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2015 Google Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and/or associated documentation files (the
9 * "Materials"), to deal in the Materials without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Materials, and to
12 * permit persons to whom the Materials are furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice(s) and this permission notice shall be
16 * included in all copies or substantial portions of the Materials.
18 * The Materials are Confidential Information as defined by the
19 * Khronos Membership Agreement until designated non-confidential by
20 * Khronos, at which point this condition clause shall be removed.
22 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
32 * \brief Object management tests
33 *//*--------------------------------------------------------------------*/
35 #include "vktApiObjectManagementTests.hpp"
36 #include "vktTestCaseUtil.hpp"
40 #include "vkRefUtil.hpp"
41 #include "vkQueryUtil.hpp"
42 #include "vkMemUtil.hpp"
43 #include "vkPrograms.hpp"
44 #include "vkTypeUtil.hpp"
45 #include "vkPlatform.hpp"
46 #include "vkStrUtil.hpp"
47 #include "vkAllocationCallbackUtil.hpp"
49 #include "tcuVector.hpp"
50 #include "tcuResultCollector.hpp"
51 #include "tcuCommandLine.hpp"
52 #include "tcuTestLog.hpp"
54 #include "deUniquePtr.hpp"
55 #include "deSharedPtr.hpp"
56 #include "deArrayUtil.hpp"
57 #include "deSpinBarrier.hpp"
58 #include "deThread.hpp"
77 using tcu::ResultCollector;
78 using tcu::TestStatus;
84 class ThreadGroupThread;
86 /*--------------------------------------------------------------------*//*!
89 * Thread group manages collection of threads that are expected to be
90 * launched simultaneously as a group.
92 * Shared barrier is provided for synchronizing execution. Terminating thread
93 * early either by returning from ThreadGroupThread::runThread() or throwing
94 * an exception is safe, and other threads will continue execution. The
95 * thread that has been terminated is simply removed from the synchronization
98 * TestException-based exceptions are collected and translated into a
99 * tcu::TestStatus by using tcu::ResultCollector.
101 * Use cases for ThreadGroup include for example testing thread-safety of
102 * certain API operations by poking API simultaneously from multiple
104 *//*--------------------------------------------------------------------*/
111 void add (de::MovePtr<ThreadGroupThread> thread);
112 TestStatus run (void);
115 typedef std::vector<de::SharedPtr<ThreadGroupThread> > ThreadVector;
117 ThreadVector m_threads;
118 de::SpinBarrier m_barrier;
119 } DE_WARN_UNUSED_TYPE;
121 class ThreadGroupThread : private de::Thread
124 ThreadGroupThread (void);
125 virtual ~ThreadGroupThread (void);
127 void start (de::SpinBarrier* groupBarrier);
129 ResultCollector& getResultCollector (void) { return m_resultCollector; }
131 using de::Thread::join;
134 virtual void runThread (void) = 0;
139 ThreadGroupThread (const ThreadGroupThread&);
140 ThreadGroupThread& operator= (const ThreadGroupThread&);
144 ResultCollector m_resultCollector;
145 de::SpinBarrier* m_barrier;
150 ThreadGroup::ThreadGroup (void)
155 ThreadGroup::~ThreadGroup (void)
159 void ThreadGroup::add (de::MovePtr<ThreadGroupThread> thread)
161 m_threads.push_back(de::SharedPtr<ThreadGroupThread>(thread.release()));
164 tcu::TestStatus ThreadGroup::run (void)
166 tcu::ResultCollector resultCollector;
168 m_barrier.reset((int)m_threads.size());
170 for (ThreadVector::iterator threadIter = m_threads.begin(); threadIter != m_threads.end(); ++threadIter)
171 (*threadIter)->start(&m_barrier);
173 for (ThreadVector::iterator threadIter = m_threads.begin(); threadIter != m_threads.end(); ++threadIter)
175 tcu::ResultCollector& threadResult = (*threadIter)->getResultCollector();
176 (*threadIter)->join();
177 resultCollector.addResult(threadResult.getResult(), threadResult.getMessage());
180 return tcu::TestStatus(resultCollector.getResult(), resultCollector.getMessage());
185 ThreadGroupThread::ThreadGroupThread (void)
190 ThreadGroupThread::~ThreadGroupThread (void)
194 void ThreadGroupThread::start (de::SpinBarrier* groupBarrier)
196 m_barrier = groupBarrier;
200 void ThreadGroupThread::run (void)
206 catch (const tcu::TestException& e)
208 getResultCollector().addResult(e.getTestResult(), e.getMessage());
210 catch (const std::exception& e)
212 getResultCollector().addResult(QP_TEST_RESULT_FAIL, e.what());
216 getResultCollector().addResult(QP_TEST_RESULT_FAIL, "Exception");
219 m_barrier->removeThread(de::SpinBarrier::WAIT_MODE_AUTO);
222 inline void ThreadGroupThread::barrier (void)
224 m_barrier->sync(de::SpinBarrier::WAIT_MODE_AUTO);
227 deUint32 getDefaultTestThreadCount (void)
229 return de::clamp(deGetNumAvailableLogicalCores(), 2u, 8u);
236 const PlatformInterface& vkp;
237 const DeviceInterface& vkd;
239 deUint32 queueFamilyIndex;
240 const BinaryCollection& programBinaries;
241 const VkAllocationCallbacks* allocationCallbacks;
242 deUint32 maxResourceConsumers; // Maximum number of objects using same Object::Resources concurrently
244 Environment (Context& context, deUint32 maxResourceConsumers_)
245 : vkp (context.getPlatformInterface())
246 , vkd (context.getDeviceInterface())
247 , device (context.getDevice())
248 , queueFamilyIndex (context.getUniversalQueueFamilyIndex())
249 , programBinaries (context.getBinaryCollection())
250 , allocationCallbacks (DE_NULL)
251 , maxResourceConsumers (maxResourceConsumers_)
255 Environment (const PlatformInterface& vkp_,
256 const DeviceInterface& vkd_,
258 deUint32 queueFamilyIndex_,
259 const BinaryCollection& programBinaries_,
260 const VkAllocationCallbacks* allocationCallbacks_,
261 deUint32 maxResourceConsumers_)
265 , queueFamilyIndex (queueFamilyIndex_)
266 , programBinaries (programBinaries_)
267 , allocationCallbacks (allocationCallbacks_)
268 , maxResourceConsumers (maxResourceConsumers_)
273 template<typename Case>
276 typename Case::Resources resources;
277 Unique<typename Case::Type> object;
279 Dependency (const Environment& env, const typename Case::Parameters& params)
280 : resources (env, params)
281 , object (Case::create(env, resources, params))
285 // Object definitions
289 DEFAULT_MAX_CONCURRENT_OBJECTS = 16*1024
294 typedef VkInstance Type;
296 enum { MAX_CONCURRENT = 32 };
305 Resources (const Environment&, const Parameters&) {}
308 static Move<VkInstance> create (const Environment& env, const Resources&, const Parameters&)
310 const VkApplicationInfo appInfo =
312 VK_STRUCTURE_TYPE_APPLICATION_INFO,
314 DE_NULL, // pApplicationName
315 0u, // applicationVersion
316 DE_NULL, // pEngineName
320 const VkInstanceCreateInfo instanceInfo =
322 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
324 (VkInstanceCreateFlags)0,
326 0u, // enabledLayerNameCount
327 DE_NULL, // ppEnabledLayerNames
328 0u, // enabledExtensionNameCount
329 DE_NULL, // ppEnabledExtensionNames
332 return createInstance(env.vkp, &instanceInfo, env.allocationCallbacks);
338 typedef VkDevice Type;
340 enum { MAX_CONCURRENT = 32 };
344 deUint32 deviceIndex;
345 VkQueueFlags queueFlags;
347 Parameters (deUint32 deviceIndex_, VkQueueFlags queueFlags_)
348 : deviceIndex (deviceIndex_)
349 , queueFlags (queueFlags_)
355 Dependency<Instance> instance;
357 VkPhysicalDevice physicalDevice;
358 deUint32 queueFamilyIndex;
360 Resources (const Environment& env, const Parameters& params)
361 : instance (env, Instance::Parameters())
362 , vki (env.vkp, *instance.object)
364 , queueFamilyIndex (~0u)
367 const vector<VkPhysicalDevice> physicalDevices = enumeratePhysicalDevices(vki, *instance.object);
369 if (physicalDevices.size() <= (size_t)params.deviceIndex)
370 TCU_THROW(NotSupportedError, "Device not found");
372 physicalDevice = physicalDevices[params.deviceIndex];
376 const vector<VkQueueFamilyProperties> queueProps = getPhysicalDeviceQueueFamilyProperties(vki, physicalDevice);
377 bool foundMatching = false;
379 for (size_t curQueueNdx = 0; curQueueNdx < queueProps.size(); curQueueNdx++)
381 if ((queueProps[curQueueNdx].queueFlags & params.queueFlags) == params.queueFlags)
383 queueFamilyIndex = (deUint32)curQueueNdx;
384 foundMatching = true;
389 TCU_THROW(NotSupportedError, "Matching queue not found");
394 static Move<VkDevice> create (const Environment& env, const Resources& res, const Parameters&)
396 const float queuePriority = 1.0;
398 const VkDeviceQueueCreateInfo queues[] =
401 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
403 (VkDeviceQueueCreateFlags)0,
404 res.queueFamilyIndex,
406 &queuePriority, // pQueuePriorities
409 const VkDeviceCreateInfo deviceInfo =
411 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
413 (VkDeviceCreateFlags)0,
414 DE_LENGTH_OF_ARRAY(queues),
416 0u, // enabledLayerNameCount
417 DE_NULL, // ppEnabledLayerNames
418 0u, // enabledExtensionNameCount
419 DE_NULL, // ppEnabledExtensionNames
420 DE_NULL, // pEnabledFeatures
423 return createDevice(res.vki, res.physicalDevice, &deviceInfo, env.allocationCallbacks);
429 typedef VkDeviceMemory Type;
431 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
436 deUint32 memoryTypeIndex;
438 Parameters (VkDeviceSize size_, deUint32 memoryTypeIndex_)
440 , memoryTypeIndex (memoryTypeIndex_)
442 DE_ASSERT(memoryTypeIndex < VK_MAX_MEMORY_TYPES);
448 Resources (const Environment&, const Parameters&) {}
451 static Move<VkDeviceMemory> create (const Environment& env, const Resources&, const Parameters& params)
453 const VkMemoryAllocateInfo allocInfo =
455 VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
458 params.memoryTypeIndex
461 return allocateMemory(env.vkd, env.device, &allocInfo, env.allocationCallbacks);
465 DeviceMemory::Parameters getDeviceMemoryParameters (const VkMemoryRequirements& memReqs)
467 return DeviceMemory::Parameters(memReqs.size, deCtz32(memReqs.memoryTypeBits));
470 DeviceMemory::Parameters getDeviceMemoryParameters (const Environment& env, VkImage image)
472 return getDeviceMemoryParameters(getImageMemoryRequirements(env.vkd, env.device, image));
475 DeviceMemory::Parameters getDeviceMemoryParameters (const Environment& env, VkBuffer image)
477 return getDeviceMemoryParameters(getBufferMemoryRequirements(env.vkd, env.device, image));
482 typedef VkBuffer Type;
484 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
489 VkBufferUsageFlags usage;
491 Parameters (VkDeviceSize size_,
492 VkBufferUsageFlags usage_)
500 Resources (const Environment&, const Parameters&) {}
503 static Move<VkBuffer> create (const Environment& env, const Resources&, const Parameters& params)
505 const VkBufferCreateInfo bufferInfo =
507 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
509 (VkBufferCreateFlags)0,
512 VK_SHARING_MODE_EXCLUSIVE,
514 &env.queueFamilyIndex
517 return createBuffer(env.vkd, env.device, &bufferInfo, env.allocationCallbacks);
523 typedef VkBufferView Type;
525 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
529 Buffer::Parameters buffer;
534 Parameters (const Buffer::Parameters& buffer_,
536 VkDeviceSize offset_,
547 Dependency<Buffer> buffer;
548 Dependency<DeviceMemory> memory;
550 Resources (const Environment& env, const Parameters& params)
551 : buffer(env, params.buffer)
552 , memory(env, getDeviceMemoryParameters(env, *buffer.object))
554 VK_CHECK(env.vkd.bindBufferMemory(env.device, *buffer.object, *memory.object, 0));
558 static Move<VkBufferView> create (const Environment& env, const Resources& res, const Parameters& params)
560 const VkBufferViewCreateInfo bufferViewInfo =
562 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO,
564 (VkBufferViewCreateFlags)0,
571 return createBufferView(env.vkd, env.device, &bufferViewInfo, env.allocationCallbacks);
577 typedef VkImage Type;
579 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
583 VkImageCreateFlags flags;
584 VkImageType imageType;
589 VkSampleCountFlagBits samples;
590 VkImageTiling tiling;
591 VkImageUsageFlags usage;
592 VkImageLayout initialLayout;
594 Parameters (VkImageCreateFlags flags_,
595 VkImageType imageType_,
600 VkSampleCountFlagBits samples_,
601 VkImageTiling tiling_,
602 VkImageUsageFlags usage_,
603 VkImageLayout initialLayout_)
605 , imageType (imageType_)
608 , mipLevels (mipLevels_)
609 , arraySize (arraySize_)
613 , initialLayout (initialLayout_)
619 Resources (const Environment&, const Parameters&) {}
622 static Move<VkImage> create (const Environment& env, const Resources&, const Parameters& params)
624 const VkImageCreateInfo imageInfo =
626 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
637 VK_SHARING_MODE_EXCLUSIVE, // sharingMode
638 1u, // queueFamilyIndexCount
639 &env.queueFamilyIndex, // pQueueFamilyIndices
643 return createImage(env.vkd, env.device, &imageInfo, env.allocationCallbacks);
649 typedef VkImageView Type;
651 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
655 Image::Parameters image;
656 VkImageViewType viewType;
658 VkComponentMapping components;
659 VkImageSubresourceRange subresourceRange;
661 Parameters (const Image::Parameters& image_,
662 VkImageViewType viewType_,
664 VkComponentMapping components_,
665 VkImageSubresourceRange subresourceRange_)
667 , viewType (viewType_)
669 , components (components_)
670 , subresourceRange (subresourceRange_)
676 Dependency<Image> image;
677 Dependency<DeviceMemory> memory;
679 Resources (const Environment& env, const Parameters& params)
680 : image (env, params.image)
681 , memory(env, getDeviceMemoryParameters(env, *image.object))
683 VK_CHECK(env.vkd.bindImageMemory(env.device, *image.object, *memory.object, 0));
687 static Move<VkImageView> create (const Environment& env, const Resources& res, const Parameters& params)
689 const VkImageViewCreateInfo imageViewInfo =
691 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
693 (VkImageViewCreateFlags)0,
698 params.subresourceRange,
701 return createImageView(env.vkd, env.device, &imageViewInfo, env.allocationCallbacks);
707 typedef VkSemaphore Type;
709 enum { MAX_CONCURRENT = 100 };
713 VkSemaphoreCreateFlags flags;
715 Parameters (VkSemaphoreCreateFlags flags_)
722 Resources (const Environment&, const Parameters&) {}
725 static Move<VkSemaphore> create (const Environment& env, const Resources&, const Parameters& params)
727 const VkSemaphoreCreateInfo semaphoreInfo =
729 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
734 return createSemaphore(env.vkd, env.device, &semaphoreInfo, env.allocationCallbacks);
740 typedef VkFence Type;
742 enum { MAX_CONCURRENT = 100 };
746 VkFenceCreateFlags flags;
748 Parameters (VkFenceCreateFlags flags_)
755 Resources (const Environment&, const Parameters&) {}
758 static Move<VkFence> create (const Environment& env, const Resources&, const Parameters& params)
760 const VkFenceCreateInfo fenceInfo =
762 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
767 return createFence(env.vkd, env.device, &fenceInfo, env.allocationCallbacks);
773 typedef VkEvent Type;
775 enum { MAX_CONCURRENT = 100 };
779 VkEventCreateFlags flags;
781 Parameters (VkEventCreateFlags flags_)
788 Resources (const Environment&, const Parameters&) {}
791 static Move<VkEvent> create (const Environment& env, const Resources&, const Parameters& params)
793 const VkEventCreateInfo eventInfo =
795 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
800 return createEvent(env.vkd, env.device, &eventInfo, env.allocationCallbacks);
806 typedef VkQueryPool Type;
808 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
812 VkQueryType queryType;
814 VkQueryPipelineStatisticFlags pipelineStatistics;
816 Parameters (VkQueryType queryType_,
817 deUint32 entryCount_,
818 VkQueryPipelineStatisticFlags pipelineStatistics_)
819 : queryType (queryType_)
820 , entryCount (entryCount_)
821 , pipelineStatistics (pipelineStatistics_)
827 Resources (const Environment&, const Parameters&) {}
830 static Move<VkQueryPool> create (const Environment& env, const Resources&, const Parameters& params)
832 const VkQueryPoolCreateInfo queryPoolInfo =
834 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO,
836 (VkQueryPoolCreateFlags)0,
839 params.pipelineStatistics
842 return createQueryPool(env.vkd, env.device, &queryPoolInfo, env.allocationCallbacks);
848 typedef VkShaderModule Type;
850 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
854 VkShaderStageFlagBits shaderStage;
857 Parameters (VkShaderStageFlagBits shaderStage_,
858 const std::string& binaryName_)
859 : shaderStage (shaderStage_)
860 , binaryName (binaryName_)
866 const ProgramBinary& binary;
868 Resources (const Environment& env, const Parameters& params)
869 : binary(env.programBinaries.get(params.binaryName))
873 static const char* getSource (VkShaderStageFlagBits stage)
877 case VK_SHADER_STAGE_VERTEX_BIT:
878 return "#version 310 es\n"
879 "layout(location = 0) in highp vec4 a_position;\n"
880 "void main () { gl_Position = a_position; }\n";
882 case VK_SHADER_STAGE_FRAGMENT_BIT:
883 return "#version 310 es\n"
884 "layout(location = 0) out mediump vec4 o_color;\n"
885 "void main () { o_color = vec4(1.0, 0.5, 0.25, 1.0); }";
887 case VK_SHADER_STAGE_COMPUTE_BIT:
888 return "#version 310 es\n"
889 "layout(binding = 0) buffer Input { highp uint dataIn[]; };\n"
890 "layout(binding = 1) buffer Output { highp uint dataOut[]; };\n"
893 " dataOut[gl_GlobalInvocationID.x] = ~dataIn[gl_GlobalInvocationID.x];\n"
897 DE_FATAL("Not implemented");
902 static void initPrograms (SourceCollections& dst, Parameters params)
904 const char* const source = getSource(params.shaderStage);
908 dst.glslSources.add(params.binaryName)
909 << glu::ShaderSource(getGluShaderType(params.shaderStage), source);
912 static Move<VkShaderModule> create (const Environment& env, const Resources& res, const Parameters&)
914 const VkShaderModuleCreateInfo shaderModuleInfo =
916 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
918 (VkShaderModuleCreateFlags)0,
919 res.binary.getSize(),
920 (const deUint32*)res.binary.getBinary(),
923 return createShaderModule(env.vkd, env.device, &shaderModuleInfo, env.allocationCallbacks);
929 typedef VkPipelineCache Type;
931 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
940 Resources (const Environment&, const Parameters&) {}
943 static Move<VkPipelineCache> create (const Environment& env, const Resources&, const Parameters&)
945 const VkPipelineCacheCreateInfo pipelineCacheInfo =
947 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
949 (VkPipelineCacheCreateFlags)0u,
950 0u, // initialDataSize
951 DE_NULL, // pInitialData
954 return createPipelineCache(env.vkd, env.device, &pipelineCacheInfo, env.allocationCallbacks);
960 typedef VkSampler Type;
962 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
968 VkSamplerMipmapMode mipmapMode;
969 VkSamplerAddressMode addressModeU;
970 VkSamplerAddressMode addressModeV;
971 VkSamplerAddressMode addressModeW;
974 VkBool32 compareEnable;
975 VkCompareOp compareOp;
978 VkBorderColor borderColor;
979 VkBool32 unnormalizedCoordinates;
981 // \todo [2015-09-17 pyry] Other configurations
983 : magFilter (VK_FILTER_NEAREST)
984 , minFilter (VK_FILTER_NEAREST)
985 , mipmapMode (VK_SAMPLER_MIPMAP_MODE_BASE)
986 , addressModeU (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE)
987 , addressModeV (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE)
988 , addressModeW (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE)
990 , maxAnisotropy (1.0f)
991 , compareEnable (VK_FALSE)
992 , compareOp (VK_COMPARE_OP_ALWAYS)
995 , borderColor (VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK)
996 , unnormalizedCoordinates (VK_FALSE)
1002 Resources (const Environment&, const Parameters&) {}
1005 static Move<VkSampler> create (const Environment& env, const Resources&, const Parameters& params)
1007 const VkSamplerCreateInfo samplerInfo =
1009 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
1011 (VkSamplerCreateFlags)0,
1015 params.addressModeU,
1016 params.addressModeV,
1017 params.addressModeW,
1019 params.maxAnisotropy,
1020 params.compareEnable,
1025 params.unnormalizedCoordinates
1028 return createSampler(env.vkd, env.device, &samplerInfo, env.allocationCallbacks);
1032 struct DescriptorSetLayout
1034 typedef VkDescriptorSetLayout Type;
1036 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1043 VkDescriptorType descriptorType;
1044 deUint32 descriptorCount;
1045 VkShaderStageFlags stageFlags;
1046 bool useImmutableSampler;
1048 Binding (deUint32 binding_,
1049 VkDescriptorType descriptorType_,
1050 deUint32 descriptorCount_,
1051 VkShaderStageFlags stageFlags_,
1052 bool useImmutableSampler_)
1053 : binding (binding_)
1054 , descriptorType (descriptorType_)
1055 , descriptorCount (descriptorCount_)
1056 , stageFlags (stageFlags_)
1057 , useImmutableSampler (useImmutableSampler_)
1063 vector<Binding> bindings;
1065 Parameters (const vector<Binding>& bindings_)
1066 : bindings(bindings_)
1069 static Parameters empty (void)
1071 return Parameters(vector<Binding>());
1074 static Parameters single (deUint32 binding,
1075 VkDescriptorType descriptorType,
1076 deUint32 descriptorCount,
1077 VkShaderStageFlags stageFlags,
1078 bool useImmutableSampler = false)
1080 vector<Binding> bindings;
1081 bindings.push_back(Binding(binding, descriptorType, descriptorCount, stageFlags, useImmutableSampler));
1082 return Parameters(bindings);
1088 vector<VkDescriptorSetLayoutBinding> bindings;
1089 MovePtr<Dependency<Sampler> > immutableSampler;
1090 vector<VkSampler> immutableSamplersPtr;
1092 Resources (const Environment& env, const Parameters& params)
1094 // Create immutable sampler if needed
1095 for (vector<Parameters::Binding>::const_iterator cur = params.bindings.begin(); cur != params.bindings.end(); cur++)
1097 if (cur->useImmutableSampler && !immutableSampler)
1099 immutableSampler = de::newMovePtr<Dependency<Sampler> >(env, Sampler::Parameters());
1101 if (cur->useImmutableSampler && immutableSamplersPtr.size() < (size_t)cur->descriptorCount)
1102 immutableSamplersPtr.resize(cur->descriptorCount, *immutableSampler->object);
1106 for (vector<Parameters::Binding>::const_iterator cur = params.bindings.begin(); cur != params.bindings.end(); cur++)
1108 const VkDescriptorSetLayoutBinding binding =
1111 cur->descriptorType,
1112 cur->descriptorCount,
1114 (cur->useImmutableSampler ? &immutableSamplersPtr[0] : DE_NULL)
1117 bindings.push_back(binding);
1122 static Move<VkDescriptorSetLayout> create (const Environment& env, const Resources& res, const Parameters&)
1124 const VkDescriptorSetLayoutCreateInfo descriptorSetLayoutInfo =
1126 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
1128 (VkDescriptorSetLayoutCreateFlags)0,
1129 (deUint32)res.bindings.size(),
1130 (res.bindings.empty() ? DE_NULL : &res.bindings[0])
1133 return createDescriptorSetLayout(env.vkd, env.device, &descriptorSetLayoutInfo, env.allocationCallbacks);
1137 struct PipelineLayout
1139 typedef VkPipelineLayout Type;
1141 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1145 vector<DescriptorSetLayout::Parameters> descriptorSetLayouts;
1146 vector<VkPushConstantRange> pushConstantRanges;
1148 Parameters (void) {}
1150 static Parameters empty (void)
1152 return Parameters();
1155 static Parameters singleDescriptorSet (const DescriptorSetLayout::Parameters& descriptorSetLayout)
1158 params.descriptorSetLayouts.push_back(descriptorSetLayout);
1165 typedef SharedPtr<Dependency<DescriptorSetLayout> > DescriptorSetLayoutDepSp;
1166 typedef vector<DescriptorSetLayoutDepSp> DescriptorSetLayouts;
1168 DescriptorSetLayouts descriptorSetLayouts;
1169 vector<VkDescriptorSetLayout> pSetLayouts;
1171 Resources (const Environment& env, const Parameters& params)
1173 for (vector<DescriptorSetLayout::Parameters>::const_iterator dsParams = params.descriptorSetLayouts.begin();
1174 dsParams != params.descriptorSetLayouts.end();
1177 descriptorSetLayouts.push_back(DescriptorSetLayoutDepSp(new Dependency<DescriptorSetLayout>(env, *dsParams)));
1178 pSetLayouts.push_back(*descriptorSetLayouts.back()->object);
1183 static Move<VkPipelineLayout> create (const Environment& env, const Resources& res, const Parameters& params)
1185 const VkPipelineLayoutCreateInfo pipelineLayoutInfo =
1187 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
1189 (VkPipelineLayoutCreateFlags)0,
1190 (deUint32)res.pSetLayouts.size(),
1191 (res.pSetLayouts.empty() ? DE_NULL : &res.pSetLayouts[0]),
1192 (deUint32)params.pushConstantRanges.size(),
1193 (params.pushConstantRanges.empty() ? DE_NULL : ¶ms.pushConstantRanges[0]),
1196 return createPipelineLayout(env.vkd, env.device, &pipelineLayoutInfo, env.allocationCallbacks);
1202 typedef VkRenderPass Type;
1204 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1206 // \todo [2015-09-17 pyry] More interesting configurations
1209 Parameters (void) {}
1214 Resources (const Environment&, const Parameters&) {}
1217 static Move<VkRenderPass> create (const Environment& env, const Resources&, const Parameters&)
1219 const VkAttachmentDescription attachments[] =
1222 (VkAttachmentDescriptionFlags)0,
1223 VK_FORMAT_R8G8B8A8_UNORM,
1224 VK_SAMPLE_COUNT_1_BIT,
1225 VK_ATTACHMENT_LOAD_OP_CLEAR,
1226 VK_ATTACHMENT_STORE_OP_STORE,
1227 VK_ATTACHMENT_LOAD_OP_DONT_CARE,
1228 VK_ATTACHMENT_STORE_OP_DONT_CARE,
1229 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
1230 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
1233 (VkAttachmentDescriptionFlags)0,
1234 VK_FORMAT_D16_UNORM,
1235 VK_SAMPLE_COUNT_1_BIT,
1236 VK_ATTACHMENT_LOAD_OP_CLEAR,
1237 VK_ATTACHMENT_STORE_OP_DONT_CARE,
1238 VK_ATTACHMENT_LOAD_OP_DONT_CARE,
1239 VK_ATTACHMENT_STORE_OP_DONT_CARE,
1240 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
1241 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
1244 const VkAttachmentReference colorAttachments[] =
1248 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
1251 const VkAttachmentReference dsAttachment =
1254 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
1256 const VkSubpassDescription subpasses[] =
1259 (VkSubpassDescriptionFlags)0,
1260 VK_PIPELINE_BIND_POINT_GRAPHICS,
1261 0u, // inputAttachmentCount
1262 DE_NULL, // pInputAttachments
1263 DE_LENGTH_OF_ARRAY(colorAttachments),
1265 DE_NULL, // pResolveAttachments
1267 0u, // preserveAttachmentCount
1268 DE_NULL, // pPreserveAttachments
1271 const VkRenderPassCreateInfo renderPassInfo =
1273 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
1275 (VkRenderPassCreateFlags)0,
1276 DE_LENGTH_OF_ARRAY(attachments),
1278 DE_LENGTH_OF_ARRAY(subpasses),
1280 0u, // dependencyCount
1281 DE_NULL // pDependencies
1284 return createRenderPass(env.vkd, env.device, &renderPassInfo, env.allocationCallbacks);
1288 struct GraphicsPipeline
1290 typedef VkPipeline Type;
1292 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1294 // \todo [2015-09-17 pyry] More interesting configurations
1297 Parameters (void) {}
1302 Dependency<ShaderModule> vertexShader;
1303 Dependency<ShaderModule> fragmentShader;
1304 Dependency<PipelineLayout> layout;
1305 Dependency<RenderPass> renderPass;
1306 Dependency<PipelineCache> pipelineCache;
1308 Resources (const Environment& env, const Parameters&)
1309 : vertexShader (env, ShaderModule::Parameters(VK_SHADER_STAGE_VERTEX_BIT, "vert"))
1310 , fragmentShader (env, ShaderModule::Parameters(VK_SHADER_STAGE_FRAGMENT_BIT, "frag"))
1311 , layout (env, PipelineLayout::Parameters::singleDescriptorSet(
1312 DescriptorSetLayout::Parameters::single(0u, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1u, VK_SHADER_STAGE_FRAGMENT_BIT, true)))
1313 , renderPass (env, RenderPass::Parameters())
1314 , pipelineCache (env, PipelineCache::Parameters())
1318 static void initPrograms (SourceCollections& dst, Parameters)
1320 ShaderModule::initPrograms(dst, ShaderModule::Parameters(VK_SHADER_STAGE_VERTEX_BIT, "vert"));
1321 ShaderModule::initPrograms(dst, ShaderModule::Parameters(VK_SHADER_STAGE_FRAGMENT_BIT, "frag"));
1324 static Move<VkPipeline> create (const Environment& env, const Resources& res, const Parameters&)
1326 const VkPipelineShaderStageCreateInfo stages[] =
1329 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
1331 (VkPipelineShaderStageCreateFlags)0,
1332 VK_SHADER_STAGE_VERTEX_BIT,
1333 *res.vertexShader.object,
1335 DE_NULL, // pSpecializationInfo
1338 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
1340 (VkPipelineShaderStageCreateFlags)0,
1341 VK_SHADER_STAGE_FRAGMENT_BIT,
1342 *res.fragmentShader.object,
1344 DE_NULL, // pSpecializationInfo
1347 const VkVertexInputBindingDescription vertexBindings[] =
1352 VK_VERTEX_INPUT_RATE_VERTEX
1355 const VkVertexInputAttributeDescription vertexAttribs[] =
1360 VK_FORMAT_R32G32B32A32_SFLOAT,
1364 const VkPipelineVertexInputStateCreateInfo vertexInputState =
1366 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
1368 (VkPipelineVertexInputStateCreateFlags)0,
1369 DE_LENGTH_OF_ARRAY(vertexBindings),
1371 DE_LENGTH_OF_ARRAY(vertexAttribs),
1374 const VkPipelineInputAssemblyStateCreateInfo inputAssemblyState =
1376 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
1378 (VkPipelineInputAssemblyStateCreateFlags)0,
1379 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
1380 VK_FALSE // primitiveRestartEnable
1382 const VkViewport viewports[] =
1384 { 0.0f, 0.0f, 64.f, 64.f, 0.0f, 1.0f }
1386 const VkRect2D scissors[] =
1388 { { 0, 0 }, { 64, 64 } }
1390 const VkPipelineViewportStateCreateInfo viewportState =
1392 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
1394 (VkPipelineViewportStateCreateFlags)0,
1395 DE_LENGTH_OF_ARRAY(viewports),
1397 DE_LENGTH_OF_ARRAY(scissors),
1400 const VkPipelineRasterizationStateCreateInfo rasterState =
1402 VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
1404 (VkPipelineRasterizationStateCreateFlags)0,
1405 VK_TRUE, // depthClampEnable
1406 VK_FALSE, // rasterizerDiscardEnable
1407 VK_POLYGON_MODE_FILL,
1408 VK_CULL_MODE_BACK_BIT,
1409 VK_FRONT_FACE_COUNTER_CLOCKWISE,
1410 VK_FALSE, // depthBiasEnable
1411 0.0f, // depthBiasConstantFactor
1412 0.0f, // depthBiasClamp
1413 0.0f, // depthBiasSlopeFactor
1416 const VkPipelineMultisampleStateCreateInfo multisampleState =
1418 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
1420 (VkPipelineMultisampleStateCreateFlags)0,
1421 VK_SAMPLE_COUNT_1_BIT,
1422 VK_FALSE, // sampleShadingEnable
1423 1.0f, // minSampleShading
1424 DE_NULL, // pSampleMask
1425 VK_FALSE, // alphaToCoverageEnable
1426 VK_FALSE, // alphaToOneEnable
1428 const VkPipelineDepthStencilStateCreateInfo depthStencilState =
1430 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
1432 (VkPipelineDepthStencilStateCreateFlags)0,
1433 VK_TRUE, // depthTestEnable
1434 VK_TRUE, // depthWriteEnable
1435 VK_COMPARE_OP_LESS, // depthCompareOp
1436 VK_FALSE, // depthBoundsTestEnable
1437 VK_FALSE, // stencilTestEnable
1438 { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_ALWAYS, 0u, 0u, 0u },
1439 { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_ALWAYS, 0u, 0u, 0u },
1440 -1.0f, // minDepthBounds
1441 +1.0f, // maxDepthBounds
1443 const VkPipelineColorBlendAttachmentState colorBlendAttState[]=
1446 VK_FALSE, // blendEnable
1447 VK_BLEND_FACTOR_ONE,
1448 VK_BLEND_FACTOR_ZERO,
1450 VK_BLEND_FACTOR_ONE,
1451 VK_BLEND_FACTOR_ZERO,
1453 VK_COLOR_COMPONENT_R_BIT|VK_COLOR_COMPONENT_G_BIT|VK_COLOR_COMPONENT_B_BIT|VK_COLOR_COMPONENT_A_BIT
1456 const VkPipelineColorBlendStateCreateInfo colorBlendState =
1458 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
1460 (VkPipelineColorBlendStateCreateFlags)0,
1461 VK_FALSE, // logicOpEnable
1463 DE_LENGTH_OF_ARRAY(colorBlendAttState),
1465 { 0.0f, 0.0f, 0.0f, 0.0f } // blendConstants
1467 const VkPipelineDynamicStateCreateInfo dynamicState =
1469 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
1471 (VkPipelineDynamicStateCreateFlags)0,
1472 0u, // dynamicStateCount
1473 DE_NULL, // pDynamicStates
1475 const VkGraphicsPipelineCreateInfo pipelineInfo =
1477 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
1479 (VkPipelineCreateFlags)0,
1480 DE_LENGTH_OF_ARRAY(stages),
1483 &inputAssemblyState,
1484 DE_NULL, // pTessellationState
1492 *res.renderPass.object,
1494 (VkPipeline)0, // basePipelineHandle
1495 0, // basePipelineIndex
1498 return createGraphicsPipeline(env.vkd, env.device, *res.pipelineCache.object, &pipelineInfo, env.allocationCallbacks);
1502 struct ComputePipeline
1504 typedef VkPipeline Type;
1506 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1508 // \todo [2015-09-17 pyry] More interesting configurations
1511 Parameters (void) {}
1516 Dependency<ShaderModule> shaderModule;
1517 Dependency<PipelineLayout> layout;
1518 Dependency<PipelineCache> pipelineCache;
1520 static DescriptorSetLayout::Parameters getDescriptorSetLayout (void)
1522 typedef DescriptorSetLayout::Parameters::Binding Binding;
1524 vector<Binding> bindings;
1526 bindings.push_back(Binding(0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1u, VK_SHADER_STAGE_COMPUTE_BIT, false));
1527 bindings.push_back(Binding(1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1u, VK_SHADER_STAGE_COMPUTE_BIT, false));
1529 return DescriptorSetLayout::Parameters(bindings);
1532 Resources (const Environment& env, const Parameters&)
1533 : shaderModule (env, ShaderModule::Parameters(VK_SHADER_STAGE_COMPUTE_BIT, "comp"))
1534 , layout (env, PipelineLayout::Parameters::singleDescriptorSet(getDescriptorSetLayout()))
1535 , pipelineCache (env, PipelineCache::Parameters())
1539 static void initPrograms (SourceCollections& dst, Parameters)
1541 ShaderModule::initPrograms(dst, ShaderModule::Parameters(VK_SHADER_STAGE_COMPUTE_BIT, "comp"));
1544 static Move<VkPipeline> create (const Environment& env, const Resources& res, const Parameters&)
1546 const VkComputePipelineCreateInfo pipelineInfo =
1548 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
1550 (VkPipelineCreateFlags)0,
1552 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
1554 (VkPipelineShaderStageCreateFlags)0,
1555 VK_SHADER_STAGE_COMPUTE_BIT,
1556 *res.shaderModule.object,
1558 DE_NULL // pSpecializationInfo
1561 (VkPipeline)0, // basePipelineHandle
1562 0u, // basePipelineIndex
1565 return createComputePipeline(env.vkd, env.device, *res.pipelineCache.object, &pipelineInfo, env.allocationCallbacks);
1569 struct DescriptorPool
1571 typedef VkDescriptorPool Type;
1573 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1577 VkDescriptorPoolCreateFlags flags;
1579 vector<VkDescriptorPoolSize> poolSizes;
1581 Parameters (VkDescriptorPoolCreateFlags flags_,
1583 const vector<VkDescriptorPoolSize>& poolSizes_)
1585 , maxSets (maxSets_)
1586 , poolSizes (poolSizes_)
1589 static Parameters singleType (VkDescriptorPoolCreateFlags flags,
1591 VkDescriptorType type,
1594 vector<VkDescriptorPoolSize> poolSizes;
1595 poolSizes.push_back(makeDescriptorPoolSize(type, count));
1596 return Parameters(flags, maxSets, poolSizes);
1602 Resources (const Environment&, const Parameters&) {}
1605 static Move<VkDescriptorPool> create (const Environment& env, const Resources&, const Parameters& params)
1607 const VkDescriptorPoolCreateInfo descriptorPoolInfo =
1609 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
1613 (deUint32)params.poolSizes.size(),
1614 (params.poolSizes.empty() ? DE_NULL : ¶ms.poolSizes[0])
1617 return createDescriptorPool(env.vkd, env.device, &descriptorPoolInfo, env.allocationCallbacks);
1621 struct DescriptorSet
1623 typedef VkDescriptorSet Type;
1625 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1629 DescriptorSetLayout::Parameters descriptorSetLayout;
1631 Parameters (const DescriptorSetLayout::Parameters& descriptorSetLayout_)
1632 : descriptorSetLayout(descriptorSetLayout_)
1638 Dependency<DescriptorPool> descriptorPool;
1639 Dependency<DescriptorSetLayout> descriptorSetLayout;
1641 static vector<VkDescriptorPoolSize> computePoolSizes (const DescriptorSetLayout::Parameters& layout, int maxSets)
1643 deUint32 countByType[VK_DESCRIPTOR_TYPE_LAST];
1644 vector<VkDescriptorPoolSize> typeCounts;
1646 std::fill(DE_ARRAY_BEGIN(countByType), DE_ARRAY_END(countByType), 0u);
1648 for (vector<DescriptorSetLayout::Parameters::Binding>::const_iterator cur = layout.bindings.begin();
1649 cur != layout.bindings.end();
1652 DE_ASSERT((deUint32)cur->descriptorType < VK_DESCRIPTOR_TYPE_LAST);
1653 countByType[cur->descriptorType] += cur->descriptorCount * maxSets;
1656 for (deUint32 type = 0; type < VK_DESCRIPTOR_TYPE_LAST; ++type)
1658 if (countByType[type] > 0)
1659 typeCounts.push_back(makeDescriptorPoolSize((VkDescriptorType)type, countByType[type]));
1665 Resources (const Environment& env, const Parameters& params)
1666 : descriptorPool (env, DescriptorPool::Parameters(VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, env.maxResourceConsumers, computePoolSizes(params.descriptorSetLayout, env.maxResourceConsumers)))
1667 , descriptorSetLayout (env, params.descriptorSetLayout)
1672 static Move<VkDescriptorSet> create (const Environment& env, const Resources& res, const Parameters&)
1674 const VkDescriptorSetAllocateInfo allocateInfo =
1676 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
1678 *res.descriptorPool.object,
1680 &res.descriptorSetLayout.object.get(),
1683 return allocateDescriptorSet(env.vkd, env.device, &allocateInfo);
1689 typedef VkFramebuffer Type;
1691 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1701 Dependency<ImageView> colorAttachment;
1702 Dependency<ImageView> depthStencilAttachment;
1703 Dependency<RenderPass> renderPass;
1705 Resources (const Environment& env, const Parameters&)
1706 : colorAttachment (env, ImageView::Parameters(Image::Parameters(0u, VK_IMAGE_TYPE_2D, VK_FORMAT_R8G8B8A8_UNORM,
1707 makeExtent3D(256, 256, 1),
1709 VK_SAMPLE_COUNT_1_BIT,
1710 VK_IMAGE_TILING_OPTIMAL,
1711 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
1712 VK_IMAGE_LAYOUT_UNDEFINED),
1713 VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_R8G8B8A8_UNORM,
1714 makeComponentMappingRGBA(),
1715 makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u)))
1716 , depthStencilAttachment (env, ImageView::Parameters(Image::Parameters(0u, VK_IMAGE_TYPE_2D, VK_FORMAT_D16_UNORM,
1717 makeExtent3D(256, 256, 1),
1719 VK_SAMPLE_COUNT_1_BIT,
1720 VK_IMAGE_TILING_OPTIMAL,
1721 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
1722 VK_IMAGE_LAYOUT_UNDEFINED),
1723 VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_D16_UNORM,
1724 makeComponentMappingRGBA(),
1725 makeImageSubresourceRange(VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 1u, 0u, 1u)))
1726 , renderPass (env, RenderPass::Parameters())
1730 static Move<VkFramebuffer> create (const Environment& env, const Resources& res, const Parameters&)
1732 const VkImageView attachments[] =
1734 *res.colorAttachment.object,
1735 *res.depthStencilAttachment.object,
1737 const VkFramebufferCreateInfo framebufferInfo =
1739 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
1741 (VkFramebufferCreateFlags)0,
1742 *res.renderPass.object,
1743 (deUint32)DE_LENGTH_OF_ARRAY(attachments),
1750 return createFramebuffer(env.vkd, env.device, &framebufferInfo, env.allocationCallbacks);
1756 typedef VkCommandPool Type;
1758 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1762 VkCommandPoolCreateFlags flags;
1764 Parameters (VkCommandPoolCreateFlags flags_)
1771 Resources (const Environment&, const Parameters&) {}
1774 static Move<VkCommandPool> create (const Environment& env, const Resources&, const Parameters& params)
1776 const VkCommandPoolCreateInfo cmdPoolInfo =
1778 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
1781 env.queueFamilyIndex,
1784 return createCommandPool(env.vkd, env.device, &cmdPoolInfo, env.allocationCallbacks);
1788 struct CommandBuffer
1790 typedef VkCommandBuffer Type;
1792 enum { MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT_OBJECTS };
1796 CommandPool::Parameters commandPool;
1797 VkCommandBufferLevel level;
1799 Parameters (const CommandPool::Parameters& commandPool_,
1800 VkCommandBufferLevel level_)
1801 : commandPool (commandPool_)
1808 Dependency<CommandPool> commandPool;
1810 Resources (const Environment& env, const Parameters& params)
1811 : commandPool(env, params.commandPool)
1815 static Move<VkCommandBuffer> create (const Environment& env, const Resources& res, const Parameters& params)
1817 const VkCommandBufferAllocateInfo cmdBufferInfo =
1819 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
1821 *res.commandPool.object,
1826 return allocateCommandBuffer(env.vkd, env.device, &cmdBufferInfo);
1832 template<typename Object>
1833 tcu::TestStatus createSingleTest (Context& context, typename Object::Parameters params)
1835 const Environment env (context, 1u);
1836 const typename Object::Resources res (env, params);
1839 Unique<typename Object::Type> obj (Object::create(env, res, params));
1842 return tcu::TestStatus::pass("Ok");
1845 template<typename Object>
1846 tcu::TestStatus createMultipleUniqueResourcesTest (Context& context, typename Object::Parameters params)
1848 const Environment env (context, 1u);
1849 const typename Object::Resources res0 (env, params);
1850 const typename Object::Resources res1 (env, params);
1851 const typename Object::Resources res2 (env, params);
1852 const typename Object::Resources res3 (env, params);
1855 Unique<typename Object::Type> obj0 (Object::create(env, res0, params));
1856 Unique<typename Object::Type> obj1 (Object::create(env, res1, params));
1857 Unique<typename Object::Type> obj2 (Object::create(env, res2, params));
1858 Unique<typename Object::Type> obj3 (Object::create(env, res3, params));
1861 return tcu::TestStatus::pass("Ok");
1864 template<typename Object>
1865 tcu::TestStatus createMultipleSharedResourcesTest (Context& context, typename Object::Parameters params)
1867 const Environment env (context, 4u);
1868 const typename Object::Resources res (env, params);
1871 Unique<typename Object::Type> obj0 (Object::create(env, res, params));
1872 Unique<typename Object::Type> obj1 (Object::create(env, res, params));
1873 Unique<typename Object::Type> obj2 (Object::create(env, res, params));
1874 Unique<typename Object::Type> obj3 (Object::create(env, res, params));
1877 return tcu::TestStatus::pass("Ok");
1880 template<typename Object>
1881 tcu::TestStatus createMaxConcurrentTest (Context& context, typename Object::Parameters params)
1883 typedef Unique<typename Object::Type> UniqueObject;
1884 typedef SharedPtr<UniqueObject> ObjectPtr;
1886 const deUint32 numObjects = Object::MAX_CONCURRENT;
1887 const Environment env (context, numObjects);
1888 const typename Object::Resources res (env, params);
1889 vector<ObjectPtr> objects (numObjects);
1891 context.getTestContext().getLog()
1892 << TestLog::Message << "Creating " << numObjects << " " << getTypeName<typename Object::Type>() << "s" << TestLog::EndMessage;
1894 for (deUint32 ndx = 0; ndx < numObjects; ndx++)
1895 objects[ndx] = ObjectPtr(new UniqueObject(Object::create(env, res, params)));
1899 return tcu::TestStatus::pass("Ok");
1902 template<typename Object>
1903 class CreateThread : public ThreadGroupThread
1906 CreateThread (const Environment& env, const typename Object::Resources& resources, const typename Object::Parameters& params)
1908 , m_resources (resources)
1912 void runThread (void)
1914 const int numIters = 100;
1915 const int itersBetweenSyncs = 20;
1917 for (int iterNdx = 0; iterNdx < numIters; iterNdx++)
1919 // Sync every Nth iteration to make entering driver at the same time more likely
1920 if ((iterNdx % itersBetweenSyncs) == 0)
1924 Unique<typename Object::Type> obj (Object::create(m_env, m_resources, m_params));
1930 const Environment& m_env;
1931 const typename Object::Resources& m_resources;
1932 const typename Object::Parameters& m_params;
1935 template<typename Object>
1936 tcu::TestStatus multithreadedCreateSharedResourcesTest (Context& context, typename Object::Parameters params)
1938 const deUint32 numThreads = getDefaultTestThreadCount();
1939 const Environment env (context, numThreads);
1940 const typename Object::Resources res (env, params);
1941 ThreadGroup threads;
1943 for (deUint32 ndx = 0; ndx < numThreads; ndx++)
1944 threads.add(MovePtr<ThreadGroupThread>(new CreateThread<Object>(env, res, params)));
1946 return threads.run();
1949 template<typename Object>
1950 tcu::TestStatus multithreadedCreatePerThreadResourcesTest (Context& context, typename Object::Parameters params)
1952 typedef SharedPtr<typename Object::Resources> ResPtr;
1954 const deUint32 numThreads = getDefaultTestThreadCount();
1955 const Environment env (context, 1u);
1956 vector<ResPtr> resources (numThreads);
1957 ThreadGroup threads;
1959 for (deUint32 ndx = 0; ndx < numThreads; ndx++)
1961 resources[ndx] = ResPtr(new typename Object::Resources(env, params));
1962 threads.add(MovePtr<ThreadGroupThread>(new CreateThread<Object>(env, *resources[ndx], params)));
1965 return threads.run();
1970 Device::Resources deviceRes;
1971 Unique<VkDevice> device;
1975 EnvClone (const Environment& parent, const Device::Parameters& deviceParams, deUint32 maxResourceConsumers)
1976 : deviceRes (parent, deviceParams)
1977 , device (Device::create(parent, deviceRes, deviceParams))
1978 , vkd (deviceRes.vki, *device)
1979 , env (parent.vkp, vkd, *device, deviceRes.queueFamilyIndex, parent.programBinaries, parent.allocationCallbacks, maxResourceConsumers)
1984 Device::Parameters getDefaulDeviceParameters (Context& context)
1986 return Device::Parameters(context.getTestContext().getCommandLine().getVKDeviceId()-1u,
1987 VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_COMPUTE_BIT);
1990 template<typename Object>
1991 tcu::TestStatus multithreadedCreatePerThreadDeviceTest (Context& context, typename Object::Parameters params)
1993 typedef SharedPtr<EnvClone> EnvPtr;
1994 typedef SharedPtr<typename Object::Resources> ResPtr;
1996 const deUint32 numThreads = getDefaultTestThreadCount();
1997 const Device::Parameters deviceParams = getDefaulDeviceParameters(context);
1998 const Environment sharedEnv (context, numThreads); // For creating Device's
1999 vector<EnvPtr> perThreadEnv (numThreads);
2000 vector<ResPtr> resources (numThreads);
2001 ThreadGroup threads;
2003 for (deUint32 ndx = 0; ndx < numThreads; ndx++)
2005 perThreadEnv[ndx] = EnvPtr(new EnvClone(sharedEnv, deviceParams, 1u));
2006 resources[ndx] = ResPtr(new typename Object::Resources(perThreadEnv[ndx]->env, params));
2008 threads.add(MovePtr<ThreadGroupThread>(new CreateThread<Object>(perThreadEnv[ndx]->env, *resources[ndx], params)));
2011 return threads.run();
2014 template<typename Object>
2015 tcu::TestStatus createSingleAllocCallbacksTest (Context& context, typename Object::Parameters params)
2017 const deUint32 noCmdScope = VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE
2018 | VK_SYSTEM_ALLOCATION_SCOPE_DEVICE
2019 | VK_SYSTEM_ALLOCATION_SCOPE_CACHE
2020 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT;
2022 // Callbacks used by resources
2023 AllocationCallbackRecorder resCallbacks (getSystemAllocator(), 128);
2025 // Root environment still uses default instance and device, created without callbacks
2026 const Environment rootEnv (context.getPlatformInterface(),
2027 context.getDeviceInterface(),
2028 context.getDevice(),
2029 context.getUniversalQueueFamilyIndex(),
2030 context.getBinaryCollection(),
2031 resCallbacks.getCallbacks(),
2035 // Test env has instance & device created with callbacks
2036 const EnvClone resEnv (rootEnv, getDefaulDeviceParameters(context), 1u);
2037 const typename Object::Resources res (resEnv.env, params);
2039 // Supply a separate callback recorder just for object construction
2040 AllocationCallbackRecorder objCallbacks(getSystemAllocator(), 128);
2041 const Environment objEnv (resEnv.env.vkp,
2044 resEnv.env.queueFamilyIndex,
2045 resEnv.env.programBinaries,
2046 objCallbacks.getCallbacks(),
2047 resEnv.env.maxResourceConsumers);
2050 Unique<typename Object::Type> obj (Object::create(objEnv, res, params));
2052 // Validate that no command-level allocations are live
2053 if (!validateAndLog(context.getTestContext().getLog(), objCallbacks, noCmdScope))
2054 return tcu::TestStatus::fail("Invalid allocation callback");
2057 // At this point all allocations made against object callbacks must have been freed
2058 if (!validateAndLog(context.getTestContext().getLog(), objCallbacks, 0u))
2059 return tcu::TestStatus::fail("Invalid allocation callback");
2062 if (!validateAndLog(context.getTestContext().getLog(), resCallbacks, 0u))
2063 return tcu::TestStatus::fail("Invalid allocation callback");
2065 return tcu::TestStatus::pass("Ok");
2068 template<typename Object>
2069 tcu::TestStatus allocCallbackFailTest (Context& context, typename Object::Parameters params)
2071 AllocationCallbackRecorder resCallbacks (getSystemAllocator(), 128);
2072 const Environment rootEnv (context.getPlatformInterface(),
2073 context.getDeviceInterface(),
2074 context.getDevice(),
2075 context.getUniversalQueueFamilyIndex(),
2076 context.getBinaryCollection(),
2077 resCallbacks.getCallbacks(),
2081 const EnvClone resEnv (rootEnv, getDefaulDeviceParameters(context), 1u);
2082 const typename Object::Resources res (resEnv.env, params);
2083 deUint32 numPassingAllocs = 0;
2084 const deUint32 maxTries = 1u<<10;
2086 // Iterate over test until object allocation succeeds
2087 for (; numPassingAllocs < maxTries; ++numPassingAllocs)
2089 DeterministicFailAllocator objAllocator(getSystemAllocator(), numPassingAllocs);
2090 AllocationCallbackRecorder recorder (objAllocator.getCallbacks(), 128);
2091 const Environment objEnv (resEnv.env.vkp,
2094 resEnv.env.queueFamilyIndex,
2095 resEnv.env.programBinaries,
2096 recorder.getCallbacks(),
2097 resEnv.env.maxResourceConsumers);
2098 bool createOk = false;
2100 context.getTestContext().getLog()
2102 << "Trying to create object with " << numPassingAllocs << " allocation" << (numPassingAllocs != 1 ? "s" : "") << " passing"
2103 << TestLog::EndMessage;
2107 Unique<typename Object::Type> obj (Object::create(objEnv, res, params));
2110 catch (const vk::OutOfMemoryError& e)
2112 if (e.getError() != VK_ERROR_OUT_OF_HOST_MEMORY)
2114 context.getTestContext().getLog() << e;
2115 return tcu::TestStatus::fail("Got invalid error code");
2119 if (!validateAndLog(context.getTestContext().getLog(), recorder, 0u))
2120 return tcu::TestStatus::fail("Invalid allocation callback");
2124 context.getTestContext().getLog()
2125 << TestLog::Message << "Object construction succeeded! " << TestLog::EndMessage;
2131 if (!validateAndLog(context.getTestContext().getLog(), resCallbacks, 0u))
2132 return tcu::TestStatus::fail("Invalid allocation callback");
2134 return tcu::TestStatus::pass("Ok");
2137 // Utilities for creating groups
2139 template<typename Object>
2140 struct NamedParameters
2143 typename Object::Parameters parameters;
2146 template<typename Object>
2147 struct CaseDescription
2149 typename FunctionInstance1<typename Object::Parameters>::Function function;
2150 const NamedParameters<Object>* paramsBegin;
2151 const NamedParameters<Object>* paramsEnd;
2154 #define EMPTY_CASE_DESC(OBJECT) \
2155 { (FunctionInstance1<OBJECT::Parameters>::Function)DE_NULL, DE_NULL, DE_NULL }
2157 #define CASE_DESC(FUNCTION, CASES) \
2158 { FUNCTION, DE_ARRAY_BEGIN(CASES), DE_ARRAY_END(CASES) }
2160 struct CaseDescriptions
2162 CaseDescription<Instance> instance;
2163 CaseDescription<Device> device;
2164 CaseDescription<DeviceMemory> deviceMemory;
2165 CaseDescription<Buffer> buffer;
2166 CaseDescription<BufferView> bufferView;
2167 CaseDescription<Image> image;
2168 CaseDescription<ImageView> imageView;
2169 CaseDescription<Semaphore> semaphore;
2170 CaseDescription<Event> event;
2171 CaseDescription<Fence> fence;
2172 CaseDescription<QueryPool> queryPool;
2173 CaseDescription<ShaderModule> shaderModule;
2174 CaseDescription<PipelineCache> pipelineCache;
2175 CaseDescription<PipelineLayout> pipelineLayout;
2176 CaseDescription<RenderPass> renderPass;
2177 CaseDescription<GraphicsPipeline> graphicsPipeline;
2178 CaseDescription<ComputePipeline> computePipeline;
2179 CaseDescription<DescriptorSetLayout> descriptorSetLayout;
2180 CaseDescription<Sampler> sampler;
2181 CaseDescription<DescriptorPool> descriptorPool;
2182 CaseDescription<DescriptorSet> descriptorSet;
2183 CaseDescription<Framebuffer> framebuffer;
2184 CaseDescription<CommandPool> commandPool;
2185 CaseDescription<CommandBuffer> commandBuffer;
2188 template<typename Object>
2189 void addCases (const MovePtr<tcu::TestCaseGroup>& group, const CaseDescription<Object>& cases)
2191 for (const NamedParameters<Object>* cur = cases.paramsBegin; cur != cases.paramsEnd; ++cur)
2192 addFunctionCase(group.get(), cur->name, "", cases.function, cur->parameters);
2195 template<typename Object>
2196 void addCasesWithProgs (const MovePtr<tcu::TestCaseGroup>& group, const CaseDescription<Object>& cases)
2198 for (const NamedParameters<Object>* cur = cases.paramsBegin; cur != cases.paramsEnd; ++cur)
2199 addFunctionCaseWithPrograms(group.get(), cur->name, "", Object::initPrograms, cases.function, cur->parameters);
2202 tcu::TestCaseGroup* createGroup (tcu::TestContext& testCtx, const char* name, const char* desc, const CaseDescriptions& cases)
2204 MovePtr<tcu::TestCaseGroup> group (new tcu::TestCaseGroup(testCtx, name, desc));
2206 addCases (group, cases.instance);
2207 addCases (group, cases.device);
2208 addCases (group, cases.deviceMemory);
2209 addCases (group, cases.buffer);
2210 addCases (group, cases.bufferView);
2211 addCases (group, cases.image);
2212 addCases (group, cases.imageView);
2213 addCases (group, cases.semaphore);
2214 addCases (group, cases.event);
2215 addCases (group, cases.fence);
2216 addCases (group, cases.queryPool);
2217 addCases (group, cases.sampler);
2218 addCasesWithProgs (group, cases.shaderModule);
2219 addCases (group, cases.pipelineCache);
2220 addCases (group, cases.pipelineLayout);
2221 addCases (group, cases.renderPass);
2222 addCasesWithProgs (group, cases.graphicsPipeline);
2223 addCasesWithProgs (group, cases.computePipeline);
2224 addCases (group, cases.descriptorSetLayout);
2225 addCases (group, cases.descriptorPool);
2226 addCases (group, cases.descriptorSet);
2227 addCases (group, cases.framebuffer);
2228 addCases (group, cases.commandPool);
2229 addCases (group, cases.commandBuffer);
2231 return group.release();
2236 tcu::TestCaseGroup* createObjectManagementTests (tcu::TestContext& testCtx)
2238 MovePtr<tcu::TestCaseGroup> objectMgmtTests (new tcu::TestCaseGroup(testCtx, "object_management", "Object management tests"));
2240 const Image::Parameters img1D (0u, VK_IMAGE_TYPE_1D, VK_FORMAT_R8G8B8A8_UNORM, makeExtent3D(256, 1, 1), 1u, 4u, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT, VK_IMAGE_LAYOUT_UNDEFINED);
2241 const Image::Parameters img2D (0u, VK_IMAGE_TYPE_2D, VK_FORMAT_R8G8B8A8_UNORM, makeExtent3D( 64, 64, 1), 1u, 12u, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_IMAGE_LAYOUT_UNDEFINED);
2242 const Image::Parameters imgCube (VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, VK_IMAGE_TYPE_2D, VK_FORMAT_R8G8B8A8_UNORM, makeExtent3D( 64, 64, 1), 1u, 12u, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_IMAGE_LAYOUT_UNDEFINED);
2243 const Image::Parameters img3D (0u, VK_IMAGE_TYPE_3D, VK_FORMAT_R8G8B8A8_UNORM, makeExtent3D( 64, 64, 4), 1u, 1u, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT, VK_IMAGE_LAYOUT_UNDEFINED);
2244 const ImageView::Parameters imgView1D (img1D, VK_IMAGE_VIEW_TYPE_1D, img1D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u));
2245 const ImageView::Parameters imgView1DArr (img1D, VK_IMAGE_VIEW_TYPE_1D_ARRAY, img1D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 4u));
2246 const ImageView::Parameters imgView2D (img2D, VK_IMAGE_VIEW_TYPE_2D, img2D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u));
2247 const ImageView::Parameters imgView2DArr (img2D, VK_IMAGE_VIEW_TYPE_2D_ARRAY, img2D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 8u));
2248 const ImageView::Parameters imgViewCube (imgCube, VK_IMAGE_VIEW_TYPE_CUBE, img2D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 6u));
2249 const ImageView::Parameters imgViewCubeArr (imgCube, VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, img2D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 12u));
2250 const ImageView::Parameters imgView3D (img3D, VK_IMAGE_VIEW_TYPE_3D, img3D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u));
2252 const DescriptorSetLayout::Parameters singleUboDescLayout = DescriptorSetLayout::Parameters::single(0u, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1u, VK_SHADER_STAGE_VERTEX_BIT);
2254 static NamedParameters<Instance> s_instanceCases[] =
2256 { "instance", Instance::Parameters() },
2258 // \note Device index may change - must not be static
2259 const NamedParameters<Device> s_deviceCases[] =
2261 { "device", Device::Parameters(testCtx.getCommandLine().getVKDeviceId()-1u, VK_QUEUE_GRAPHICS_BIT) },
2263 static const NamedParameters<DeviceMemory> s_deviceMemCases[] =
2265 { "device_memory_small", DeviceMemory::Parameters(1024, 0u) },
2267 static const NamedParameters<Buffer> s_bufferCases[] =
2269 { "buffer_uniform_small", Buffer::Parameters(1024u, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT), },
2270 { "buffer_uniform_large", Buffer::Parameters(1024u*1024u*16u, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT), },
2271 { "buffer_storage_small", Buffer::Parameters(1024u, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), },
2272 { "buffer_storage_large", Buffer::Parameters(1024u*1024u*16u, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), },
2274 static const NamedParameters<BufferView> s_bufferViewCases[] =
2276 { "buffer_view_uniform_r8g8b8a8_unorm", BufferView::Parameters(Buffer::Parameters(8192u, VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT), VK_FORMAT_R8G8B8A8_UNORM, 0u, 4096u) },
2277 { "buffer_view_storage_r8g8b8a8_unorm", BufferView::Parameters(Buffer::Parameters(8192u, VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT), VK_FORMAT_R8G8B8A8_UNORM, 0u, 4096u) },
2279 static const NamedParameters<Image> s_imageCases[] =
2281 { "image_1d", img1D },
2282 { "image_2d", img2D },
2283 { "image_3d", img3D },
2285 static const NamedParameters<ImageView> s_imageViewCases[] =
2287 { "image_view_1d", imgView1D },
2288 { "image_view_1d_arr", imgView1DArr },
2289 { "image_view_2d", imgView2D },
2290 { "image_view_2d_arr", imgView2DArr },
2291 { "image_view_cube", imgViewCube },
2292 { "image_view_cube_arr", imgViewCubeArr },
2293 { "image_view_3d", imgView3D },
2295 static const NamedParameters<Semaphore> s_semaphoreCases[] =
2297 { "semaphore", Semaphore::Parameters(0u), }
2299 static const NamedParameters<Event> s_eventCases[] =
2301 { "event", Event::Parameters(0u) }
2303 static const NamedParameters<Fence> s_fenceCases[] =
2305 { "fence", Fence::Parameters(0u) },
2306 { "fence_signaled", Fence::Parameters(VK_FENCE_CREATE_SIGNALED_BIT) }
2308 static const NamedParameters<QueryPool> s_queryPoolCases[] =
2310 { "query_pool", QueryPool::Parameters(VK_QUERY_TYPE_OCCLUSION, 1u, 0u) }
2312 static const NamedParameters<ShaderModule> s_shaderModuleCases[] =
2314 { "shader_module", ShaderModule::Parameters(VK_SHADER_STAGE_COMPUTE_BIT, "test") }
2316 static const NamedParameters<PipelineCache> s_pipelineCacheCases[] =
2318 { "pipeline_cache", PipelineCache::Parameters() }
2320 static const NamedParameters<PipelineLayout> s_pipelineLayoutCases[] =
2322 { "pipeline_layout_empty", PipelineLayout::Parameters::empty() },
2323 { "pipeline_layout_single", PipelineLayout::Parameters::singleDescriptorSet(singleUboDescLayout) }
2325 static const NamedParameters<RenderPass> s_renderPassCases[] =
2327 { "render_pass", RenderPass::Parameters() }
2329 static const NamedParameters<GraphicsPipeline> s_graphicsPipelineCases[] =
2331 { "graphics_pipeline", GraphicsPipeline::Parameters() }
2333 static const NamedParameters<ComputePipeline> s_computePipelineCases[] =
2335 { "compute_pipeline", ComputePipeline::Parameters() }
2337 static const NamedParameters<DescriptorSetLayout> s_descriptorSetLayoutCases[] =
2339 { "descriptor_set_layout_empty", DescriptorSetLayout::Parameters::empty() },
2340 { "descriptor_set_layout_single", singleUboDescLayout }
2342 static const NamedParameters<Sampler> s_samplerCases[] =
2344 { "sampler", Sampler::Parameters() }
2346 static const NamedParameters<DescriptorPool> s_descriptorPoolCases[] =
2348 { "descriptor_pool", DescriptorPool::Parameters::singleType((VkDescriptorPoolCreateFlags)0, 4u, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3u) },
2349 { "descriptor_pool_free_descriptor_set", DescriptorPool::Parameters::singleType(VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 4u, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3u) }
2351 static const NamedParameters<DescriptorSet> s_descriptorSetCases[] =
2353 { "descriptor_set", DescriptorSet::Parameters(singleUboDescLayout) }
2355 static const NamedParameters<Framebuffer> s_framebufferCases[] =
2357 { "framebuffer", Framebuffer::Parameters() }
2359 static const NamedParameters<CommandPool> s_commandPoolCases[] =
2361 { "command_pool", CommandPool::Parameters((VkCommandPoolCreateFlags)0) },
2362 { "command_pool_transient", CommandPool::Parameters(VK_COMMAND_POOL_CREATE_TRANSIENT_BIT) }
2364 static const NamedParameters<CommandBuffer> s_commandBufferCases[] =
2366 { "command_buffer_primary", CommandBuffer::Parameters(CommandPool::Parameters((VkCommandPoolCreateFlags)0u), VK_COMMAND_BUFFER_LEVEL_PRIMARY) },
2367 { "command_buffer_secondary", CommandBuffer::Parameters(CommandPool::Parameters((VkCommandPoolCreateFlags)0u), VK_COMMAND_BUFFER_LEVEL_SECONDARY) }
2370 static const CaseDescriptions s_createSingleGroup =
2372 CASE_DESC(createSingleTest <Instance>, s_instanceCases),
2373 CASE_DESC(createSingleTest <Device>, s_deviceCases),
2374 CASE_DESC(createSingleTest <DeviceMemory>, s_deviceMemCases),
2375 CASE_DESC(createSingleTest <Buffer>, s_bufferCases),
2376 CASE_DESC(createSingleTest <BufferView>, s_bufferViewCases),
2377 CASE_DESC(createSingleTest <Image>, s_imageCases),
2378 CASE_DESC(createSingleTest <ImageView>, s_imageViewCases),
2379 CASE_DESC(createSingleTest <Semaphore>, s_semaphoreCases),
2380 CASE_DESC(createSingleTest <Event>, s_eventCases),
2381 CASE_DESC(createSingleTest <Fence>, s_fenceCases),
2382 CASE_DESC(createSingleTest <QueryPool>, s_queryPoolCases),
2383 CASE_DESC(createSingleTest <ShaderModule>, s_shaderModuleCases),
2384 CASE_DESC(createSingleTest <PipelineCache>, s_pipelineCacheCases),
2385 CASE_DESC(createSingleTest <PipelineLayout>, s_pipelineLayoutCases),
2386 CASE_DESC(createSingleTest <RenderPass>, s_renderPassCases),
2387 CASE_DESC(createSingleTest <GraphicsPipeline>, s_graphicsPipelineCases),
2388 CASE_DESC(createSingleTest <ComputePipeline>, s_computePipelineCases),
2389 CASE_DESC(createSingleTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2390 CASE_DESC(createSingleTest <Sampler>, s_samplerCases),
2391 CASE_DESC(createSingleTest <DescriptorPool>, s_descriptorPoolCases),
2392 CASE_DESC(createSingleTest <DescriptorSet>, s_descriptorSetCases),
2393 CASE_DESC(createSingleTest <Framebuffer>, s_framebufferCases),
2394 CASE_DESC(createSingleTest <CommandPool>, s_commandPoolCases),
2395 CASE_DESC(createSingleTest <CommandBuffer>, s_commandBufferCases),
2397 objectMgmtTests->addChild(createGroup(testCtx, "single", "Create single object", s_createSingleGroup));
2399 static const CaseDescriptions s_createMultipleUniqueResourcesGroup =
2401 CASE_DESC(createMultipleUniqueResourcesTest <Instance>, s_instanceCases),
2402 CASE_DESC(createMultipleUniqueResourcesTest <Device>, s_deviceCases),
2403 CASE_DESC(createMultipleUniqueResourcesTest <DeviceMemory>, s_deviceMemCases),
2404 CASE_DESC(createMultipleUniqueResourcesTest <Buffer>, s_bufferCases),
2405 CASE_DESC(createMultipleUniqueResourcesTest <BufferView>, s_bufferViewCases),
2406 CASE_DESC(createMultipleUniqueResourcesTest <Image>, s_imageCases),
2407 CASE_DESC(createMultipleUniqueResourcesTest <ImageView>, s_imageViewCases),
2408 CASE_DESC(createMultipleUniqueResourcesTest <Semaphore>, s_semaphoreCases),
2409 CASE_DESC(createMultipleUniqueResourcesTest <Event>, s_eventCases),
2410 CASE_DESC(createMultipleUniqueResourcesTest <Fence>, s_fenceCases),
2411 CASE_DESC(createMultipleUniqueResourcesTest <QueryPool>, s_queryPoolCases),
2412 CASE_DESC(createMultipleUniqueResourcesTest <ShaderModule>, s_shaderModuleCases),
2413 CASE_DESC(createMultipleUniqueResourcesTest <PipelineCache>, s_pipelineCacheCases),
2414 CASE_DESC(createMultipleUniqueResourcesTest <PipelineLayout>, s_pipelineLayoutCases),
2415 CASE_DESC(createMultipleUniqueResourcesTest <RenderPass>, s_renderPassCases),
2416 CASE_DESC(createMultipleUniqueResourcesTest <GraphicsPipeline>, s_graphicsPipelineCases),
2417 CASE_DESC(createMultipleUniqueResourcesTest <ComputePipeline>, s_computePipelineCases),
2418 CASE_DESC(createMultipleUniqueResourcesTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2419 CASE_DESC(createMultipleUniqueResourcesTest <Sampler>, s_samplerCases),
2420 CASE_DESC(createMultipleUniqueResourcesTest <DescriptorPool>, s_descriptorPoolCases),
2421 CASE_DESC(createMultipleUniqueResourcesTest <DescriptorSet>, s_descriptorSetCases),
2422 CASE_DESC(createMultipleUniqueResourcesTest <Framebuffer>, s_framebufferCases),
2423 CASE_DESC(createMultipleUniqueResourcesTest <CommandPool>, s_commandPoolCases),
2424 CASE_DESC(createMultipleUniqueResourcesTest <CommandBuffer>, s_commandBufferCases),
2426 objectMgmtTests->addChild(createGroup(testCtx, "multiple_unique_resources", "Multiple objects with per-object unique resources", s_createMultipleUniqueResourcesGroup));
2428 static const CaseDescriptions s_createMultipleSharedResourcesGroup =
2430 EMPTY_CASE_DESC(Instance), // No resources used
2431 CASE_DESC(createMultipleSharedResourcesTest <Device>, s_deviceCases),
2432 CASE_DESC(createMultipleSharedResourcesTest <DeviceMemory>, s_deviceMemCases),
2433 CASE_DESC(createMultipleSharedResourcesTest <Buffer>, s_bufferCases),
2434 CASE_DESC(createMultipleSharedResourcesTest <BufferView>, s_bufferViewCases),
2435 CASE_DESC(createMultipleSharedResourcesTest <Image>, s_imageCases),
2436 CASE_DESC(createMultipleSharedResourcesTest <ImageView>, s_imageViewCases),
2437 CASE_DESC(createMultipleSharedResourcesTest <Semaphore>, s_semaphoreCases),
2438 CASE_DESC(createMultipleSharedResourcesTest <Event>, s_eventCases),
2439 CASE_DESC(createMultipleSharedResourcesTest <Fence>, s_fenceCases),
2440 CASE_DESC(createMultipleSharedResourcesTest <QueryPool>, s_queryPoolCases),
2441 CASE_DESC(createMultipleSharedResourcesTest <ShaderModule>, s_shaderModuleCases),
2442 CASE_DESC(createMultipleSharedResourcesTest <PipelineCache>, s_pipelineCacheCases),
2443 CASE_DESC(createMultipleSharedResourcesTest <PipelineLayout>, s_pipelineLayoutCases),
2444 CASE_DESC(createMultipleSharedResourcesTest <RenderPass>, s_renderPassCases),
2445 CASE_DESC(createMultipleSharedResourcesTest <GraphicsPipeline>, s_graphicsPipelineCases),
2446 CASE_DESC(createMultipleSharedResourcesTest <ComputePipeline>, s_computePipelineCases),
2447 CASE_DESC(createMultipleSharedResourcesTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2448 CASE_DESC(createMultipleSharedResourcesTest <Sampler>, s_samplerCases),
2449 CASE_DESC(createMultipleSharedResourcesTest <DescriptorPool>, s_descriptorPoolCases),
2450 CASE_DESC(createMultipleSharedResourcesTest <DescriptorSet>, s_descriptorSetCases),
2451 CASE_DESC(createMultipleSharedResourcesTest <Framebuffer>, s_framebufferCases),
2452 CASE_DESC(createMultipleSharedResourcesTest <CommandPool>, s_commandPoolCases),
2453 CASE_DESC(createMultipleSharedResourcesTest <CommandBuffer>, s_commandBufferCases),
2455 objectMgmtTests->addChild(createGroup(testCtx, "multiple_shared_resources", "Multiple objects with shared resources", s_createMultipleSharedResourcesGroup));
2457 static const CaseDescriptions s_createMaxConcurrentGroup =
2459 CASE_DESC(createMaxConcurrentTest <Instance>, s_instanceCases),
2460 CASE_DESC(createMaxConcurrentTest <Device>, s_deviceCases),
2461 CASE_DESC(createMaxConcurrentTest <DeviceMemory>, s_deviceMemCases),
2462 CASE_DESC(createMaxConcurrentTest <Buffer>, s_bufferCases),
2463 CASE_DESC(createMaxConcurrentTest <BufferView>, s_bufferViewCases),
2464 CASE_DESC(createMaxConcurrentTest <Image>, s_imageCases),
2465 CASE_DESC(createMaxConcurrentTest <ImageView>, s_imageViewCases),
2466 CASE_DESC(createMaxConcurrentTest <Semaphore>, s_semaphoreCases),
2467 CASE_DESC(createMaxConcurrentTest <Event>, s_eventCases),
2468 CASE_DESC(createMaxConcurrentTest <Fence>, s_fenceCases),
2469 CASE_DESC(createMaxConcurrentTest <QueryPool>, s_queryPoolCases),
2470 CASE_DESC(createMaxConcurrentTest <ShaderModule>, s_shaderModuleCases),
2471 CASE_DESC(createMaxConcurrentTest <PipelineCache>, s_pipelineCacheCases),
2472 CASE_DESC(createMaxConcurrentTest <PipelineLayout>, s_pipelineLayoutCases),
2473 CASE_DESC(createMaxConcurrentTest <RenderPass>, s_renderPassCases),
2474 CASE_DESC(createMaxConcurrentTest <GraphicsPipeline>, s_graphicsPipelineCases),
2475 CASE_DESC(createMaxConcurrentTest <ComputePipeline>, s_computePipelineCases),
2476 CASE_DESC(createMaxConcurrentTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2477 CASE_DESC(createMaxConcurrentTest <Sampler>, s_samplerCases),
2478 CASE_DESC(createMaxConcurrentTest <DescriptorPool>, s_descriptorPoolCases),
2479 CASE_DESC(createMaxConcurrentTest <DescriptorSet>, s_descriptorSetCases),
2480 CASE_DESC(createMaxConcurrentTest <Framebuffer>, s_framebufferCases),
2481 CASE_DESC(createMaxConcurrentTest <CommandPool>, s_commandPoolCases),
2482 CASE_DESC(createMaxConcurrentTest <CommandBuffer>, s_commandBufferCases),
2484 objectMgmtTests->addChild(createGroup(testCtx, "max_concurrent", "Maximum number of concurrently live objects", s_createMaxConcurrentGroup));
2486 static const CaseDescriptions s_multithreadedCreatePerThreadDeviceGroup =
2488 EMPTY_CASE_DESC(Instance), // Does not make sense
2489 EMPTY_CASE_DESC(Device), // Does not make sense
2490 CASE_DESC(multithreadedCreatePerThreadDeviceTest <DeviceMemory>, s_deviceMemCases),
2491 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Buffer>, s_bufferCases),
2492 CASE_DESC(multithreadedCreatePerThreadDeviceTest <BufferView>, s_bufferViewCases),
2493 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Image>, s_imageCases),
2494 CASE_DESC(multithreadedCreatePerThreadDeviceTest <ImageView>, s_imageViewCases),
2495 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Semaphore>, s_semaphoreCases),
2496 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Event>, s_eventCases),
2497 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Fence>, s_fenceCases),
2498 CASE_DESC(multithreadedCreatePerThreadDeviceTest <QueryPool>, s_queryPoolCases),
2499 CASE_DESC(multithreadedCreatePerThreadDeviceTest <ShaderModule>, s_shaderModuleCases),
2500 CASE_DESC(multithreadedCreatePerThreadDeviceTest <PipelineCache>, s_pipelineCacheCases),
2501 CASE_DESC(multithreadedCreatePerThreadDeviceTest <PipelineLayout>, s_pipelineLayoutCases),
2502 CASE_DESC(multithreadedCreatePerThreadDeviceTest <RenderPass>, s_renderPassCases),
2503 CASE_DESC(multithreadedCreatePerThreadDeviceTest <GraphicsPipeline>, s_graphicsPipelineCases),
2504 CASE_DESC(multithreadedCreatePerThreadDeviceTest <ComputePipeline>, s_computePipelineCases),
2505 CASE_DESC(multithreadedCreatePerThreadDeviceTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2506 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Sampler>, s_samplerCases),
2507 CASE_DESC(multithreadedCreatePerThreadDeviceTest <DescriptorPool>, s_descriptorPoolCases),
2508 CASE_DESC(multithreadedCreatePerThreadDeviceTest <DescriptorSet>, s_descriptorSetCases),
2509 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Framebuffer>, s_framebufferCases),
2510 CASE_DESC(multithreadedCreatePerThreadDeviceTest <CommandPool>, s_commandPoolCases),
2511 CASE_DESC(multithreadedCreatePerThreadDeviceTest <CommandBuffer>, s_commandBufferCases),
2513 objectMgmtTests->addChild(createGroup(testCtx, "multithreaded_per_thread_device", "Multithreaded object construction with per-thread device ", s_multithreadedCreatePerThreadDeviceGroup));
2515 static const CaseDescriptions s_multithreadedCreatePerThreadResourcesGroup =
2517 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Instance>, s_instanceCases),
2518 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Device>, s_deviceCases),
2519 CASE_DESC(multithreadedCreatePerThreadResourcesTest <DeviceMemory>, s_deviceMemCases),
2520 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Buffer>, s_bufferCases),
2521 CASE_DESC(multithreadedCreatePerThreadResourcesTest <BufferView>, s_bufferViewCases),
2522 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Image>, s_imageCases),
2523 CASE_DESC(multithreadedCreatePerThreadResourcesTest <ImageView>, s_imageViewCases),
2524 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Semaphore>, s_semaphoreCases),
2525 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Event>, s_eventCases),
2526 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Fence>, s_fenceCases),
2527 CASE_DESC(multithreadedCreatePerThreadResourcesTest <QueryPool>, s_queryPoolCases),
2528 CASE_DESC(multithreadedCreatePerThreadResourcesTest <ShaderModule>, s_shaderModuleCases),
2529 CASE_DESC(multithreadedCreatePerThreadResourcesTest <PipelineCache>, s_pipelineCacheCases),
2530 CASE_DESC(multithreadedCreatePerThreadResourcesTest <PipelineLayout>, s_pipelineLayoutCases),
2531 CASE_DESC(multithreadedCreatePerThreadResourcesTest <RenderPass>, s_renderPassCases),
2532 CASE_DESC(multithreadedCreatePerThreadResourcesTest <GraphicsPipeline>, s_graphicsPipelineCases),
2533 CASE_DESC(multithreadedCreatePerThreadResourcesTest <ComputePipeline>, s_computePipelineCases),
2534 CASE_DESC(multithreadedCreatePerThreadResourcesTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2535 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Sampler>, s_samplerCases),
2536 CASE_DESC(multithreadedCreatePerThreadResourcesTest <DescriptorPool>, s_descriptorPoolCases),
2537 CASE_DESC(multithreadedCreatePerThreadResourcesTest <DescriptorSet>, s_descriptorSetCases),
2538 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Framebuffer>, s_framebufferCases),
2539 CASE_DESC(multithreadedCreatePerThreadResourcesTest <CommandPool>, s_commandPoolCases),
2540 CASE_DESC(multithreadedCreatePerThreadResourcesTest <CommandBuffer>, s_commandBufferCases),
2542 objectMgmtTests->addChild(createGroup(testCtx, "multithreaded_per_thread_resources", "Multithreaded object construction with per-thread resources", s_multithreadedCreatePerThreadResourcesGroup));
2544 static const CaseDescriptions s_multithreadedCreateSharedResourcesGroup =
2546 EMPTY_CASE_DESC(Instance),
2547 CASE_DESC(multithreadedCreateSharedResourcesTest <Device>, s_deviceCases),
2548 CASE_DESC(multithreadedCreateSharedResourcesTest <DeviceMemory>, s_deviceMemCases),
2549 CASE_DESC(multithreadedCreateSharedResourcesTest <Buffer>, s_bufferCases),
2550 CASE_DESC(multithreadedCreateSharedResourcesTest <BufferView>, s_bufferViewCases),
2551 CASE_DESC(multithreadedCreateSharedResourcesTest <Image>, s_imageCases),
2552 CASE_DESC(multithreadedCreateSharedResourcesTest <ImageView>, s_imageViewCases),
2553 CASE_DESC(multithreadedCreateSharedResourcesTest <Semaphore>, s_semaphoreCases),
2554 CASE_DESC(multithreadedCreateSharedResourcesTest <Event>, s_eventCases),
2555 CASE_DESC(multithreadedCreateSharedResourcesTest <Fence>, s_fenceCases),
2556 CASE_DESC(multithreadedCreateSharedResourcesTest <QueryPool>, s_queryPoolCases),
2557 CASE_DESC(multithreadedCreateSharedResourcesTest <ShaderModule>, s_shaderModuleCases),
2558 CASE_DESC(multithreadedCreateSharedResourcesTest <PipelineCache>, s_pipelineCacheCases),
2559 CASE_DESC(multithreadedCreateSharedResourcesTest <PipelineLayout>, s_pipelineLayoutCases),
2560 CASE_DESC(multithreadedCreateSharedResourcesTest <RenderPass>, s_renderPassCases),
2561 CASE_DESC(multithreadedCreateSharedResourcesTest <GraphicsPipeline>, s_graphicsPipelineCases),
2562 CASE_DESC(multithreadedCreateSharedResourcesTest <ComputePipeline>, s_computePipelineCases),
2563 CASE_DESC(multithreadedCreateSharedResourcesTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2564 CASE_DESC(multithreadedCreateSharedResourcesTest <Sampler>, s_samplerCases),
2565 CASE_DESC(multithreadedCreateSharedResourcesTest <DescriptorPool>, s_descriptorPoolCases),
2566 EMPTY_CASE_DESC(DescriptorSet), // \note Needs per-thread DescriptorPool
2567 CASE_DESC(multithreadedCreateSharedResourcesTest <Framebuffer>, s_framebufferCases),
2568 CASE_DESC(multithreadedCreateSharedResourcesTest <CommandPool>, s_commandPoolCases),
2569 EMPTY_CASE_DESC(CommandBuffer), // \note Needs per-thread CommandPool
2571 objectMgmtTests->addChild(createGroup(testCtx, "multithreaded_shared_resources", "Multithreaded object construction with shared resources", s_multithreadedCreateSharedResourcesGroup));
2573 static const CaseDescriptions s_createSingleAllocCallbacksGroup =
2575 CASE_DESC(createSingleAllocCallbacksTest <Instance>, s_instanceCases),
2576 CASE_DESC(createSingleAllocCallbacksTest <Device>, s_deviceCases),
2577 CASE_DESC(createSingleAllocCallbacksTest <DeviceMemory>, s_deviceMemCases),
2578 CASE_DESC(createSingleAllocCallbacksTest <Buffer>, s_bufferCases),
2579 CASE_DESC(createSingleAllocCallbacksTest <BufferView>, s_bufferViewCases),
2580 CASE_DESC(createSingleAllocCallbacksTest <Image>, s_imageCases),
2581 CASE_DESC(createSingleAllocCallbacksTest <ImageView>, s_imageViewCases),
2582 CASE_DESC(createSingleAllocCallbacksTest <Semaphore>, s_semaphoreCases),
2583 CASE_DESC(createSingleAllocCallbacksTest <Event>, s_eventCases),
2584 CASE_DESC(createSingleAllocCallbacksTest <Fence>, s_fenceCases),
2585 CASE_DESC(createSingleAllocCallbacksTest <QueryPool>, s_queryPoolCases),
2586 CASE_DESC(createSingleAllocCallbacksTest <ShaderModule>, s_shaderModuleCases),
2587 CASE_DESC(createSingleAllocCallbacksTest <PipelineCache>, s_pipelineCacheCases),
2588 CASE_DESC(createSingleAllocCallbacksTest <PipelineLayout>, s_pipelineLayoutCases),
2589 CASE_DESC(createSingleAllocCallbacksTest <RenderPass>, s_renderPassCases),
2590 CASE_DESC(createSingleAllocCallbacksTest <GraphicsPipeline>, s_graphicsPipelineCases),
2591 CASE_DESC(createSingleAllocCallbacksTest <ComputePipeline>, s_computePipelineCases),
2592 CASE_DESC(createSingleAllocCallbacksTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2593 CASE_DESC(createSingleAllocCallbacksTest <Sampler>, s_samplerCases),
2594 CASE_DESC(createSingleAllocCallbacksTest <DescriptorPool>, s_descriptorPoolCases),
2595 CASE_DESC(createSingleAllocCallbacksTest <DescriptorSet>, s_descriptorSetCases),
2596 CASE_DESC(createSingleAllocCallbacksTest <Framebuffer>, s_framebufferCases),
2597 CASE_DESC(createSingleAllocCallbacksTest <CommandPool>, s_commandPoolCases),
2598 CASE_DESC(createSingleAllocCallbacksTest <CommandBuffer>, s_commandBufferCases),
2600 objectMgmtTests->addChild(createGroup(testCtx, "single_alloc_callbacks", "Create single object", s_createSingleAllocCallbacksGroup));
2602 static const CaseDescriptions s_allocCallbackFailGroup =
2604 CASE_DESC(allocCallbackFailTest <Instance>, s_instanceCases),
2605 CASE_DESC(allocCallbackFailTest <Device>, s_deviceCases),
2606 CASE_DESC(allocCallbackFailTest <DeviceMemory>, s_deviceMemCases),
2607 CASE_DESC(allocCallbackFailTest <Buffer>, s_bufferCases),
2608 CASE_DESC(allocCallbackFailTest <BufferView>, s_bufferViewCases),
2609 CASE_DESC(allocCallbackFailTest <Image>, s_imageCases),
2610 CASE_DESC(allocCallbackFailTest <ImageView>, s_imageViewCases),
2611 CASE_DESC(allocCallbackFailTest <Semaphore>, s_semaphoreCases),
2612 CASE_DESC(allocCallbackFailTest <Event>, s_eventCases),
2613 CASE_DESC(allocCallbackFailTest <Fence>, s_fenceCases),
2614 CASE_DESC(allocCallbackFailTest <QueryPool>, s_queryPoolCases),
2615 CASE_DESC(allocCallbackFailTest <ShaderModule>, s_shaderModuleCases),
2616 CASE_DESC(allocCallbackFailTest <PipelineCache>, s_pipelineCacheCases),
2617 CASE_DESC(allocCallbackFailTest <PipelineLayout>, s_pipelineLayoutCases),
2618 CASE_DESC(allocCallbackFailTest <RenderPass>, s_renderPassCases),
2619 CASE_DESC(allocCallbackFailTest <GraphicsPipeline>, s_graphicsPipelineCases),
2620 CASE_DESC(allocCallbackFailTest <ComputePipeline>, s_computePipelineCases),
2621 CASE_DESC(allocCallbackFailTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2622 CASE_DESC(allocCallbackFailTest <Sampler>, s_samplerCases),
2623 CASE_DESC(allocCallbackFailTest <DescriptorPool>, s_descriptorPoolCases),
2624 CASE_DESC(allocCallbackFailTest <DescriptorSet>, s_descriptorSetCases),
2625 CASE_DESC(allocCallbackFailTest <Framebuffer>, s_framebufferCases),
2626 CASE_DESC(allocCallbackFailTest <CommandPool>, s_commandPoolCases),
2627 CASE_DESC(allocCallbackFailTest <CommandBuffer>, s_commandBufferCases),
2629 objectMgmtTests->addChild(createGroup(testCtx, "alloc_callback_fail", "Allocation callback failure", s_allocCallbackFailGroup));
2631 return objectMgmtTests.release();