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 static deUint32 getMaxConcurrent (Context&)
308 Resources (const Environment&, const Parameters&) {}
311 static Move<VkInstance> create (const Environment& env, const Resources&, const Parameters&)
313 const VkApplicationInfo appInfo =
315 VK_STRUCTURE_TYPE_APPLICATION_INFO,
317 DE_NULL, // pApplicationName
318 0u, // applicationVersion
319 DE_NULL, // pEngineName
323 const VkInstanceCreateInfo instanceInfo =
325 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
327 (VkInstanceCreateFlags)0,
329 0u, // enabledLayerNameCount
330 DE_NULL, // ppEnabledLayerNames
331 0u, // enabledExtensionNameCount
332 DE_NULL, // ppEnabledExtensionNames
335 return createInstance(env.vkp, &instanceInfo, env.allocationCallbacks);
341 typedef VkDevice Type;
343 static deUint32 getMaxConcurrent (Context&)
350 deUint32 deviceIndex;
351 VkQueueFlags queueFlags;
353 Parameters (deUint32 deviceIndex_, VkQueueFlags queueFlags_)
354 : deviceIndex (deviceIndex_)
355 , queueFlags (queueFlags_)
361 Dependency<Instance> instance;
363 VkPhysicalDevice physicalDevice;
364 deUint32 queueFamilyIndex;
366 Resources (const Environment& env, const Parameters& params)
367 : instance (env, Instance::Parameters())
368 , vki (env.vkp, *instance.object)
370 , queueFamilyIndex (~0u)
373 const vector<VkPhysicalDevice> physicalDevices = enumeratePhysicalDevices(vki, *instance.object);
375 if (physicalDevices.size() <= (size_t)params.deviceIndex)
376 TCU_THROW(NotSupportedError, "Device not found");
378 physicalDevice = physicalDevices[params.deviceIndex];
382 const vector<VkQueueFamilyProperties> queueProps = getPhysicalDeviceQueueFamilyProperties(vki, physicalDevice);
383 bool foundMatching = false;
385 for (size_t curQueueNdx = 0; curQueueNdx < queueProps.size(); curQueueNdx++)
387 if ((queueProps[curQueueNdx].queueFlags & params.queueFlags) == params.queueFlags)
389 queueFamilyIndex = (deUint32)curQueueNdx;
390 foundMatching = true;
395 TCU_THROW(NotSupportedError, "Matching queue not found");
400 static Move<VkDevice> create (const Environment& env, const Resources& res, const Parameters&)
402 const float queuePriority = 1.0;
404 const VkDeviceQueueCreateInfo queues[] =
407 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
409 (VkDeviceQueueCreateFlags)0,
410 res.queueFamilyIndex,
412 &queuePriority, // pQueuePriorities
415 const VkDeviceCreateInfo deviceInfo =
417 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
419 (VkDeviceCreateFlags)0,
420 DE_LENGTH_OF_ARRAY(queues),
422 0u, // enabledLayerNameCount
423 DE_NULL, // ppEnabledLayerNames
424 0u, // enabledExtensionNameCount
425 DE_NULL, // ppEnabledExtensionNames
426 DE_NULL, // pEnabledFeatures
429 return createDevice(res.vki, res.physicalDevice, &deviceInfo, env.allocationCallbacks);
435 typedef VkDeviceMemory Type;
437 static deUint32 getMaxConcurrent (Context& context)
439 return context.getDeviceProperties().limits.maxMemoryAllocationCount;
445 deUint32 memoryTypeIndex;
447 Parameters (VkDeviceSize size_, deUint32 memoryTypeIndex_)
449 , memoryTypeIndex (memoryTypeIndex_)
451 DE_ASSERT(memoryTypeIndex < VK_MAX_MEMORY_TYPES);
457 Resources (const Environment&, const Parameters&) {}
460 static Move<VkDeviceMemory> create (const Environment& env, const Resources&, const Parameters& params)
462 const VkMemoryAllocateInfo allocInfo =
464 VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
467 params.memoryTypeIndex
470 return allocateMemory(env.vkd, env.device, &allocInfo, env.allocationCallbacks);
474 DeviceMemory::Parameters getDeviceMemoryParameters (const VkMemoryRequirements& memReqs)
476 return DeviceMemory::Parameters(memReqs.size, deCtz32(memReqs.memoryTypeBits));
479 DeviceMemory::Parameters getDeviceMemoryParameters (const Environment& env, VkImage image)
481 return getDeviceMemoryParameters(getImageMemoryRequirements(env.vkd, env.device, image));
484 DeviceMemory::Parameters getDeviceMemoryParameters (const Environment& env, VkBuffer image)
486 return getDeviceMemoryParameters(getBufferMemoryRequirements(env.vkd, env.device, image));
491 typedef VkBuffer Type;
493 static deUint32 getMaxConcurrent (Context&)
495 return DEFAULT_MAX_CONCURRENT_OBJECTS;
501 VkBufferUsageFlags usage;
503 Parameters (VkDeviceSize size_,
504 VkBufferUsageFlags usage_)
512 Resources (const Environment&, const Parameters&) {}
515 static Move<VkBuffer> create (const Environment& env, const Resources&, const Parameters& params)
517 const VkBufferCreateInfo bufferInfo =
519 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
521 (VkBufferCreateFlags)0,
524 VK_SHARING_MODE_EXCLUSIVE,
526 &env.queueFamilyIndex
529 return createBuffer(env.vkd, env.device, &bufferInfo, env.allocationCallbacks);
535 typedef VkBufferView Type;
537 static deUint32 getMaxConcurrent (Context&)
539 return DEFAULT_MAX_CONCURRENT_OBJECTS;
544 Buffer::Parameters buffer;
549 Parameters (const Buffer::Parameters& buffer_,
551 VkDeviceSize offset_,
562 Dependency<Buffer> buffer;
563 Dependency<DeviceMemory> memory;
565 Resources (const Environment& env, const Parameters& params)
566 : buffer(env, params.buffer)
567 , memory(env, getDeviceMemoryParameters(env, *buffer.object))
569 VK_CHECK(env.vkd.bindBufferMemory(env.device, *buffer.object, *memory.object, 0));
573 static Move<VkBufferView> create (const Environment& env, const Resources& res, const Parameters& params)
575 const VkBufferViewCreateInfo bufferViewInfo =
577 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO,
579 (VkBufferViewCreateFlags)0,
586 return createBufferView(env.vkd, env.device, &bufferViewInfo, env.allocationCallbacks);
592 typedef VkImage Type;
594 static deUint32 getMaxConcurrent (Context&)
596 return DEFAULT_MAX_CONCURRENT_OBJECTS;
601 VkImageCreateFlags flags;
602 VkImageType imageType;
607 VkSampleCountFlagBits samples;
608 VkImageTiling tiling;
609 VkImageUsageFlags usage;
610 VkImageLayout initialLayout;
612 Parameters (VkImageCreateFlags flags_,
613 VkImageType imageType_,
618 VkSampleCountFlagBits samples_,
619 VkImageTiling tiling_,
620 VkImageUsageFlags usage_,
621 VkImageLayout initialLayout_)
623 , imageType (imageType_)
626 , mipLevels (mipLevels_)
627 , arraySize (arraySize_)
631 , initialLayout (initialLayout_)
637 Resources (const Environment&, const Parameters&) {}
640 static Move<VkImage> create (const Environment& env, const Resources&, const Parameters& params)
642 const VkImageCreateInfo imageInfo =
644 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
655 VK_SHARING_MODE_EXCLUSIVE, // sharingMode
656 1u, // queueFamilyIndexCount
657 &env.queueFamilyIndex, // pQueueFamilyIndices
661 return createImage(env.vkd, env.device, &imageInfo, env.allocationCallbacks);
667 typedef VkImageView Type;
669 static deUint32 getMaxConcurrent (Context&)
671 return DEFAULT_MAX_CONCURRENT_OBJECTS;
676 Image::Parameters image;
677 VkImageViewType viewType;
679 VkComponentMapping components;
680 VkImageSubresourceRange subresourceRange;
682 Parameters (const Image::Parameters& image_,
683 VkImageViewType viewType_,
685 VkComponentMapping components_,
686 VkImageSubresourceRange subresourceRange_)
688 , viewType (viewType_)
690 , components (components_)
691 , subresourceRange (subresourceRange_)
697 Dependency<Image> image;
698 Dependency<DeviceMemory> memory;
700 Resources (const Environment& env, const Parameters& params)
701 : image (env, params.image)
702 , memory(env, getDeviceMemoryParameters(env, *image.object))
704 VK_CHECK(env.vkd.bindImageMemory(env.device, *image.object, *memory.object, 0));
708 static Move<VkImageView> create (const Environment& env, const Resources& res, const Parameters& params)
710 const VkImageViewCreateInfo imageViewInfo =
712 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
714 (VkImageViewCreateFlags)0,
719 params.subresourceRange,
722 return createImageView(env.vkd, env.device, &imageViewInfo, env.allocationCallbacks);
728 typedef VkSemaphore Type;
730 static deUint32 getMaxConcurrent (Context&)
737 VkSemaphoreCreateFlags flags;
739 Parameters (VkSemaphoreCreateFlags flags_)
746 Resources (const Environment&, const Parameters&) {}
749 static Move<VkSemaphore> create (const Environment& env, const Resources&, const Parameters& params)
751 const VkSemaphoreCreateInfo semaphoreInfo =
753 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
758 return createSemaphore(env.vkd, env.device, &semaphoreInfo, env.allocationCallbacks);
764 typedef VkFence Type;
766 static deUint32 getMaxConcurrent (Context&)
773 VkFenceCreateFlags flags;
775 Parameters (VkFenceCreateFlags flags_)
782 Resources (const Environment&, const Parameters&) {}
785 static Move<VkFence> create (const Environment& env, const Resources&, const Parameters& params)
787 const VkFenceCreateInfo fenceInfo =
789 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
794 return createFence(env.vkd, env.device, &fenceInfo, env.allocationCallbacks);
800 typedef VkEvent Type;
802 static deUint32 getMaxConcurrent (Context&)
809 VkEventCreateFlags flags;
811 Parameters (VkEventCreateFlags flags_)
818 Resources (const Environment&, const Parameters&) {}
821 static Move<VkEvent> create (const Environment& env, const Resources&, const Parameters& params)
823 const VkEventCreateInfo eventInfo =
825 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
830 return createEvent(env.vkd, env.device, &eventInfo, env.allocationCallbacks);
836 typedef VkQueryPool Type;
838 static deUint32 getMaxConcurrent (Context&)
840 return DEFAULT_MAX_CONCURRENT_OBJECTS;
845 VkQueryType queryType;
847 VkQueryPipelineStatisticFlags pipelineStatistics;
849 Parameters (VkQueryType queryType_,
850 deUint32 entryCount_,
851 VkQueryPipelineStatisticFlags pipelineStatistics_)
852 : queryType (queryType_)
853 , entryCount (entryCount_)
854 , pipelineStatistics (pipelineStatistics_)
860 Resources (const Environment&, const Parameters&) {}
863 static Move<VkQueryPool> create (const Environment& env, const Resources&, const Parameters& params)
865 const VkQueryPoolCreateInfo queryPoolInfo =
867 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO,
869 (VkQueryPoolCreateFlags)0,
872 params.pipelineStatistics
875 return createQueryPool(env.vkd, env.device, &queryPoolInfo, env.allocationCallbacks);
881 typedef VkShaderModule Type;
883 static deUint32 getMaxConcurrent (Context&)
885 return DEFAULT_MAX_CONCURRENT_OBJECTS;
890 VkShaderStageFlagBits shaderStage;
893 Parameters (VkShaderStageFlagBits shaderStage_,
894 const std::string& binaryName_)
895 : shaderStage (shaderStage_)
896 , binaryName (binaryName_)
902 const ProgramBinary& binary;
904 Resources (const Environment& env, const Parameters& params)
905 : binary(env.programBinaries.get(params.binaryName))
909 static const char* getSource (VkShaderStageFlagBits stage)
913 case VK_SHADER_STAGE_VERTEX_BIT:
914 return "#version 310 es\n"
915 "layout(location = 0) in highp vec4 a_position;\n"
916 "void main () { gl_Position = a_position; }\n";
918 case VK_SHADER_STAGE_FRAGMENT_BIT:
919 return "#version 310 es\n"
920 "layout(location = 0) out mediump vec4 o_color;\n"
921 "void main () { o_color = vec4(1.0, 0.5, 0.25, 1.0); }";
923 case VK_SHADER_STAGE_COMPUTE_BIT:
924 return "#version 310 es\n"
925 "layout(binding = 0) buffer Input { highp uint dataIn[]; };\n"
926 "layout(binding = 1) buffer Output { highp uint dataOut[]; };\n"
929 " dataOut[gl_GlobalInvocationID.x] = ~dataIn[gl_GlobalInvocationID.x];\n"
933 DE_FATAL("Not implemented");
938 static void initPrograms (SourceCollections& dst, Parameters params)
940 const char* const source = getSource(params.shaderStage);
944 dst.glslSources.add(params.binaryName)
945 << glu::ShaderSource(getGluShaderType(params.shaderStage), source);
948 static Move<VkShaderModule> create (const Environment& env, const Resources& res, const Parameters&)
950 const VkShaderModuleCreateInfo shaderModuleInfo =
952 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
954 (VkShaderModuleCreateFlags)0,
955 res.binary.getSize(),
956 (const deUint32*)res.binary.getBinary(),
959 return createShaderModule(env.vkd, env.device, &shaderModuleInfo, env.allocationCallbacks);
965 typedef VkPipelineCache Type;
967 static deUint32 getMaxConcurrent (Context&)
969 return DEFAULT_MAX_CONCURRENT_OBJECTS;
979 Resources (const Environment&, const Parameters&) {}
982 static Move<VkPipelineCache> create (const Environment& env, const Resources&, const Parameters&)
984 const VkPipelineCacheCreateInfo pipelineCacheInfo =
986 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
988 (VkPipelineCacheCreateFlags)0u,
989 0u, // initialDataSize
990 DE_NULL, // pInitialData
993 return createPipelineCache(env.vkd, env.device, &pipelineCacheInfo, env.allocationCallbacks);
999 typedef VkSampler Type;
1001 static deUint32 getMaxConcurrent (Context& context)
1003 return context.getDeviceProperties().limits.maxSamplerAllocationCount;
1010 VkSamplerMipmapMode mipmapMode;
1011 VkSamplerAddressMode addressModeU;
1012 VkSamplerAddressMode addressModeV;
1013 VkSamplerAddressMode addressModeW;
1015 VkBool32 anisotropyEnable;
1016 float maxAnisotropy;
1017 VkBool32 compareEnable;
1018 VkCompareOp compareOp;
1021 VkBorderColor borderColor;
1022 VkBool32 unnormalizedCoordinates;
1024 // \todo [2015-09-17 pyry] Other configurations
1026 : magFilter (VK_FILTER_NEAREST)
1027 , minFilter (VK_FILTER_NEAREST)
1028 , mipmapMode (VK_SAMPLER_MIPMAP_MODE_NEAREST)
1029 , addressModeU (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE)
1030 , addressModeV (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE)
1031 , addressModeW (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE)
1033 , anisotropyEnable (VK_FALSE)
1034 , maxAnisotropy (1.0f)
1035 , compareEnable (VK_FALSE)
1036 , compareOp (VK_COMPARE_OP_ALWAYS)
1039 , borderColor (VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK)
1040 , unnormalizedCoordinates (VK_FALSE)
1046 Resources (const Environment&, const Parameters&) {}
1049 static Move<VkSampler> create (const Environment& env, const Resources&, const Parameters& params)
1051 const VkSamplerCreateInfo samplerInfo =
1053 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
1055 (VkSamplerCreateFlags)0,
1059 params.addressModeU,
1060 params.addressModeV,
1061 params.addressModeW,
1063 params.anisotropyEnable,
1064 params.maxAnisotropy,
1065 params.compareEnable,
1070 params.unnormalizedCoordinates
1073 return createSampler(env.vkd, env.device, &samplerInfo, env.allocationCallbacks);
1077 struct DescriptorSetLayout
1079 typedef VkDescriptorSetLayout Type;
1081 static deUint32 getMaxConcurrent (Context&)
1083 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1091 VkDescriptorType descriptorType;
1092 deUint32 descriptorCount;
1093 VkShaderStageFlags stageFlags;
1094 bool useImmutableSampler;
1096 Binding (deUint32 binding_,
1097 VkDescriptorType descriptorType_,
1098 deUint32 descriptorCount_,
1099 VkShaderStageFlags stageFlags_,
1100 bool useImmutableSampler_)
1101 : binding (binding_)
1102 , descriptorType (descriptorType_)
1103 , descriptorCount (descriptorCount_)
1104 , stageFlags (stageFlags_)
1105 , useImmutableSampler (useImmutableSampler_)
1111 vector<Binding> bindings;
1113 Parameters (const vector<Binding>& bindings_)
1114 : bindings(bindings_)
1117 static Parameters empty (void)
1119 return Parameters(vector<Binding>());
1122 static Parameters single (deUint32 binding,
1123 VkDescriptorType descriptorType,
1124 deUint32 descriptorCount,
1125 VkShaderStageFlags stageFlags,
1126 bool useImmutableSampler = false)
1128 vector<Binding> bindings;
1129 bindings.push_back(Binding(binding, descriptorType, descriptorCount, stageFlags, useImmutableSampler));
1130 return Parameters(bindings);
1136 vector<VkDescriptorSetLayoutBinding> bindings;
1137 MovePtr<Dependency<Sampler> > immutableSampler;
1138 vector<VkSampler> immutableSamplersPtr;
1140 Resources (const Environment& env, const Parameters& params)
1142 // Create immutable sampler if needed
1143 for (vector<Parameters::Binding>::const_iterator cur = params.bindings.begin(); cur != params.bindings.end(); cur++)
1145 if (cur->useImmutableSampler && !immutableSampler)
1147 immutableSampler = de::newMovePtr<Dependency<Sampler> >(env, Sampler::Parameters());
1149 if (cur->useImmutableSampler && immutableSamplersPtr.size() < (size_t)cur->descriptorCount)
1150 immutableSamplersPtr.resize(cur->descriptorCount, *immutableSampler->object);
1154 for (vector<Parameters::Binding>::const_iterator cur = params.bindings.begin(); cur != params.bindings.end(); cur++)
1156 const VkDescriptorSetLayoutBinding binding =
1159 cur->descriptorType,
1160 cur->descriptorCount,
1162 (cur->useImmutableSampler ? &immutableSamplersPtr[0] : DE_NULL)
1165 bindings.push_back(binding);
1170 static Move<VkDescriptorSetLayout> create (const Environment& env, const Resources& res, const Parameters&)
1172 const VkDescriptorSetLayoutCreateInfo descriptorSetLayoutInfo =
1174 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
1176 (VkDescriptorSetLayoutCreateFlags)0,
1177 (deUint32)res.bindings.size(),
1178 (res.bindings.empty() ? DE_NULL : &res.bindings[0])
1181 return createDescriptorSetLayout(env.vkd, env.device, &descriptorSetLayoutInfo, env.allocationCallbacks);
1185 struct PipelineLayout
1187 typedef VkPipelineLayout Type;
1189 static deUint32 getMaxConcurrent (Context&)
1191 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1196 vector<DescriptorSetLayout::Parameters> descriptorSetLayouts;
1197 vector<VkPushConstantRange> pushConstantRanges;
1199 Parameters (void) {}
1201 static Parameters empty (void)
1203 return Parameters();
1206 static Parameters singleDescriptorSet (const DescriptorSetLayout::Parameters& descriptorSetLayout)
1209 params.descriptorSetLayouts.push_back(descriptorSetLayout);
1216 typedef SharedPtr<Dependency<DescriptorSetLayout> > DescriptorSetLayoutDepSp;
1217 typedef vector<DescriptorSetLayoutDepSp> DescriptorSetLayouts;
1219 DescriptorSetLayouts descriptorSetLayouts;
1220 vector<VkDescriptorSetLayout> pSetLayouts;
1222 Resources (const Environment& env, const Parameters& params)
1224 for (vector<DescriptorSetLayout::Parameters>::const_iterator dsParams = params.descriptorSetLayouts.begin();
1225 dsParams != params.descriptorSetLayouts.end();
1228 descriptorSetLayouts.push_back(DescriptorSetLayoutDepSp(new Dependency<DescriptorSetLayout>(env, *dsParams)));
1229 pSetLayouts.push_back(*descriptorSetLayouts.back()->object);
1234 static Move<VkPipelineLayout> create (const Environment& env, const Resources& res, const Parameters& params)
1236 const VkPipelineLayoutCreateInfo pipelineLayoutInfo =
1238 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
1240 (VkPipelineLayoutCreateFlags)0,
1241 (deUint32)res.pSetLayouts.size(),
1242 (res.pSetLayouts.empty() ? DE_NULL : &res.pSetLayouts[0]),
1243 (deUint32)params.pushConstantRanges.size(),
1244 (params.pushConstantRanges.empty() ? DE_NULL : ¶ms.pushConstantRanges[0]),
1247 return createPipelineLayout(env.vkd, env.device, &pipelineLayoutInfo, env.allocationCallbacks);
1253 typedef VkRenderPass Type;
1255 static deUint32 getMaxConcurrent (Context&)
1257 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1260 // \todo [2015-09-17 pyry] More interesting configurations
1263 Parameters (void) {}
1268 Resources (const Environment&, const Parameters&) {}
1271 static Move<VkRenderPass> create (const Environment& env, const Resources&, const Parameters&)
1273 const VkAttachmentDescription attachments[] =
1276 (VkAttachmentDescriptionFlags)0,
1277 VK_FORMAT_R8G8B8A8_UNORM,
1278 VK_SAMPLE_COUNT_1_BIT,
1279 VK_ATTACHMENT_LOAD_OP_CLEAR,
1280 VK_ATTACHMENT_STORE_OP_STORE,
1281 VK_ATTACHMENT_LOAD_OP_DONT_CARE,
1282 VK_ATTACHMENT_STORE_OP_DONT_CARE,
1283 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
1284 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
1287 (VkAttachmentDescriptionFlags)0,
1288 VK_FORMAT_D16_UNORM,
1289 VK_SAMPLE_COUNT_1_BIT,
1290 VK_ATTACHMENT_LOAD_OP_CLEAR,
1291 VK_ATTACHMENT_STORE_OP_DONT_CARE,
1292 VK_ATTACHMENT_LOAD_OP_DONT_CARE,
1293 VK_ATTACHMENT_STORE_OP_DONT_CARE,
1294 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
1295 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
1298 const VkAttachmentReference colorAttachments[] =
1302 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
1305 const VkAttachmentReference dsAttachment =
1308 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
1310 const VkSubpassDescription subpasses[] =
1313 (VkSubpassDescriptionFlags)0,
1314 VK_PIPELINE_BIND_POINT_GRAPHICS,
1315 0u, // inputAttachmentCount
1316 DE_NULL, // pInputAttachments
1317 DE_LENGTH_OF_ARRAY(colorAttachments),
1319 DE_NULL, // pResolveAttachments
1321 0u, // preserveAttachmentCount
1322 DE_NULL, // pPreserveAttachments
1325 const VkRenderPassCreateInfo renderPassInfo =
1327 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
1329 (VkRenderPassCreateFlags)0,
1330 DE_LENGTH_OF_ARRAY(attachments),
1332 DE_LENGTH_OF_ARRAY(subpasses),
1334 0u, // dependencyCount
1335 DE_NULL // pDependencies
1338 return createRenderPass(env.vkd, env.device, &renderPassInfo, env.allocationCallbacks);
1342 struct GraphicsPipeline
1344 typedef VkPipeline Type;
1346 static deUint32 getMaxConcurrent (Context&)
1348 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1351 // \todo [2015-09-17 pyry] More interesting configurations
1354 Parameters (void) {}
1359 Dependency<ShaderModule> vertexShader;
1360 Dependency<ShaderModule> fragmentShader;
1361 Dependency<PipelineLayout> layout;
1362 Dependency<RenderPass> renderPass;
1363 Dependency<PipelineCache> pipelineCache;
1365 Resources (const Environment& env, const Parameters&)
1366 : vertexShader (env, ShaderModule::Parameters(VK_SHADER_STAGE_VERTEX_BIT, "vert"))
1367 , fragmentShader (env, ShaderModule::Parameters(VK_SHADER_STAGE_FRAGMENT_BIT, "frag"))
1368 , layout (env, PipelineLayout::Parameters::singleDescriptorSet(
1369 DescriptorSetLayout::Parameters::single(0u, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1u, VK_SHADER_STAGE_FRAGMENT_BIT, true)))
1370 , renderPass (env, RenderPass::Parameters())
1371 , pipelineCache (env, PipelineCache::Parameters())
1375 static void initPrograms (SourceCollections& dst, Parameters)
1377 ShaderModule::initPrograms(dst, ShaderModule::Parameters(VK_SHADER_STAGE_VERTEX_BIT, "vert"));
1378 ShaderModule::initPrograms(dst, ShaderModule::Parameters(VK_SHADER_STAGE_FRAGMENT_BIT, "frag"));
1381 static Move<VkPipeline> create (const Environment& env, const Resources& res, const Parameters&)
1383 const VkPipelineShaderStageCreateInfo stages[] =
1386 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
1388 (VkPipelineShaderStageCreateFlags)0,
1389 VK_SHADER_STAGE_VERTEX_BIT,
1390 *res.vertexShader.object,
1392 DE_NULL, // pSpecializationInfo
1395 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
1397 (VkPipelineShaderStageCreateFlags)0,
1398 VK_SHADER_STAGE_FRAGMENT_BIT,
1399 *res.fragmentShader.object,
1401 DE_NULL, // pSpecializationInfo
1404 const VkVertexInputBindingDescription vertexBindings[] =
1409 VK_VERTEX_INPUT_RATE_VERTEX
1412 const VkVertexInputAttributeDescription vertexAttribs[] =
1417 VK_FORMAT_R32G32B32A32_SFLOAT,
1421 const VkPipelineVertexInputStateCreateInfo vertexInputState =
1423 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
1425 (VkPipelineVertexInputStateCreateFlags)0,
1426 DE_LENGTH_OF_ARRAY(vertexBindings),
1428 DE_LENGTH_OF_ARRAY(vertexAttribs),
1431 const VkPipelineInputAssemblyStateCreateInfo inputAssemblyState =
1433 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
1435 (VkPipelineInputAssemblyStateCreateFlags)0,
1436 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
1437 VK_FALSE // primitiveRestartEnable
1439 const VkViewport viewports[] =
1441 { 0.0f, 0.0f, 64.f, 64.f, 0.0f, 1.0f }
1443 const VkRect2D scissors[] =
1445 { { 0, 0 }, { 64, 64 } }
1447 const VkPipelineViewportStateCreateInfo viewportState =
1449 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
1451 (VkPipelineViewportStateCreateFlags)0,
1452 DE_LENGTH_OF_ARRAY(viewports),
1454 DE_LENGTH_OF_ARRAY(scissors),
1457 const VkPipelineRasterizationStateCreateInfo rasterState =
1459 VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
1461 (VkPipelineRasterizationStateCreateFlags)0,
1462 VK_TRUE, // depthClampEnable
1463 VK_FALSE, // rasterizerDiscardEnable
1464 VK_POLYGON_MODE_FILL,
1465 VK_CULL_MODE_BACK_BIT,
1466 VK_FRONT_FACE_COUNTER_CLOCKWISE,
1467 VK_FALSE, // depthBiasEnable
1468 0.0f, // depthBiasConstantFactor
1469 0.0f, // depthBiasClamp
1470 0.0f, // depthBiasSlopeFactor
1473 const VkPipelineMultisampleStateCreateInfo multisampleState =
1475 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
1477 (VkPipelineMultisampleStateCreateFlags)0,
1478 VK_SAMPLE_COUNT_1_BIT,
1479 VK_FALSE, // sampleShadingEnable
1480 1.0f, // minSampleShading
1481 DE_NULL, // pSampleMask
1482 VK_FALSE, // alphaToCoverageEnable
1483 VK_FALSE, // alphaToOneEnable
1485 const VkPipelineDepthStencilStateCreateInfo depthStencilState =
1487 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
1489 (VkPipelineDepthStencilStateCreateFlags)0,
1490 VK_TRUE, // depthTestEnable
1491 VK_TRUE, // depthWriteEnable
1492 VK_COMPARE_OP_LESS, // depthCompareOp
1493 VK_FALSE, // depthBoundsTestEnable
1494 VK_FALSE, // stencilTestEnable
1495 { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_ALWAYS, 0u, 0u, 0u },
1496 { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_ALWAYS, 0u, 0u, 0u },
1497 -1.0f, // minDepthBounds
1498 +1.0f, // maxDepthBounds
1500 const VkPipelineColorBlendAttachmentState colorBlendAttState[]=
1503 VK_FALSE, // blendEnable
1504 VK_BLEND_FACTOR_ONE,
1505 VK_BLEND_FACTOR_ZERO,
1507 VK_BLEND_FACTOR_ONE,
1508 VK_BLEND_FACTOR_ZERO,
1510 VK_COLOR_COMPONENT_R_BIT|VK_COLOR_COMPONENT_G_BIT|VK_COLOR_COMPONENT_B_BIT|VK_COLOR_COMPONENT_A_BIT
1513 const VkPipelineColorBlendStateCreateInfo colorBlendState =
1515 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
1517 (VkPipelineColorBlendStateCreateFlags)0,
1518 VK_FALSE, // logicOpEnable
1520 DE_LENGTH_OF_ARRAY(colorBlendAttState),
1522 { 0.0f, 0.0f, 0.0f, 0.0f } // blendConstants
1524 const VkPipelineDynamicStateCreateInfo dynamicState =
1526 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
1528 (VkPipelineDynamicStateCreateFlags)0,
1529 0u, // dynamicStateCount
1530 DE_NULL, // pDynamicStates
1532 const VkGraphicsPipelineCreateInfo pipelineInfo =
1534 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
1536 (VkPipelineCreateFlags)0,
1537 DE_LENGTH_OF_ARRAY(stages),
1540 &inputAssemblyState,
1541 DE_NULL, // pTessellationState
1549 *res.renderPass.object,
1551 (VkPipeline)0, // basePipelineHandle
1552 0, // basePipelineIndex
1555 return createGraphicsPipeline(env.vkd, env.device, *res.pipelineCache.object, &pipelineInfo, env.allocationCallbacks);
1559 struct ComputePipeline
1561 typedef VkPipeline Type;
1563 static deUint32 getMaxConcurrent (Context&)
1565 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1568 // \todo [2015-09-17 pyry] More interesting configurations
1571 Parameters (void) {}
1576 Dependency<ShaderModule> shaderModule;
1577 Dependency<PipelineLayout> layout;
1578 Dependency<PipelineCache> pipelineCache;
1580 static DescriptorSetLayout::Parameters getDescriptorSetLayout (void)
1582 typedef DescriptorSetLayout::Parameters::Binding Binding;
1584 vector<Binding> bindings;
1586 bindings.push_back(Binding(0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1u, VK_SHADER_STAGE_COMPUTE_BIT, false));
1587 bindings.push_back(Binding(1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1u, VK_SHADER_STAGE_COMPUTE_BIT, false));
1589 return DescriptorSetLayout::Parameters(bindings);
1592 Resources (const Environment& env, const Parameters&)
1593 : shaderModule (env, ShaderModule::Parameters(VK_SHADER_STAGE_COMPUTE_BIT, "comp"))
1594 , layout (env, PipelineLayout::Parameters::singleDescriptorSet(getDescriptorSetLayout()))
1595 , pipelineCache (env, PipelineCache::Parameters())
1599 static void initPrograms (SourceCollections& dst, Parameters)
1601 ShaderModule::initPrograms(dst, ShaderModule::Parameters(VK_SHADER_STAGE_COMPUTE_BIT, "comp"));
1604 static Move<VkPipeline> create (const Environment& env, const Resources& res, const Parameters&)
1606 const VkComputePipelineCreateInfo pipelineInfo =
1608 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
1610 (VkPipelineCreateFlags)0,
1612 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
1614 (VkPipelineShaderStageCreateFlags)0,
1615 VK_SHADER_STAGE_COMPUTE_BIT,
1616 *res.shaderModule.object,
1618 DE_NULL // pSpecializationInfo
1621 (VkPipeline)0, // basePipelineHandle
1622 0u, // basePipelineIndex
1625 return createComputePipeline(env.vkd, env.device, *res.pipelineCache.object, &pipelineInfo, env.allocationCallbacks);
1629 struct DescriptorPool
1631 typedef VkDescriptorPool Type;
1633 static deUint32 getMaxConcurrent (Context&)
1635 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1640 VkDescriptorPoolCreateFlags flags;
1642 vector<VkDescriptorPoolSize> poolSizes;
1644 Parameters (VkDescriptorPoolCreateFlags flags_,
1646 const vector<VkDescriptorPoolSize>& poolSizes_)
1648 , maxSets (maxSets_)
1649 , poolSizes (poolSizes_)
1652 static Parameters singleType (VkDescriptorPoolCreateFlags flags,
1654 VkDescriptorType type,
1657 vector<VkDescriptorPoolSize> poolSizes;
1658 poolSizes.push_back(makeDescriptorPoolSize(type, count));
1659 return Parameters(flags, maxSets, poolSizes);
1665 Resources (const Environment&, const Parameters&) {}
1668 static Move<VkDescriptorPool> create (const Environment& env, const Resources&, const Parameters& params)
1670 const VkDescriptorPoolCreateInfo descriptorPoolInfo =
1672 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
1676 (deUint32)params.poolSizes.size(),
1677 (params.poolSizes.empty() ? DE_NULL : ¶ms.poolSizes[0])
1680 return createDescriptorPool(env.vkd, env.device, &descriptorPoolInfo, env.allocationCallbacks);
1684 struct DescriptorSet
1686 typedef VkDescriptorSet Type;
1688 static deUint32 getMaxConcurrent (Context&)
1690 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1695 DescriptorSetLayout::Parameters descriptorSetLayout;
1697 Parameters (const DescriptorSetLayout::Parameters& descriptorSetLayout_)
1698 : descriptorSetLayout(descriptorSetLayout_)
1704 Dependency<DescriptorPool> descriptorPool;
1705 Dependency<DescriptorSetLayout> descriptorSetLayout;
1707 static vector<VkDescriptorPoolSize> computePoolSizes (const DescriptorSetLayout::Parameters& layout, int maxSets)
1709 deUint32 countByType[VK_DESCRIPTOR_TYPE_LAST];
1710 vector<VkDescriptorPoolSize> typeCounts;
1712 std::fill(DE_ARRAY_BEGIN(countByType), DE_ARRAY_END(countByType), 0u);
1714 for (vector<DescriptorSetLayout::Parameters::Binding>::const_iterator cur = layout.bindings.begin();
1715 cur != layout.bindings.end();
1718 DE_ASSERT((deUint32)cur->descriptorType < VK_DESCRIPTOR_TYPE_LAST);
1719 countByType[cur->descriptorType] += cur->descriptorCount * maxSets;
1722 for (deUint32 type = 0; type < VK_DESCRIPTOR_TYPE_LAST; ++type)
1724 if (countByType[type] > 0)
1725 typeCounts.push_back(makeDescriptorPoolSize((VkDescriptorType)type, countByType[type]));
1731 Resources (const Environment& env, const Parameters& params)
1732 : descriptorPool (env, DescriptorPool::Parameters(VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, env.maxResourceConsumers, computePoolSizes(params.descriptorSetLayout, env.maxResourceConsumers)))
1733 , descriptorSetLayout (env, params.descriptorSetLayout)
1738 static Move<VkDescriptorSet> create (const Environment& env, const Resources& res, const Parameters&)
1740 const VkDescriptorSetAllocateInfo allocateInfo =
1742 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
1744 *res.descriptorPool.object,
1746 &res.descriptorSetLayout.object.get(),
1749 return allocateDescriptorSet(env.vkd, env.device, &allocateInfo);
1755 typedef VkFramebuffer Type;
1757 static deUint32 getMaxConcurrent (Context&)
1759 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1770 Dependency<ImageView> colorAttachment;
1771 Dependency<ImageView> depthStencilAttachment;
1772 Dependency<RenderPass> renderPass;
1774 Resources (const Environment& env, const Parameters&)
1775 : colorAttachment (env, ImageView::Parameters(Image::Parameters(0u, VK_IMAGE_TYPE_2D, VK_FORMAT_R8G8B8A8_UNORM,
1776 makeExtent3D(256, 256, 1),
1778 VK_SAMPLE_COUNT_1_BIT,
1779 VK_IMAGE_TILING_OPTIMAL,
1780 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
1781 VK_IMAGE_LAYOUT_UNDEFINED),
1782 VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_R8G8B8A8_UNORM,
1783 makeComponentMappingRGBA(),
1784 makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u)))
1785 , depthStencilAttachment (env, ImageView::Parameters(Image::Parameters(0u, VK_IMAGE_TYPE_2D, VK_FORMAT_D16_UNORM,
1786 makeExtent3D(256, 256, 1),
1788 VK_SAMPLE_COUNT_1_BIT,
1789 VK_IMAGE_TILING_OPTIMAL,
1790 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
1791 VK_IMAGE_LAYOUT_UNDEFINED),
1792 VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_D16_UNORM,
1793 makeComponentMappingRGBA(),
1794 makeImageSubresourceRange(VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 1u, 0u, 1u)))
1795 , renderPass (env, RenderPass::Parameters())
1799 static Move<VkFramebuffer> create (const Environment& env, const Resources& res, const Parameters&)
1801 const VkImageView attachments[] =
1803 *res.colorAttachment.object,
1804 *res.depthStencilAttachment.object,
1806 const VkFramebufferCreateInfo framebufferInfo =
1808 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
1810 (VkFramebufferCreateFlags)0,
1811 *res.renderPass.object,
1812 (deUint32)DE_LENGTH_OF_ARRAY(attachments),
1819 return createFramebuffer(env.vkd, env.device, &framebufferInfo, env.allocationCallbacks);
1825 typedef VkCommandPool Type;
1827 static deUint32 getMaxConcurrent (Context&)
1829 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1834 VkCommandPoolCreateFlags flags;
1836 Parameters (VkCommandPoolCreateFlags flags_)
1843 Resources (const Environment&, const Parameters&) {}
1846 static Move<VkCommandPool> create (const Environment& env, const Resources&, const Parameters& params)
1848 const VkCommandPoolCreateInfo cmdPoolInfo =
1850 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
1853 env.queueFamilyIndex,
1856 return createCommandPool(env.vkd, env.device, &cmdPoolInfo, env.allocationCallbacks);
1860 struct CommandBuffer
1862 typedef VkCommandBuffer Type;
1864 static deUint32 getMaxConcurrent (Context&)
1866 return DEFAULT_MAX_CONCURRENT_OBJECTS;
1871 CommandPool::Parameters commandPool;
1872 VkCommandBufferLevel level;
1874 Parameters (const CommandPool::Parameters& commandPool_,
1875 VkCommandBufferLevel level_)
1876 : commandPool (commandPool_)
1883 Dependency<CommandPool> commandPool;
1885 Resources (const Environment& env, const Parameters& params)
1886 : commandPool(env, params.commandPool)
1890 static Move<VkCommandBuffer> create (const Environment& env, const Resources& res, const Parameters& params)
1892 const VkCommandBufferAllocateInfo cmdBufferInfo =
1894 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
1896 *res.commandPool.object,
1901 return allocateCommandBuffer(env.vkd, env.device, &cmdBufferInfo);
1907 template<typename Object>
1908 tcu::TestStatus createSingleTest (Context& context, typename Object::Parameters params)
1910 const Environment env (context, 1u);
1911 const typename Object::Resources res (env, params);
1914 Unique<typename Object::Type> obj (Object::create(env, res, params));
1917 return tcu::TestStatus::pass("Ok");
1920 template<typename Object>
1921 tcu::TestStatus createMultipleUniqueResourcesTest (Context& context, typename Object::Parameters params)
1923 const Environment env (context, 1u);
1924 const typename Object::Resources res0 (env, params);
1925 const typename Object::Resources res1 (env, params);
1926 const typename Object::Resources res2 (env, params);
1927 const typename Object::Resources res3 (env, params);
1930 Unique<typename Object::Type> obj0 (Object::create(env, res0, params));
1931 Unique<typename Object::Type> obj1 (Object::create(env, res1, params));
1932 Unique<typename Object::Type> obj2 (Object::create(env, res2, params));
1933 Unique<typename Object::Type> obj3 (Object::create(env, res3, params));
1936 return tcu::TestStatus::pass("Ok");
1939 template<typename Object>
1940 tcu::TestStatus createMultipleSharedResourcesTest (Context& context, typename Object::Parameters params)
1942 const Environment env (context, 4u);
1943 const typename Object::Resources res (env, params);
1946 Unique<typename Object::Type> obj0 (Object::create(env, res, params));
1947 Unique<typename Object::Type> obj1 (Object::create(env, res, params));
1948 Unique<typename Object::Type> obj2 (Object::create(env, res, params));
1949 Unique<typename Object::Type> obj3 (Object::create(env, res, params));
1952 return tcu::TestStatus::pass("Ok");
1955 template<typename Object>
1956 tcu::TestStatus createMaxConcurrentTest (Context& context, typename Object::Parameters params)
1958 typedef Unique<typename Object::Type> UniqueObject;
1959 typedef SharedPtr<UniqueObject> ObjectPtr;
1961 const deUint32 numObjects = Object::getMaxConcurrent(context);
1962 const Environment env (context, numObjects);
1963 const typename Object::Resources res (env, params);
1964 vector<ObjectPtr> objects (numObjects);
1966 context.getTestContext().getLog()
1967 << TestLog::Message << "Creating " << numObjects << " " << getTypeName<typename Object::Type>() << "s" << TestLog::EndMessage;
1969 for (deUint32 ndx = 0; ndx < numObjects; ndx++)
1970 objects[ndx] = ObjectPtr(new UniqueObject(Object::create(env, res, params)));
1974 return tcu::TestStatus::pass("Ok");
1977 template<typename Object>
1978 class CreateThread : public ThreadGroupThread
1981 CreateThread (const Environment& env, const typename Object::Resources& resources, const typename Object::Parameters& params)
1983 , m_resources (resources)
1987 void runThread (void)
1989 const int numIters = 100;
1990 const int itersBetweenSyncs = 20;
1992 for (int iterNdx = 0; iterNdx < numIters; iterNdx++)
1994 // Sync every Nth iteration to make entering driver at the same time more likely
1995 if ((iterNdx % itersBetweenSyncs) == 0)
1999 Unique<typename Object::Type> obj (Object::create(m_env, m_resources, m_params));
2005 const Environment& m_env;
2006 const typename Object::Resources& m_resources;
2007 const typename Object::Parameters& m_params;
2010 template<typename Object>
2011 tcu::TestStatus multithreadedCreateSharedResourcesTest (Context& context, typename Object::Parameters params)
2013 const deUint32 numThreads = getDefaultTestThreadCount();
2014 const Environment env (context, numThreads);
2015 const typename Object::Resources res (env, params);
2016 ThreadGroup threads;
2018 for (deUint32 ndx = 0; ndx < numThreads; ndx++)
2019 threads.add(MovePtr<ThreadGroupThread>(new CreateThread<Object>(env, res, params)));
2021 return threads.run();
2024 template<typename Object>
2025 tcu::TestStatus multithreadedCreatePerThreadResourcesTest (Context& context, typename Object::Parameters params)
2027 typedef SharedPtr<typename Object::Resources> ResPtr;
2029 const deUint32 numThreads = getDefaultTestThreadCount();
2030 const Environment env (context, 1u);
2031 vector<ResPtr> resources (numThreads);
2032 ThreadGroup threads;
2034 for (deUint32 ndx = 0; ndx < numThreads; ndx++)
2036 resources[ndx] = ResPtr(new typename Object::Resources(env, params));
2037 threads.add(MovePtr<ThreadGroupThread>(new CreateThread<Object>(env, *resources[ndx], params)));
2040 return threads.run();
2045 Device::Resources deviceRes;
2046 Unique<VkDevice> device;
2050 EnvClone (const Environment& parent, const Device::Parameters& deviceParams, deUint32 maxResourceConsumers)
2051 : deviceRes (parent, deviceParams)
2052 , device (Device::create(parent, deviceRes, deviceParams))
2053 , vkd (deviceRes.vki, *device)
2054 , env (parent.vkp, vkd, *device, deviceRes.queueFamilyIndex, parent.programBinaries, parent.allocationCallbacks, maxResourceConsumers)
2059 Device::Parameters getDefaulDeviceParameters (Context& context)
2061 return Device::Parameters(context.getTestContext().getCommandLine().getVKDeviceId()-1u,
2062 VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_COMPUTE_BIT);
2065 template<typename Object>
2066 tcu::TestStatus multithreadedCreatePerThreadDeviceTest (Context& context, typename Object::Parameters params)
2068 typedef SharedPtr<EnvClone> EnvPtr;
2069 typedef SharedPtr<typename Object::Resources> ResPtr;
2071 const deUint32 numThreads = getDefaultTestThreadCount();
2072 const Device::Parameters deviceParams = getDefaulDeviceParameters(context);
2073 const Environment sharedEnv (context, numThreads); // For creating Device's
2074 vector<EnvPtr> perThreadEnv (numThreads);
2075 vector<ResPtr> resources (numThreads);
2076 ThreadGroup threads;
2078 for (deUint32 ndx = 0; ndx < numThreads; ndx++)
2080 perThreadEnv[ndx] = EnvPtr(new EnvClone(sharedEnv, deviceParams, 1u));
2081 resources[ndx] = ResPtr(new typename Object::Resources(perThreadEnv[ndx]->env, params));
2083 threads.add(MovePtr<ThreadGroupThread>(new CreateThread<Object>(perThreadEnv[ndx]->env, *resources[ndx], params)));
2086 return threads.run();
2089 template<typename Object>
2090 tcu::TestStatus createSingleAllocCallbacksTest (Context& context, typename Object::Parameters params)
2092 const deUint32 noCmdScope = (1u << VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE)
2093 | (1u << VK_SYSTEM_ALLOCATION_SCOPE_DEVICE)
2094 | (1u << VK_SYSTEM_ALLOCATION_SCOPE_CACHE)
2095 | (1u << VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
2097 // Callbacks used by resources
2098 AllocationCallbackRecorder resCallbacks (getSystemAllocator(), 128);
2100 // Root environment still uses default instance and device, created without callbacks
2101 const Environment rootEnv (context.getPlatformInterface(),
2102 context.getDeviceInterface(),
2103 context.getDevice(),
2104 context.getUniversalQueueFamilyIndex(),
2105 context.getBinaryCollection(),
2106 resCallbacks.getCallbacks(),
2110 // Test env has instance & device created with callbacks
2111 const EnvClone resEnv (rootEnv, getDefaulDeviceParameters(context), 1u);
2112 const typename Object::Resources res (resEnv.env, params);
2114 // Supply a separate callback recorder just for object construction
2115 AllocationCallbackRecorder objCallbacks(getSystemAllocator(), 128);
2116 const Environment objEnv (resEnv.env.vkp,
2119 resEnv.env.queueFamilyIndex,
2120 resEnv.env.programBinaries,
2121 objCallbacks.getCallbacks(),
2122 resEnv.env.maxResourceConsumers);
2125 Unique<typename Object::Type> obj (Object::create(objEnv, res, params));
2127 // Validate that no command-level allocations are live
2128 if (!validateAndLog(context.getTestContext().getLog(), objCallbacks, noCmdScope))
2129 return tcu::TestStatus::fail("Invalid allocation callback");
2132 // At this point all allocations made against object callbacks must have been freed
2133 if (!validateAndLog(context.getTestContext().getLog(), objCallbacks, 0u))
2134 return tcu::TestStatus::fail("Invalid allocation callback");
2137 if (!validateAndLog(context.getTestContext().getLog(), resCallbacks, 0u))
2138 return tcu::TestStatus::fail("Invalid allocation callback");
2140 return tcu::TestStatus::pass("Ok");
2143 template<typename Object>
2144 tcu::TestStatus allocCallbackFailTest (Context& context, typename Object::Parameters params)
2146 AllocationCallbackRecorder resCallbacks (getSystemAllocator(), 128);
2147 const Environment rootEnv (context.getPlatformInterface(),
2148 context.getDeviceInterface(),
2149 context.getDevice(),
2150 context.getUniversalQueueFamilyIndex(),
2151 context.getBinaryCollection(),
2152 resCallbacks.getCallbacks(),
2156 const EnvClone resEnv (rootEnv, getDefaulDeviceParameters(context), 1u);
2157 const typename Object::Resources res (resEnv.env, params);
2158 deUint32 numPassingAllocs = 0;
2159 const deUint32 maxTries = 1u<<10;
2161 // Iterate over test until object allocation succeeds
2162 for (; numPassingAllocs < maxTries; ++numPassingAllocs)
2164 DeterministicFailAllocator objAllocator(getSystemAllocator(), numPassingAllocs);
2165 AllocationCallbackRecorder recorder (objAllocator.getCallbacks(), 128);
2166 const Environment objEnv (resEnv.env.vkp,
2169 resEnv.env.queueFamilyIndex,
2170 resEnv.env.programBinaries,
2171 recorder.getCallbacks(),
2172 resEnv.env.maxResourceConsumers);
2173 bool createOk = false;
2175 context.getTestContext().getLog()
2177 << "Trying to create object with " << numPassingAllocs << " allocation" << (numPassingAllocs != 1 ? "s" : "") << " passing"
2178 << TestLog::EndMessage;
2182 Unique<typename Object::Type> obj (Object::create(objEnv, res, params));
2185 catch (const vk::OutOfMemoryError& e)
2187 if (e.getError() != VK_ERROR_OUT_OF_HOST_MEMORY)
2189 context.getTestContext().getLog() << e;
2190 return tcu::TestStatus::fail("Got invalid error code");
2194 if (!validateAndLog(context.getTestContext().getLog(), recorder, 0u))
2195 return tcu::TestStatus::fail("Invalid allocation callback");
2199 context.getTestContext().getLog()
2200 << TestLog::Message << "Object construction succeeded! " << TestLog::EndMessage;
2206 if (!validateAndLog(context.getTestContext().getLog(), resCallbacks, 0u))
2207 return tcu::TestStatus::fail("Invalid allocation callback");
2209 return tcu::TestStatus::pass("Ok");
2212 // Utilities for creating groups
2214 template<typename Object>
2215 struct NamedParameters
2218 typename Object::Parameters parameters;
2221 template<typename Object>
2222 struct CaseDescription
2224 typename FunctionInstance1<typename Object::Parameters>::Function function;
2225 const NamedParameters<Object>* paramsBegin;
2226 const NamedParameters<Object>* paramsEnd;
2229 #define EMPTY_CASE_DESC(OBJECT) \
2230 { (FunctionInstance1<OBJECT::Parameters>::Function)DE_NULL, DE_NULL, DE_NULL }
2232 #define CASE_DESC(FUNCTION, CASES) \
2233 { FUNCTION, DE_ARRAY_BEGIN(CASES), DE_ARRAY_END(CASES) }
2235 struct CaseDescriptions
2237 CaseDescription<Instance> instance;
2238 CaseDescription<Device> device;
2239 CaseDescription<DeviceMemory> deviceMemory;
2240 CaseDescription<Buffer> buffer;
2241 CaseDescription<BufferView> bufferView;
2242 CaseDescription<Image> image;
2243 CaseDescription<ImageView> imageView;
2244 CaseDescription<Semaphore> semaphore;
2245 CaseDescription<Event> event;
2246 CaseDescription<Fence> fence;
2247 CaseDescription<QueryPool> queryPool;
2248 CaseDescription<ShaderModule> shaderModule;
2249 CaseDescription<PipelineCache> pipelineCache;
2250 CaseDescription<PipelineLayout> pipelineLayout;
2251 CaseDescription<RenderPass> renderPass;
2252 CaseDescription<GraphicsPipeline> graphicsPipeline;
2253 CaseDescription<ComputePipeline> computePipeline;
2254 CaseDescription<DescriptorSetLayout> descriptorSetLayout;
2255 CaseDescription<Sampler> sampler;
2256 CaseDescription<DescriptorPool> descriptorPool;
2257 CaseDescription<DescriptorSet> descriptorSet;
2258 CaseDescription<Framebuffer> framebuffer;
2259 CaseDescription<CommandPool> commandPool;
2260 CaseDescription<CommandBuffer> commandBuffer;
2263 template<typename Object>
2264 void addCases (const MovePtr<tcu::TestCaseGroup>& group, const CaseDescription<Object>& cases)
2266 for (const NamedParameters<Object>* cur = cases.paramsBegin; cur != cases.paramsEnd; ++cur)
2267 addFunctionCase(group.get(), cur->name, "", cases.function, cur->parameters);
2270 template<typename Object>
2271 void addCasesWithProgs (const MovePtr<tcu::TestCaseGroup>& group, const CaseDescription<Object>& cases)
2273 for (const NamedParameters<Object>* cur = cases.paramsBegin; cur != cases.paramsEnd; ++cur)
2274 addFunctionCaseWithPrograms(group.get(), cur->name, "", Object::initPrograms, cases.function, cur->parameters);
2277 tcu::TestCaseGroup* createGroup (tcu::TestContext& testCtx, const char* name, const char* desc, const CaseDescriptions& cases)
2279 MovePtr<tcu::TestCaseGroup> group (new tcu::TestCaseGroup(testCtx, name, desc));
2281 addCases (group, cases.instance);
2282 addCases (group, cases.device);
2283 addCases (group, cases.deviceMemory);
2284 addCases (group, cases.buffer);
2285 addCases (group, cases.bufferView);
2286 addCases (group, cases.image);
2287 addCases (group, cases.imageView);
2288 addCases (group, cases.semaphore);
2289 addCases (group, cases.event);
2290 addCases (group, cases.fence);
2291 addCases (group, cases.queryPool);
2292 addCases (group, cases.sampler);
2293 addCasesWithProgs (group, cases.shaderModule);
2294 addCases (group, cases.pipelineCache);
2295 addCases (group, cases.pipelineLayout);
2296 addCases (group, cases.renderPass);
2297 addCasesWithProgs (group, cases.graphicsPipeline);
2298 addCasesWithProgs (group, cases.computePipeline);
2299 addCases (group, cases.descriptorSetLayout);
2300 addCases (group, cases.descriptorPool);
2301 addCases (group, cases.descriptorSet);
2302 addCases (group, cases.framebuffer);
2303 addCases (group, cases.commandPool);
2304 addCases (group, cases.commandBuffer);
2306 return group.release();
2311 tcu::TestCaseGroup* createObjectManagementTests (tcu::TestContext& testCtx)
2313 MovePtr<tcu::TestCaseGroup> objectMgmtTests (new tcu::TestCaseGroup(testCtx, "object_management", "Object management tests"));
2315 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);
2316 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);
2317 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);
2318 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);
2319 const ImageView::Parameters imgView1D (img1D, VK_IMAGE_VIEW_TYPE_1D, img1D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u));
2320 const ImageView::Parameters imgView1DArr (img1D, VK_IMAGE_VIEW_TYPE_1D_ARRAY, img1D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 4u));
2321 const ImageView::Parameters imgView2D (img2D, VK_IMAGE_VIEW_TYPE_2D, img2D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u));
2322 const ImageView::Parameters imgView2DArr (img2D, VK_IMAGE_VIEW_TYPE_2D_ARRAY, img2D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 8u));
2323 const ImageView::Parameters imgViewCube (imgCube, VK_IMAGE_VIEW_TYPE_CUBE, img2D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 6u));
2324 const ImageView::Parameters imgViewCubeArr (imgCube, VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, img2D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 12u));
2325 const ImageView::Parameters imgView3D (img3D, VK_IMAGE_VIEW_TYPE_3D, img3D.format, makeComponentMappingRGBA(), makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u));
2327 const DescriptorSetLayout::Parameters singleUboDescLayout = DescriptorSetLayout::Parameters::single(0u, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1u, VK_SHADER_STAGE_VERTEX_BIT);
2329 static NamedParameters<Instance> s_instanceCases[] =
2331 { "instance", Instance::Parameters() },
2333 // \note Device index may change - must not be static
2334 const NamedParameters<Device> s_deviceCases[] =
2336 { "device", Device::Parameters(testCtx.getCommandLine().getVKDeviceId()-1u, VK_QUEUE_GRAPHICS_BIT) },
2338 static const NamedParameters<DeviceMemory> s_deviceMemCases[] =
2340 { "device_memory_small", DeviceMemory::Parameters(1024, 0u) },
2342 static const NamedParameters<Buffer> s_bufferCases[] =
2344 { "buffer_uniform_small", Buffer::Parameters(1024u, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT), },
2345 { "buffer_uniform_large", Buffer::Parameters(1024u*1024u*16u, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT), },
2346 { "buffer_storage_small", Buffer::Parameters(1024u, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), },
2347 { "buffer_storage_large", Buffer::Parameters(1024u*1024u*16u, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), },
2349 static const NamedParameters<BufferView> s_bufferViewCases[] =
2351 { "buffer_view_uniform_r8g8b8a8_unorm", BufferView::Parameters(Buffer::Parameters(8192u, VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT), VK_FORMAT_R8G8B8A8_UNORM, 0u, 4096u) },
2352 { "buffer_view_storage_r8g8b8a8_unorm", BufferView::Parameters(Buffer::Parameters(8192u, VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT), VK_FORMAT_R8G8B8A8_UNORM, 0u, 4096u) },
2354 static const NamedParameters<Image> s_imageCases[] =
2356 { "image_1d", img1D },
2357 { "image_2d", img2D },
2358 { "image_3d", img3D },
2360 static const NamedParameters<ImageView> s_imageViewCases[] =
2362 { "image_view_1d", imgView1D },
2363 { "image_view_1d_arr", imgView1DArr },
2364 { "image_view_2d", imgView2D },
2365 { "image_view_2d_arr", imgView2DArr },
2366 { "image_view_cube", imgViewCube },
2367 { "image_view_cube_arr", imgViewCubeArr },
2368 { "image_view_3d", imgView3D },
2370 static const NamedParameters<Semaphore> s_semaphoreCases[] =
2372 { "semaphore", Semaphore::Parameters(0u), }
2374 static const NamedParameters<Event> s_eventCases[] =
2376 { "event", Event::Parameters(0u) }
2378 static const NamedParameters<Fence> s_fenceCases[] =
2380 { "fence", Fence::Parameters(0u) },
2381 { "fence_signaled", Fence::Parameters(VK_FENCE_CREATE_SIGNALED_BIT) }
2383 static const NamedParameters<QueryPool> s_queryPoolCases[] =
2385 { "query_pool", QueryPool::Parameters(VK_QUERY_TYPE_OCCLUSION, 1u, 0u) }
2387 static const NamedParameters<ShaderModule> s_shaderModuleCases[] =
2389 { "shader_module", ShaderModule::Parameters(VK_SHADER_STAGE_COMPUTE_BIT, "test") }
2391 static const NamedParameters<PipelineCache> s_pipelineCacheCases[] =
2393 { "pipeline_cache", PipelineCache::Parameters() }
2395 static const NamedParameters<PipelineLayout> s_pipelineLayoutCases[] =
2397 { "pipeline_layout_empty", PipelineLayout::Parameters::empty() },
2398 { "pipeline_layout_single", PipelineLayout::Parameters::singleDescriptorSet(singleUboDescLayout) }
2400 static const NamedParameters<RenderPass> s_renderPassCases[] =
2402 { "render_pass", RenderPass::Parameters() }
2404 static const NamedParameters<GraphicsPipeline> s_graphicsPipelineCases[] =
2406 { "graphics_pipeline", GraphicsPipeline::Parameters() }
2408 static const NamedParameters<ComputePipeline> s_computePipelineCases[] =
2410 { "compute_pipeline", ComputePipeline::Parameters() }
2412 static const NamedParameters<DescriptorSetLayout> s_descriptorSetLayoutCases[] =
2414 { "descriptor_set_layout_empty", DescriptorSetLayout::Parameters::empty() },
2415 { "descriptor_set_layout_single", singleUboDescLayout }
2417 static const NamedParameters<Sampler> s_samplerCases[] =
2419 { "sampler", Sampler::Parameters() }
2421 static const NamedParameters<DescriptorPool> s_descriptorPoolCases[] =
2423 { "descriptor_pool", DescriptorPool::Parameters::singleType((VkDescriptorPoolCreateFlags)0, 4u, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3u) },
2424 { "descriptor_pool_free_descriptor_set", DescriptorPool::Parameters::singleType(VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 4u, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3u) }
2426 static const NamedParameters<DescriptorSet> s_descriptorSetCases[] =
2428 { "descriptor_set", DescriptorSet::Parameters(singleUboDescLayout) }
2430 static const NamedParameters<Framebuffer> s_framebufferCases[] =
2432 { "framebuffer", Framebuffer::Parameters() }
2434 static const NamedParameters<CommandPool> s_commandPoolCases[] =
2436 { "command_pool", CommandPool::Parameters((VkCommandPoolCreateFlags)0) },
2437 { "command_pool_transient", CommandPool::Parameters(VK_COMMAND_POOL_CREATE_TRANSIENT_BIT) }
2439 static const NamedParameters<CommandBuffer> s_commandBufferCases[] =
2441 { "command_buffer_primary", CommandBuffer::Parameters(CommandPool::Parameters((VkCommandPoolCreateFlags)0u), VK_COMMAND_BUFFER_LEVEL_PRIMARY) },
2442 { "command_buffer_secondary", CommandBuffer::Parameters(CommandPool::Parameters((VkCommandPoolCreateFlags)0u), VK_COMMAND_BUFFER_LEVEL_SECONDARY) }
2445 static const CaseDescriptions s_createSingleGroup =
2447 CASE_DESC(createSingleTest <Instance>, s_instanceCases),
2448 CASE_DESC(createSingleTest <Device>, s_deviceCases),
2449 CASE_DESC(createSingleTest <DeviceMemory>, s_deviceMemCases),
2450 CASE_DESC(createSingleTest <Buffer>, s_bufferCases),
2451 CASE_DESC(createSingleTest <BufferView>, s_bufferViewCases),
2452 CASE_DESC(createSingleTest <Image>, s_imageCases),
2453 CASE_DESC(createSingleTest <ImageView>, s_imageViewCases),
2454 CASE_DESC(createSingleTest <Semaphore>, s_semaphoreCases),
2455 CASE_DESC(createSingleTest <Event>, s_eventCases),
2456 CASE_DESC(createSingleTest <Fence>, s_fenceCases),
2457 CASE_DESC(createSingleTest <QueryPool>, s_queryPoolCases),
2458 CASE_DESC(createSingleTest <ShaderModule>, s_shaderModuleCases),
2459 CASE_DESC(createSingleTest <PipelineCache>, s_pipelineCacheCases),
2460 CASE_DESC(createSingleTest <PipelineLayout>, s_pipelineLayoutCases),
2461 CASE_DESC(createSingleTest <RenderPass>, s_renderPassCases),
2462 CASE_DESC(createSingleTest <GraphicsPipeline>, s_graphicsPipelineCases),
2463 CASE_DESC(createSingleTest <ComputePipeline>, s_computePipelineCases),
2464 CASE_DESC(createSingleTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2465 CASE_DESC(createSingleTest <Sampler>, s_samplerCases),
2466 CASE_DESC(createSingleTest <DescriptorPool>, s_descriptorPoolCases),
2467 CASE_DESC(createSingleTest <DescriptorSet>, s_descriptorSetCases),
2468 CASE_DESC(createSingleTest <Framebuffer>, s_framebufferCases),
2469 CASE_DESC(createSingleTest <CommandPool>, s_commandPoolCases),
2470 CASE_DESC(createSingleTest <CommandBuffer>, s_commandBufferCases),
2472 objectMgmtTests->addChild(createGroup(testCtx, "single", "Create single object", s_createSingleGroup));
2474 static const CaseDescriptions s_createMultipleUniqueResourcesGroup =
2476 CASE_DESC(createMultipleUniqueResourcesTest <Instance>, s_instanceCases),
2477 CASE_DESC(createMultipleUniqueResourcesTest <Device>, s_deviceCases),
2478 CASE_DESC(createMultipleUniqueResourcesTest <DeviceMemory>, s_deviceMemCases),
2479 CASE_DESC(createMultipleUniqueResourcesTest <Buffer>, s_bufferCases),
2480 CASE_DESC(createMultipleUniqueResourcesTest <BufferView>, s_bufferViewCases),
2481 CASE_DESC(createMultipleUniqueResourcesTest <Image>, s_imageCases),
2482 CASE_DESC(createMultipleUniqueResourcesTest <ImageView>, s_imageViewCases),
2483 CASE_DESC(createMultipleUniqueResourcesTest <Semaphore>, s_semaphoreCases),
2484 CASE_DESC(createMultipleUniqueResourcesTest <Event>, s_eventCases),
2485 CASE_DESC(createMultipleUniqueResourcesTest <Fence>, s_fenceCases),
2486 CASE_DESC(createMultipleUniqueResourcesTest <QueryPool>, s_queryPoolCases),
2487 CASE_DESC(createMultipleUniqueResourcesTest <ShaderModule>, s_shaderModuleCases),
2488 CASE_DESC(createMultipleUniqueResourcesTest <PipelineCache>, s_pipelineCacheCases),
2489 CASE_DESC(createMultipleUniqueResourcesTest <PipelineLayout>, s_pipelineLayoutCases),
2490 CASE_DESC(createMultipleUniqueResourcesTest <RenderPass>, s_renderPassCases),
2491 CASE_DESC(createMultipleUniqueResourcesTest <GraphicsPipeline>, s_graphicsPipelineCases),
2492 CASE_DESC(createMultipleUniqueResourcesTest <ComputePipeline>, s_computePipelineCases),
2493 CASE_DESC(createMultipleUniqueResourcesTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2494 CASE_DESC(createMultipleUniqueResourcesTest <Sampler>, s_samplerCases),
2495 CASE_DESC(createMultipleUniqueResourcesTest <DescriptorPool>, s_descriptorPoolCases),
2496 CASE_DESC(createMultipleUniqueResourcesTest <DescriptorSet>, s_descriptorSetCases),
2497 CASE_DESC(createMultipleUniqueResourcesTest <Framebuffer>, s_framebufferCases),
2498 CASE_DESC(createMultipleUniqueResourcesTest <CommandPool>, s_commandPoolCases),
2499 CASE_DESC(createMultipleUniqueResourcesTest <CommandBuffer>, s_commandBufferCases),
2501 objectMgmtTests->addChild(createGroup(testCtx, "multiple_unique_resources", "Multiple objects with per-object unique resources", s_createMultipleUniqueResourcesGroup));
2503 static const CaseDescriptions s_createMultipleSharedResourcesGroup =
2505 EMPTY_CASE_DESC(Instance), // No resources used
2506 CASE_DESC(createMultipleSharedResourcesTest <Device>, s_deviceCases),
2507 CASE_DESC(createMultipleSharedResourcesTest <DeviceMemory>, s_deviceMemCases),
2508 CASE_DESC(createMultipleSharedResourcesTest <Buffer>, s_bufferCases),
2509 CASE_DESC(createMultipleSharedResourcesTest <BufferView>, s_bufferViewCases),
2510 CASE_DESC(createMultipleSharedResourcesTest <Image>, s_imageCases),
2511 CASE_DESC(createMultipleSharedResourcesTest <ImageView>, s_imageViewCases),
2512 CASE_DESC(createMultipleSharedResourcesTest <Semaphore>, s_semaphoreCases),
2513 CASE_DESC(createMultipleSharedResourcesTest <Event>, s_eventCases),
2514 CASE_DESC(createMultipleSharedResourcesTest <Fence>, s_fenceCases),
2515 CASE_DESC(createMultipleSharedResourcesTest <QueryPool>, s_queryPoolCases),
2516 CASE_DESC(createMultipleSharedResourcesTest <ShaderModule>, s_shaderModuleCases),
2517 CASE_DESC(createMultipleSharedResourcesTest <PipelineCache>, s_pipelineCacheCases),
2518 CASE_DESC(createMultipleSharedResourcesTest <PipelineLayout>, s_pipelineLayoutCases),
2519 CASE_DESC(createMultipleSharedResourcesTest <RenderPass>, s_renderPassCases),
2520 CASE_DESC(createMultipleSharedResourcesTest <GraphicsPipeline>, s_graphicsPipelineCases),
2521 CASE_DESC(createMultipleSharedResourcesTest <ComputePipeline>, s_computePipelineCases),
2522 CASE_DESC(createMultipleSharedResourcesTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2523 CASE_DESC(createMultipleSharedResourcesTest <Sampler>, s_samplerCases),
2524 CASE_DESC(createMultipleSharedResourcesTest <DescriptorPool>, s_descriptorPoolCases),
2525 CASE_DESC(createMultipleSharedResourcesTest <DescriptorSet>, s_descriptorSetCases),
2526 CASE_DESC(createMultipleSharedResourcesTest <Framebuffer>, s_framebufferCases),
2527 CASE_DESC(createMultipleSharedResourcesTest <CommandPool>, s_commandPoolCases),
2528 CASE_DESC(createMultipleSharedResourcesTest <CommandBuffer>, s_commandBufferCases),
2530 objectMgmtTests->addChild(createGroup(testCtx, "multiple_shared_resources", "Multiple objects with shared resources", s_createMultipleSharedResourcesGroup));
2532 static const CaseDescriptions s_createMaxConcurrentGroup =
2534 CASE_DESC(createMaxConcurrentTest <Instance>, s_instanceCases),
2535 CASE_DESC(createMaxConcurrentTest <Device>, s_deviceCases),
2536 CASE_DESC(createMaxConcurrentTest <DeviceMemory>, s_deviceMemCases),
2537 CASE_DESC(createMaxConcurrentTest <Buffer>, s_bufferCases),
2538 CASE_DESC(createMaxConcurrentTest <BufferView>, s_bufferViewCases),
2539 CASE_DESC(createMaxConcurrentTest <Image>, s_imageCases),
2540 CASE_DESC(createMaxConcurrentTest <ImageView>, s_imageViewCases),
2541 CASE_DESC(createMaxConcurrentTest <Semaphore>, s_semaphoreCases),
2542 CASE_DESC(createMaxConcurrentTest <Event>, s_eventCases),
2543 CASE_DESC(createMaxConcurrentTest <Fence>, s_fenceCases),
2544 CASE_DESC(createMaxConcurrentTest <QueryPool>, s_queryPoolCases),
2545 CASE_DESC(createMaxConcurrentTest <ShaderModule>, s_shaderModuleCases),
2546 CASE_DESC(createMaxConcurrentTest <PipelineCache>, s_pipelineCacheCases),
2547 CASE_DESC(createMaxConcurrentTest <PipelineLayout>, s_pipelineLayoutCases),
2548 CASE_DESC(createMaxConcurrentTest <RenderPass>, s_renderPassCases),
2549 CASE_DESC(createMaxConcurrentTest <GraphicsPipeline>, s_graphicsPipelineCases),
2550 CASE_DESC(createMaxConcurrentTest <ComputePipeline>, s_computePipelineCases),
2551 CASE_DESC(createMaxConcurrentTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2552 CASE_DESC(createMaxConcurrentTest <Sampler>, s_samplerCases),
2553 CASE_DESC(createMaxConcurrentTest <DescriptorPool>, s_descriptorPoolCases),
2554 CASE_DESC(createMaxConcurrentTest <DescriptorSet>, s_descriptorSetCases),
2555 CASE_DESC(createMaxConcurrentTest <Framebuffer>, s_framebufferCases),
2556 CASE_DESC(createMaxConcurrentTest <CommandPool>, s_commandPoolCases),
2557 CASE_DESC(createMaxConcurrentTest <CommandBuffer>, s_commandBufferCases),
2559 objectMgmtTests->addChild(createGroup(testCtx, "max_concurrent", "Maximum number of concurrently live objects", s_createMaxConcurrentGroup));
2561 static const CaseDescriptions s_multithreadedCreatePerThreadDeviceGroup =
2563 EMPTY_CASE_DESC(Instance), // Does not make sense
2564 EMPTY_CASE_DESC(Device), // Does not make sense
2565 CASE_DESC(multithreadedCreatePerThreadDeviceTest <DeviceMemory>, s_deviceMemCases),
2566 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Buffer>, s_bufferCases),
2567 CASE_DESC(multithreadedCreatePerThreadDeviceTest <BufferView>, s_bufferViewCases),
2568 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Image>, s_imageCases),
2569 CASE_DESC(multithreadedCreatePerThreadDeviceTest <ImageView>, s_imageViewCases),
2570 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Semaphore>, s_semaphoreCases),
2571 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Event>, s_eventCases),
2572 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Fence>, s_fenceCases),
2573 CASE_DESC(multithreadedCreatePerThreadDeviceTest <QueryPool>, s_queryPoolCases),
2574 CASE_DESC(multithreadedCreatePerThreadDeviceTest <ShaderModule>, s_shaderModuleCases),
2575 CASE_DESC(multithreadedCreatePerThreadDeviceTest <PipelineCache>, s_pipelineCacheCases),
2576 CASE_DESC(multithreadedCreatePerThreadDeviceTest <PipelineLayout>, s_pipelineLayoutCases),
2577 CASE_DESC(multithreadedCreatePerThreadDeviceTest <RenderPass>, s_renderPassCases),
2578 CASE_DESC(multithreadedCreatePerThreadDeviceTest <GraphicsPipeline>, s_graphicsPipelineCases),
2579 CASE_DESC(multithreadedCreatePerThreadDeviceTest <ComputePipeline>, s_computePipelineCases),
2580 CASE_DESC(multithreadedCreatePerThreadDeviceTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2581 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Sampler>, s_samplerCases),
2582 CASE_DESC(multithreadedCreatePerThreadDeviceTest <DescriptorPool>, s_descriptorPoolCases),
2583 CASE_DESC(multithreadedCreatePerThreadDeviceTest <DescriptorSet>, s_descriptorSetCases),
2584 CASE_DESC(multithreadedCreatePerThreadDeviceTest <Framebuffer>, s_framebufferCases),
2585 CASE_DESC(multithreadedCreatePerThreadDeviceTest <CommandPool>, s_commandPoolCases),
2586 CASE_DESC(multithreadedCreatePerThreadDeviceTest <CommandBuffer>, s_commandBufferCases),
2588 objectMgmtTests->addChild(createGroup(testCtx, "multithreaded_per_thread_device", "Multithreaded object construction with per-thread device ", s_multithreadedCreatePerThreadDeviceGroup));
2590 static const CaseDescriptions s_multithreadedCreatePerThreadResourcesGroup =
2592 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Instance>, s_instanceCases),
2593 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Device>, s_deviceCases),
2594 CASE_DESC(multithreadedCreatePerThreadResourcesTest <DeviceMemory>, s_deviceMemCases),
2595 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Buffer>, s_bufferCases),
2596 CASE_DESC(multithreadedCreatePerThreadResourcesTest <BufferView>, s_bufferViewCases),
2597 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Image>, s_imageCases),
2598 CASE_DESC(multithreadedCreatePerThreadResourcesTest <ImageView>, s_imageViewCases),
2599 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Semaphore>, s_semaphoreCases),
2600 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Event>, s_eventCases),
2601 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Fence>, s_fenceCases),
2602 CASE_DESC(multithreadedCreatePerThreadResourcesTest <QueryPool>, s_queryPoolCases),
2603 CASE_DESC(multithreadedCreatePerThreadResourcesTest <ShaderModule>, s_shaderModuleCases),
2604 CASE_DESC(multithreadedCreatePerThreadResourcesTest <PipelineCache>, s_pipelineCacheCases),
2605 CASE_DESC(multithreadedCreatePerThreadResourcesTest <PipelineLayout>, s_pipelineLayoutCases),
2606 CASE_DESC(multithreadedCreatePerThreadResourcesTest <RenderPass>, s_renderPassCases),
2607 CASE_DESC(multithreadedCreatePerThreadResourcesTest <GraphicsPipeline>, s_graphicsPipelineCases),
2608 CASE_DESC(multithreadedCreatePerThreadResourcesTest <ComputePipeline>, s_computePipelineCases),
2609 CASE_DESC(multithreadedCreatePerThreadResourcesTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2610 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Sampler>, s_samplerCases),
2611 CASE_DESC(multithreadedCreatePerThreadResourcesTest <DescriptorPool>, s_descriptorPoolCases),
2612 CASE_DESC(multithreadedCreatePerThreadResourcesTest <DescriptorSet>, s_descriptorSetCases),
2613 CASE_DESC(multithreadedCreatePerThreadResourcesTest <Framebuffer>, s_framebufferCases),
2614 CASE_DESC(multithreadedCreatePerThreadResourcesTest <CommandPool>, s_commandPoolCases),
2615 CASE_DESC(multithreadedCreatePerThreadResourcesTest <CommandBuffer>, s_commandBufferCases),
2617 objectMgmtTests->addChild(createGroup(testCtx, "multithreaded_per_thread_resources", "Multithreaded object construction with per-thread resources", s_multithreadedCreatePerThreadResourcesGroup));
2619 static const CaseDescriptions s_multithreadedCreateSharedResourcesGroup =
2621 EMPTY_CASE_DESC(Instance),
2622 CASE_DESC(multithreadedCreateSharedResourcesTest <Device>, s_deviceCases),
2623 CASE_DESC(multithreadedCreateSharedResourcesTest <DeviceMemory>, s_deviceMemCases),
2624 CASE_DESC(multithreadedCreateSharedResourcesTest <Buffer>, s_bufferCases),
2625 CASE_DESC(multithreadedCreateSharedResourcesTest <BufferView>, s_bufferViewCases),
2626 CASE_DESC(multithreadedCreateSharedResourcesTest <Image>, s_imageCases),
2627 CASE_DESC(multithreadedCreateSharedResourcesTest <ImageView>, s_imageViewCases),
2628 CASE_DESC(multithreadedCreateSharedResourcesTest <Semaphore>, s_semaphoreCases),
2629 CASE_DESC(multithreadedCreateSharedResourcesTest <Event>, s_eventCases),
2630 CASE_DESC(multithreadedCreateSharedResourcesTest <Fence>, s_fenceCases),
2631 CASE_DESC(multithreadedCreateSharedResourcesTest <QueryPool>, s_queryPoolCases),
2632 CASE_DESC(multithreadedCreateSharedResourcesTest <ShaderModule>, s_shaderModuleCases),
2633 CASE_DESC(multithreadedCreateSharedResourcesTest <PipelineCache>, s_pipelineCacheCases),
2634 CASE_DESC(multithreadedCreateSharedResourcesTest <PipelineLayout>, s_pipelineLayoutCases),
2635 CASE_DESC(multithreadedCreateSharedResourcesTest <RenderPass>, s_renderPassCases),
2636 CASE_DESC(multithreadedCreateSharedResourcesTest <GraphicsPipeline>, s_graphicsPipelineCases),
2637 CASE_DESC(multithreadedCreateSharedResourcesTest <ComputePipeline>, s_computePipelineCases),
2638 CASE_DESC(multithreadedCreateSharedResourcesTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2639 CASE_DESC(multithreadedCreateSharedResourcesTest <Sampler>, s_samplerCases),
2640 CASE_DESC(multithreadedCreateSharedResourcesTest <DescriptorPool>, s_descriptorPoolCases),
2641 EMPTY_CASE_DESC(DescriptorSet), // \note Needs per-thread DescriptorPool
2642 CASE_DESC(multithreadedCreateSharedResourcesTest <Framebuffer>, s_framebufferCases),
2643 CASE_DESC(multithreadedCreateSharedResourcesTest <CommandPool>, s_commandPoolCases),
2644 EMPTY_CASE_DESC(CommandBuffer), // \note Needs per-thread CommandPool
2646 objectMgmtTests->addChild(createGroup(testCtx, "multithreaded_shared_resources", "Multithreaded object construction with shared resources", s_multithreadedCreateSharedResourcesGroup));
2648 static const CaseDescriptions s_createSingleAllocCallbacksGroup =
2650 CASE_DESC(createSingleAllocCallbacksTest <Instance>, s_instanceCases),
2651 CASE_DESC(createSingleAllocCallbacksTest <Device>, s_deviceCases),
2652 CASE_DESC(createSingleAllocCallbacksTest <DeviceMemory>, s_deviceMemCases),
2653 CASE_DESC(createSingleAllocCallbacksTest <Buffer>, s_bufferCases),
2654 CASE_DESC(createSingleAllocCallbacksTest <BufferView>, s_bufferViewCases),
2655 CASE_DESC(createSingleAllocCallbacksTest <Image>, s_imageCases),
2656 CASE_DESC(createSingleAllocCallbacksTest <ImageView>, s_imageViewCases),
2657 CASE_DESC(createSingleAllocCallbacksTest <Semaphore>, s_semaphoreCases),
2658 CASE_DESC(createSingleAllocCallbacksTest <Event>, s_eventCases),
2659 CASE_DESC(createSingleAllocCallbacksTest <Fence>, s_fenceCases),
2660 CASE_DESC(createSingleAllocCallbacksTest <QueryPool>, s_queryPoolCases),
2661 CASE_DESC(createSingleAllocCallbacksTest <ShaderModule>, s_shaderModuleCases),
2662 CASE_DESC(createSingleAllocCallbacksTest <PipelineCache>, s_pipelineCacheCases),
2663 CASE_DESC(createSingleAllocCallbacksTest <PipelineLayout>, s_pipelineLayoutCases),
2664 CASE_DESC(createSingleAllocCallbacksTest <RenderPass>, s_renderPassCases),
2665 CASE_DESC(createSingleAllocCallbacksTest <GraphicsPipeline>, s_graphicsPipelineCases),
2666 CASE_DESC(createSingleAllocCallbacksTest <ComputePipeline>, s_computePipelineCases),
2667 CASE_DESC(createSingleAllocCallbacksTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2668 CASE_DESC(createSingleAllocCallbacksTest <Sampler>, s_samplerCases),
2669 CASE_DESC(createSingleAllocCallbacksTest <DescriptorPool>, s_descriptorPoolCases),
2670 CASE_DESC(createSingleAllocCallbacksTest <DescriptorSet>, s_descriptorSetCases),
2671 CASE_DESC(createSingleAllocCallbacksTest <Framebuffer>, s_framebufferCases),
2672 CASE_DESC(createSingleAllocCallbacksTest <CommandPool>, s_commandPoolCases),
2673 CASE_DESC(createSingleAllocCallbacksTest <CommandBuffer>, s_commandBufferCases),
2675 objectMgmtTests->addChild(createGroup(testCtx, "single_alloc_callbacks", "Create single object", s_createSingleAllocCallbacksGroup));
2677 static const CaseDescriptions s_allocCallbackFailGroup =
2679 CASE_DESC(allocCallbackFailTest <Instance>, s_instanceCases),
2680 CASE_DESC(allocCallbackFailTest <Device>, s_deviceCases),
2681 CASE_DESC(allocCallbackFailTest <DeviceMemory>, s_deviceMemCases),
2682 CASE_DESC(allocCallbackFailTest <Buffer>, s_bufferCases),
2683 CASE_DESC(allocCallbackFailTest <BufferView>, s_bufferViewCases),
2684 CASE_DESC(allocCallbackFailTest <Image>, s_imageCases),
2685 CASE_DESC(allocCallbackFailTest <ImageView>, s_imageViewCases),
2686 CASE_DESC(allocCallbackFailTest <Semaphore>, s_semaphoreCases),
2687 CASE_DESC(allocCallbackFailTest <Event>, s_eventCases),
2688 CASE_DESC(allocCallbackFailTest <Fence>, s_fenceCases),
2689 CASE_DESC(allocCallbackFailTest <QueryPool>, s_queryPoolCases),
2690 CASE_DESC(allocCallbackFailTest <ShaderModule>, s_shaderModuleCases),
2691 CASE_DESC(allocCallbackFailTest <PipelineCache>, s_pipelineCacheCases),
2692 CASE_DESC(allocCallbackFailTest <PipelineLayout>, s_pipelineLayoutCases),
2693 CASE_DESC(allocCallbackFailTest <RenderPass>, s_renderPassCases),
2694 CASE_DESC(allocCallbackFailTest <GraphicsPipeline>, s_graphicsPipelineCases),
2695 CASE_DESC(allocCallbackFailTest <ComputePipeline>, s_computePipelineCases),
2696 CASE_DESC(allocCallbackFailTest <DescriptorSetLayout>, s_descriptorSetLayoutCases),
2697 CASE_DESC(allocCallbackFailTest <Sampler>, s_samplerCases),
2698 CASE_DESC(allocCallbackFailTest <DescriptorPool>, s_descriptorPoolCases),
2699 CASE_DESC(allocCallbackFailTest <DescriptorSet>, s_descriptorSetCases),
2700 CASE_DESC(allocCallbackFailTest <Framebuffer>, s_framebufferCases),
2701 CASE_DESC(allocCallbackFailTest <CommandPool>, s_commandPoolCases),
2702 CASE_DESC(allocCallbackFailTest <CommandBuffer>, s_commandBufferCases),
2704 objectMgmtTests->addChild(createGroup(testCtx, "alloc_callback_fail", "Allocation callback failure", s_allocCallbackFailGroup));
2706 return objectMgmtTests.release();