1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2021 The Khronos Group Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief VkDeviceObjectReservationCreateInfo tests
22 *//*--------------------------------------------------------------------*/
23
24 #include "vktDeviceObjectReservationTests.hpp"
25
26 #include <vector>
27 #include <string>
28
29 #include "tcuTestCase.hpp"
30
31 #include "vkDefs.hpp"
32 #include "vkDeviceUtil.hpp"
33 #include "vkQueryUtil.hpp"
34 #include "vkSafetyCriticalUtil.hpp"
35 #include "vkImageWithMemory.hpp"
36 #include "vkBufferWithMemory.hpp"
37 #include "vkObjUtil.hpp"
38
39 #include "vktTestCaseUtil.hpp"
40 #include "vktCustomInstancesDevices.hpp"
41
42 using namespace vk;
43
44 namespace vkt
45 {
46 namespace sc
47 {
48 namespace
49 {
50
51 enum TestMaxValues
52 {
53 TMV_UNDEFINED = 0,
54 TMV_DESCRIPTOR_SET_LAYOUT_BINDING_LIMIT,
55 TMV_MAX_IMAGEVIEW_MIPLEVELS,
56 TMV_MAX_IMAGEVIEW_ARRAYLAYERS,
57 TMV_MAX_LAYEREDIMAGEVIEW_MIPLEVELS,
58 TMV_MAX_OCCLUSION_QUERIES_PER_POOL,
59 TMV_MAX_PIPELINESTATISTICS_QUERIES_PER_POOL,
60 TMV_MAX_TIMESTAMP_QUERIES_PER_POOL
61 };
62
63 const deUint32 VERIFYMAXVALUES_OBJECT_COUNT = 5U;
64 const deUint32 VERIFYMAXVALUES_ARRAYLAYERS = 8U;
65 const deUint32 VERIFYMAXVALUES_MIPLEVELS = 5U;
66
67 enum TestRequestCounts
68 {
69 TRC_UNDEFINED = 0,
70 TRC_SEMAPHORE,
71 TRC_COMMAND_BUFFER,
72 TRC_FENCE,
73 TRC_DEVICE_MEMORY,
74 TRC_BUFFER,
75 TRC_IMAGE,
76 TRC_EVENT,
77 TRC_QUERY_POOL,
78 TRC_BUFFER_VIEW,
79 TRC_IMAGE_VIEW,
80 TRC_LAYERED_IMAGE_VIEW,
81 TRC_PIPELINE_LAYOUT,
82 TRC_RENDER_PASS,
83 TRC_GRAPHICS_PIPELINE,
84 TRC_COMPUTE_PIPELINE,
85 TRC_DESCRIPTORSET_LAYOUT,
86 TRC_SAMPLER,
87 TRC_DESCRIPTOR_POOL,
88 TRC_DESCRIPTORSET,
89 TRC_FRAMEBUFFER,
90 TRC_COMMANDPOOL,
91 TRC_SAMPLERYCBCRCONVERSION,
92 TRC_SURFACE,
93 TRC_SWAPCHAIN,
94 TRC_DISPLAY_MODE,
95 };
96
97 enum TestPoolSizes
98 {
99 PST_UNDEFINED = 0,
100 PST_NONE,
101 PST_ZERO,
102 PST_TOO_SMALL_SIZE,
103 PST_ONE_FITS,
104 PST_MULTIPLE_FIT,
105 };
106
107 struct TestParams
108 {
TestParamsvkt::sc::__anon4737444a0111::TestParams109 TestParams (const TestMaxValues& testMaxValues_ = TMV_UNDEFINED, const TestRequestCounts& testRequestCounts_ = TRC_UNDEFINED, const TestPoolSizes& testPoolSizeType_ = PST_UNDEFINED)
110 : testMaxValues { testMaxValues_ }
111 , testRequestCounts { testRequestCounts_ }
112 , testPoolSizeType { testPoolSizeType_ }
113 {
114 }
115 TestMaxValues testMaxValues;
116 TestRequestCounts testRequestCounts;
117 TestPoolSizes testPoolSizeType;
118 };
119
120 typedef de::SharedPtr<Unique<VkSemaphore>> SemaphoreSp;
121 typedef de::SharedPtr<Unique<VkCommandBuffer>> CommandBufferSp;
122 typedef de::SharedPtr<Unique<VkFence>> FenceSp;
123 typedef de::SharedPtr<Unique<VkDeviceMemory> > DeviceMemorySp;
124 typedef de::SharedPtr<Unique<VkBuffer>> BufferSp;
125 typedef de::SharedPtr<Unique<VkImage>> ImageSp;
126 typedef de::SharedPtr<Unique<VkEvent>> EventSp;
127 typedef de::SharedPtr<Unique<VkQueryPool>> QueryPoolSp;
128 typedef de::SharedPtr<Unique<VkBufferView>> BufferViewSp;
129 typedef de::SharedPtr<Unique<VkImageView>> ImageViewSp;
130 typedef de::SharedPtr<Unique<VkPipelineLayout>> PipelineLayoutSp;
131 typedef de::SharedPtr<Unique<VkRenderPass>> RenderPassSp;
132 typedef de::SharedPtr<Unique<VkPipeline>> PipelineSp;
133 typedef de::SharedPtr<Unique<VkDescriptorSetLayout>> DescriptorSetLayoutSp;
134 typedef de::SharedPtr<Unique<VkSampler>> SamplerSp;
135 typedef de::SharedPtr<Unique<VkDescriptorPool>> DescriptorPoolSp;
136 typedef de::SharedPtr<Unique<VkDescriptorSet>> DescriptorSetSp;
137 typedef de::SharedPtr<Unique<VkFramebuffer>> FramebufferSp;
138 typedef de::SharedPtr<Unique<VkCommandPool>> CommandPoolSp;
139 typedef de::SharedPtr<Unique<VkSamplerYcbcrConversion>> SamplerYcbcrConversionSp;
140 //typedef de::SharedPtr<Unique<VkSurfaceKHR>> SurfaceSp;
141 //typedef de::SharedPtr<Unique<VkSwapchainKHR>> SwapchainSp;
142 //typedef de::SharedPtr<Unique<VkDisplayModeKHR>> DisplayModeSp;
143 typedef de::SharedPtr<Unique<VkSubpassDescription>> SubpassDescriptionSp;
144 typedef de::SharedPtr<Unique<VkAttachmentDescription>> AttachmentDescriptionSp;
145
146
createSemaphores(const DeviceInterface & vkd,const VkDevice device,std::vector<SemaphoreSp>::iterator begin,std::vector<SemaphoreSp>::iterator end)147 void createSemaphores (const DeviceInterface& vkd,
148 const VkDevice device,
149 std::vector<SemaphoreSp>::iterator begin,
150 std::vector<SemaphoreSp>::iterator end)
151 {
152 for(std::vector<SemaphoreSp>::iterator it=begin; it!=end; ++it)
153 *it = SemaphoreSp(new Unique<VkSemaphore>(createSemaphore(vkd, device)));
154 }
155
createCommandBuffers(const DeviceInterface & vkd,const VkDevice device,const VkCommandPool commandPool,std::vector<CommandBufferSp>::iterator begin,std::vector<CommandBufferSp>::iterator end)156 void createCommandBuffers (const DeviceInterface& vkd,
157 const VkDevice device,
158 const VkCommandPool commandPool,
159 std::vector<CommandBufferSp>::iterator begin,
160 std::vector<CommandBufferSp>::iterator end)
161 {
162 for (std::vector<CommandBufferSp>::iterator it = begin; it != end; ++it)
163 {
164 const vk::VkCommandBufferAllocateInfo commandBufferAI =
165 {
166 vk::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // sType
167 DE_NULL, // pNext
168 commandPool, // commandPool
169 vk::VK_COMMAND_BUFFER_LEVEL_PRIMARY, // level
170 1u // commandBufferCount
171 };
172 *it = CommandBufferSp(new Unique<VkCommandBuffer>(allocateCommandBuffer(vkd, device, &commandBufferAI)));
173 }
174 }
175
createFences(const DeviceInterface & vkd,const VkDevice device,std::vector<FenceSp>::iterator begin,std::vector<FenceSp>::iterator end)176 void createFences (const DeviceInterface& vkd,
177 const VkDevice device,
178 std::vector<FenceSp>::iterator begin,
179 std::vector<FenceSp>::iterator end)
180 {
181 for (std::vector<FenceSp>::iterator it = begin; it != end; ++it)
182 {
183 const VkFenceCreateInfo fenceCI =
184 {
185 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType
186 DE_NULL, // const void* pNext
187 0u // VkFenceCreateFlags flags
188 };
189 *it = FenceSp(new Unique<VkFence>(createFence(vkd, device, &fenceCI)));
190 }
191 }
192
allocateDeviceMemory(const DeviceInterface & vkd,const VkDevice device,VkDeviceSize size,std::vector<DeviceMemorySp>::iterator begin,std::vector<DeviceMemorySp>::iterator end)193 void allocateDeviceMemory (const DeviceInterface& vkd,
194 const VkDevice device,
195 VkDeviceSize size,
196 std::vector<DeviceMemorySp>::iterator begin,
197 std::vector<DeviceMemorySp>::iterator end)
198 {
199 for (std::vector<DeviceMemorySp>::iterator it = begin; it != end; ++it)
200 {
201 VkMemoryAllocateInfo alloc =
202 {
203 VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType
204 DE_NULL, // pNext
205 size, // allocationSize
206 0U // memoryTypeIndex;
207 };
208 *it = DeviceMemorySp(new Unique<VkDeviceMemory>(allocateMemory(vkd, device, &alloc)));
209 }
210 }
211
createBuffers(const DeviceInterface & vkd,const VkDevice device,VkDeviceSize size,std::vector<BufferSp>::iterator begin,std::vector<BufferSp>::iterator end)212 void createBuffers (const DeviceInterface& vkd,
213 const VkDevice device,
214 VkDeviceSize size,
215 std::vector<BufferSp>::iterator begin,
216 std::vector<BufferSp>::iterator end)
217 {
218 deUint32 queueFamilyIndex = 0u;
219 for (std::vector<BufferSp>::iterator it = begin; it != end; ++it)
220 {
221 const VkBufferCreateInfo bufferCI =
222 {
223 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType
224 DE_NULL, // pNext
225 0u, // flags
226 size, // size
227 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, // usage
228 VK_SHARING_MODE_EXCLUSIVE, // sharingMode
229 1u, // queueFamilyIndexCount
230 &queueFamilyIndex, // pQueueFamilyIndices
231 };
232 *it = BufferSp(new Unique<VkBuffer>(createBuffer(vkd, device, &bufferCI)));
233 }
234 }
235
createImages(const DeviceInterface & vkd,const VkDevice device,deUint32 size,std::vector<ImageSp>::iterator begin,std::vector<ImageSp>::iterator end)236 void createImages (const DeviceInterface& vkd,
237 const VkDevice device,
238 deUint32 size,
239 std::vector<ImageSp>::iterator begin,
240 std::vector<ImageSp>::iterator end)
241 {
242 deUint32 queueFamilyIndex = 0u;
243 for (std::vector<ImageSp>::iterator it = begin; it != end; ++it)
244 {
245 const VkImageCreateInfo imageCI =
246 {
247 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType
248 DE_NULL, // const void* pNext
249 (VkImageCreateFlags)0u, // VkImageCreateFlags flags
250 VK_IMAGE_TYPE_2D, // VkImageType imageType
251 VK_FORMAT_R8_UNORM, // VkFormat format
252 {
253 size, // deUint32 width
254 size, // deUint32 height
255 1u // deUint32 depth
256 }, // VkExtent3D extent
257 1u, // deUint32 mipLevels
258 1u, // deUint32 arrayLayers
259 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples
260 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling
261 VK_IMAGE_USAGE_SAMPLED_BIT, // VkImageUsageFlags usage
262 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode
263 1u, // deUint32 queueFamilyIndexCount
264 &queueFamilyIndex, // const deUint32* pQueueFamilyIndices
265 VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout
266 };
267 *it = ImageSp(new Unique<VkImage>(createImage(vkd, device, &imageCI)));
268 }
269 }
270
createEvents(const DeviceInterface & vkd,const VkDevice device,std::vector<EventSp>::iterator begin,std::vector<EventSp>::iterator end)271 void createEvents (const DeviceInterface& vkd,
272 const VkDevice device,
273 std::vector<EventSp>::iterator begin,
274 std::vector<EventSp>::iterator end)
275 {
276 for(std::vector<EventSp>::iterator it=begin; it!=end; ++it)
277 *it = EventSp(new Unique<VkEvent>(createEvent(vkd, device)));
278 }
279
createQueryPools(const DeviceInterface & vkd,const VkDevice device,std::vector<QueryPoolSp>::iterator begin,std::vector<QueryPoolSp>::iterator end)280 void createQueryPools (const DeviceInterface& vkd,
281 const VkDevice device,
282 std::vector<QueryPoolSp>::iterator begin,
283 std::vector<QueryPoolSp>::iterator end)
284 {
285 for (std::vector<QueryPoolSp>::iterator it = begin; it != end; ++it)
286 {
287 const VkQueryPoolCreateInfo queryPoolCI =
288 {
289 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // VkStructureType sType
290 DE_NULL, // const void* pNext
291 (VkQueryPoolCreateFlags)0, // VkQueryPoolCreateFlags flags
292 VK_QUERY_TYPE_OCCLUSION, // VkQueryType queryType
293 1u, // deUint32 queryCount
294 0u, // VkQueryPipelineStatisticFlags pipelineStatistics
295 };
296 *it = QueryPoolSp(new Unique<VkQueryPool>(createQueryPool(vkd, device, &queryPoolCI)));
297 }
298 }
299
createBufferViews(const DeviceInterface & vkd,const VkDevice device,const VkBuffer buffer,const VkDeviceSize size,std::vector<BufferViewSp>::iterator begin,std::vector<BufferViewSp>::iterator end)300 void createBufferViews (const DeviceInterface& vkd,
301 const VkDevice device,
302 const VkBuffer buffer,
303 const VkDeviceSize size,
304 std::vector<BufferViewSp>::iterator begin,
305 std::vector<BufferViewSp>::iterator end)
306 {
307 for (std::vector<BufferViewSp>::iterator it = begin; it != end; ++it)
308 {
309 const VkBufferViewCreateInfo bufferViewCI =
310 {
311 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO, // VkStructureType sType
312 DE_NULL, // const void* pNext
313 0u, // VkBufferViewCreateFlags flags
314 buffer, // VkBuffer buffer
315 VK_FORMAT_R8_UNORM, // VkFormat format
316 0ull, // VkDeviceSize offset
317 size // VkDeviceSize range
318 };
319 *it = BufferViewSp(new Unique<VkBufferView>(createBufferView(vkd, device, &bufferViewCI)));
320 }
321 }
322
createImageViews(const DeviceInterface & vkd,const VkDevice device,const VkImage image,std::vector<ImageViewSp>::iterator begin,std::vector<ImageViewSp>::iterator end)323 void createImageViews (const DeviceInterface& vkd,
324 const VkDevice device,
325 const VkImage image,
326 std::vector<ImageViewSp>::iterator begin,
327 std::vector<ImageViewSp>::iterator end)
328 {
329 for (std::vector<ImageViewSp>::iterator it = begin; it != end; ++it)
330 {
331 VkComponentMapping componentMapping { VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY };
332 VkImageViewCreateInfo imageViewCI =
333 {
334 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // VkStructureType sType
335 DE_NULL, // const void* pNext
336 0u, // VkImageViewCreateFlags flags
337 image, // VkImage image
338 VK_IMAGE_VIEW_TYPE_2D, // VkImageViewType viewType
339 VK_FORMAT_R8_UNORM, // VkFormat format
340 componentMapping, // VkComponentMapping components
341 { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }, // VkImageSubresourceRange subresourceRange
342 };
343 *it = ImageViewSp(new Unique<VkImageView>(createImageView(vkd, device, &imageViewCI)));
344 }
345 }
346
createPipelineLayouts(const DeviceInterface & vkd,const VkDevice device,std::vector<PipelineLayoutSp>::iterator begin,std::vector<PipelineLayoutSp>::iterator end)347 void createPipelineLayouts (const DeviceInterface& vkd,
348 const VkDevice device,
349 std::vector<PipelineLayoutSp>::iterator begin,
350 std::vector<PipelineLayoutSp>::iterator end)
351 {
352 for (std::vector<PipelineLayoutSp>::iterator it = begin; it != end; ++it)
353 {
354 const VkPipelineLayoutCreateInfo pipelineLayoutCI =
355 {
356 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // VkStructureType sType
357 DE_NULL, // const void* pNext
358 0u, // VkPipelineLayoutCreateFlags flags
359 0u, // deUint32 setLayoutCount
360 DE_NULL, // const VkDescriptorSetLayout* pSetLayouts
361 0u, // deUint32 pushConstantRangeCount
362 DE_NULL // const VkPushConstantRange* pPushConstantRanges
363 };
364 *it = PipelineLayoutSp(new Unique<VkPipelineLayout>(createPipelineLayout(vkd, device, &pipelineLayoutCI)));
365 }
366 }
367
createRenderPasses(const DeviceInterface & vkd,const VkDevice device,VkAttachmentDescription * colorAttachment,std::vector<RenderPassSp>::iterator begin,std::vector<RenderPassSp>::iterator end)368 void createRenderPasses (const DeviceInterface& vkd,
369 const VkDevice device,
370 VkAttachmentDescription* colorAttachment,
371 std::vector<RenderPassSp>::iterator begin,
372 std::vector<RenderPassSp>::iterator end)
373 {
374 for (std::vector<RenderPassSp>::iterator it = begin; it != end; ++it)
375 {
376 const VkAttachmentReference colorAttachmentRef =
377 {
378 0u, // deUint32 attachment
379 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // VkImageLayout layout
380 };
381
382 const VkSubpassDescription subpassDescription =
383 {
384 0u, // VkSubpassDescriptionFlags flags
385 VK_PIPELINE_BIND_POINT_GRAPHICS, // VkPipelineBindPoint pipelineBindPoint
386 0u, // deUint32 inputAttachmentCount
387 DE_NULL, // const VkAttachmentReference* pInputAttachments
388 1u, // deUint32 colorAttachmentCount
389 &colorAttachmentRef, // const VkAttachmentReference* pColorAttachments
390 DE_NULL, // const VkAttachmentReference* pResolveAttachments
391 DE_NULL, // const VkAttachmentReference* pDepthStencilAttachment
392 0u, // deUint32 preserveAttachmentCount
393 DE_NULL // const deUint32* pPreserveAttachments
394 };
395
396 const VkRenderPassCreateInfo renderPassCI =
397 {
398 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // VkStructureType sType
399 DE_NULL, // const void* pNext
400 0u, // VkRenderPassCreateFlags flags
401 1u, // deUint32 attachmentCount
402 colorAttachment, // const VkAttachmentDescription* pAttachments
403 1u, // deUint32 subpassCount
404 &subpassDescription, // const VkSubpassDescription* pSubpasses
405 0u, // deUint32 dependencyCount
406 DE_NULL // const VkSubpassDependency* pDependencies
407 };
408 *it = RenderPassSp(new Unique<VkRenderPass>(createRenderPass(vkd, device, &renderPassCI)));
409 }
410 }
411
createGraphicsPipelines(const DeviceInterface & vkd,const VkDevice device,VkShaderModule vertexShaderModule,VkShaderModule fragmentShaderModule,VkRenderPass renderPass,VkPipelineLayout pipelineLayout,VkDeviceSize poolEntrySize,de::SharedPtr<vk::ResourceInterface> resourceInterface,std::vector<PipelineSp>::iterator begin,std::vector<PipelineSp>::iterator end)412 void createGraphicsPipelines (const DeviceInterface& vkd,
413 const VkDevice device,
414 VkShaderModule vertexShaderModule,
415 VkShaderModule fragmentShaderModule,
416 VkRenderPass renderPass,
417 VkPipelineLayout pipelineLayout,
418 VkDeviceSize poolEntrySize,
419 de::SharedPtr<vk::ResourceInterface> resourceInterface,
420 std::vector<PipelineSp>::iterator begin,
421 std::vector<PipelineSp>::iterator end)
422 {
423 std::vector<VkPipelineShaderStageCreateInfo> shaderStageCreateInfos;
424 shaderStageCreateInfos.push_back
425 (
426 {
427 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType;
428 DE_NULL, // const void* pNext;
429 (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags;
430 VK_SHADER_STAGE_VERTEX_BIT, // VkShaderStageFlagBits stage;
431 vertexShaderModule, // VkShaderModule shader;
432 "main", // const char* pName;
433 DE_NULL, // const VkSpecializationInfo* pSpecializationInfo;
434 }
435 );
436
437 shaderStageCreateInfos.push_back
438 (
439 {
440 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType;
441 DE_NULL, // const void* pNext;
442 (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags;
443 VK_SHADER_STAGE_FRAGMENT_BIT, // VkShaderStageFlagBits stage;
444 fragmentShaderModule, // VkShaderModule shader;
445 "main", // const char* pName;
446 DE_NULL, // const VkSpecializationInfo* pSpecializationInfo;
447 }
448 );
449
450 for (std::vector<PipelineSp>::iterator it = begin; it != end; ++it)
451 {
452 const VkPipelineVertexInputStateCreateInfo vertexInputStateCreateInfo =
453 {
454 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // VkStructureType sType;
455 DE_NULL, // const void* pNext;
456 (VkPipelineVertexInputStateCreateFlags)0, // VkPipelineVertexInputStateCreateFlags flags;
457 0u, // deUint32 vertexBindingDescriptionCount;
458 DE_NULL, // const VkVertexInputBindingDescription* pVertexBindingDescriptions;
459 0u, // deUint32 vertexAttributeDescriptionCount;
460 DE_NULL // const VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
461 };
462
463 const VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCreateInfo =
464 {
465 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // VkStructureType sType;
466 DE_NULL, // const void* pNext;
467 (VkPipelineInputAssemblyStateCreateFlags)0, // VkPipelineInputAssemblyStateCreateFlags flags;
468 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, // VkPrimitiveTopology topology;
469 VK_FALSE // VkBool32 primitiveRestartEnable;
470 };
471
472 const VkPipelineViewportStateCreateInfo viewPortStateCreateInfo =
473 {
474 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, // VkStructureType sType;
475 DE_NULL, // const void* pNext;
476 (VkPipelineViewportStateCreateFlags)0, // VkPipelineViewportStateCreateFlags flags;
477 1, // deUint32 viewportCount;
478 DE_NULL, // const VkViewport* pViewports;
479 1, // deUint32 scissorCount;
480 DE_NULL // const VkRect2D* pScissors;
481 };
482
483 const VkPipelineRasterizationStateCreateInfo rasterizationStateCreateInfo =
484 {
485 VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // VkStructureType sType;
486 DE_NULL, // const void* pNext;
487 (VkPipelineRasterizationStateCreateFlags)0, // VkPipelineRasterizationStateCreateFlags flags;
488 VK_FALSE, // VkBool32 depthClampEnable;
489 VK_FALSE, // VkBool32 rasterizerDiscardEnable;
490 VK_POLYGON_MODE_FILL, // VkPolygonMode polygonMode;
491 VK_CULL_MODE_BACK_BIT, // VkCullModeFlags cullMode;
492 VK_FRONT_FACE_CLOCKWISE, // VkFrontFace frontFace;
493 VK_FALSE, // VkBool32 depthBiasEnable;
494 0.0f, // float depthBiasConstantFactor;
495 0.0f, // float depthBiasClamp;
496 0.0f, // float depthBiasSlopeFactor;
497 1.0f // float lineWidth;
498 };
499
500 const VkPipelineMultisampleStateCreateInfo multisampleStateCreateInfo =
501 {
502 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, // VkStructureType sType;
503 DE_NULL, // const void* pNext;
504 (VkPipelineMultisampleStateCreateFlags)0, // VkPipelineMultisampleStateCreateFlags flags;
505 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits rasterizationSamples;
506 VK_FALSE, // VkBool32 sampleShadingEnable;
507 0.0f, // float minSampleShading;
508 DE_NULL, // const VkSampleMask* pSampleMask;
509 VK_FALSE, // VkBool32 alphaToCoverageEnable;
510 VK_FALSE // VkBool32 alphaToOneEnable;
511 };
512
513 const VkPipelineColorBlendAttachmentState colorBlendAttachmentState =
514 {
515 VK_FALSE, // VkBool32 blendEnable;
516 VK_BLEND_FACTOR_ZERO, // VkBlendFactor srcColorBlendFactor;
517 VK_BLEND_FACTOR_ZERO, // VkBlendFactor dstColorBlendFactor;
518 VK_BLEND_OP_ADD, // VkBlendOp colorBlendOp;
519 VK_BLEND_FACTOR_ZERO, // VkBlendFactor srcAlphaBlendFactor;
520 VK_BLEND_FACTOR_ZERO, // VkBlendFactor dstAlphaBlendFactor;
521 VK_BLEND_OP_ADD, // VkBlendOp alphaBlendOp;
522 (VkColorComponentFlags)0xFu // VkColorComponentFlags colorWriteMask;
523 };
524
525 const VkPipelineColorBlendStateCreateInfo colorBlendStateCreateInfo =
526 {
527 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, // VkStructureType sType;
528 DE_NULL, // const void* pNext;
529 (VkPipelineColorBlendStateCreateFlags)0, // VkPipelineColorBlendStateCreateFlags flags;
530 DE_FALSE, // VkBool32 logicOpEnable;
531 VK_LOGIC_OP_CLEAR, // VkLogicOp logicOp;
532 1, // deUint32 attachmentCount;
533 &colorBlendAttachmentState, // const VkPipelineColorBlendAttachmentState* pAttachments;
534 { 1.0f, 1.0f, 1.0f, 1.0f } // float blendConstants[4];
535 };
536
537 const VkDynamicState dynamicStates[] =
538 {
539 VK_DYNAMIC_STATE_VIEWPORT,
540 VK_DYNAMIC_STATE_SCISSOR
541 };
542
543 const VkPipelineDynamicStateCreateInfo dynamicStateCreateInfo =
544 {
545 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, // VkStructureType sType;
546 DE_NULL, // const void* pNext;
547 (VkPipelineDynamicStateCreateFlags)0u, // VkPipelineDynamicStateCreateFlags flags;
548 DE_LENGTH_OF_ARRAY(dynamicStates), // deUint32 dynamicStateCount;
549 dynamicStates // const VkDynamicState* pDynamicStates;
550 };
551
552 VkGraphicsPipelineCreateInfo graphicsPipelineCI =
553 {
554 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // VkStructureType sType;
555 DE_NULL, // const void* pNext;
556 (VkPipelineCreateFlags)0, // VkPipelineCreateFlags flags;
557 deUint32(shaderStageCreateInfos.size()), // deUint32 stageCount;
558 shaderStageCreateInfos.data(), // const VkPipelineShaderStageCreateInfo* pStages;
559 &vertexInputStateCreateInfo, // const VkPipelineVertexInputStateCreateInfo* pVertexInputState;
560 &inputAssemblyStateCreateInfo, // const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState;
561 DE_NULL, // const VkPipelineTessellationStateCreateInfo* pTessellationState;
562 &viewPortStateCreateInfo, // const VkPipelineViewportStateCreateInfo* pViewportState;
563 &rasterizationStateCreateInfo, // const VkPipelineRasterizationStateCreateInfo* pRasterizationState;
564 &multisampleStateCreateInfo, // const VkPipelineMultisampleStateCreateInfo* pMultisampleState;
565 DE_NULL, // const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState;
566 &colorBlendStateCreateInfo, // const VkPipelineColorBlendStateCreateInfo* pColorBlendState;
567 &dynamicStateCreateInfo, // const VkPipelineDynamicStateCreateInfo* pDynamicState;
568 pipelineLayout, // VkPipelineLayout layout;
569 renderPass, // VkRenderPass renderPass;
570 0u, // deUint32 subpass;
571 DE_NULL, // VkPipeline basePipelineHandle;
572 0 // int basePipelineIndex;
573 };
574
575 // we have to ensure that proper poolEntrySize is used
576 VkPipelineOfflineCreateInfo pipelineOfflineCreateInfo;
577 if (poolEntrySize != 0u)
578 {
579 pipelineOfflineCreateInfo = resetPipelineOfflineCreateInfo();
580 std::size_t hashValue = calculateGraphicsPipelineHash(graphicsPipelineCI, resourceInterface->getObjectHashes());
581 memcpy(pipelineOfflineCreateInfo.pipelineIdentifier, &hashValue, sizeof(std::size_t));
582 pipelineOfflineCreateInfo.poolEntrySize = poolEntrySize;
583 graphicsPipelineCI.pNext = &pipelineOfflineCreateInfo;
584 }
585
586 *it = PipelineSp(new Unique<VkPipeline>(createGraphicsPipeline(vkd, device, (VkPipelineCache)0u, &graphicsPipelineCI)));
587 }
588 }
589
createComputePipelines(const DeviceInterface & vkd,const VkDevice device,VkShaderModule shaderModule,VkPipelineLayout pipelineLayout,VkDeviceSize poolEntrySize,de::SharedPtr<vk::ResourceInterface> resourceInterface,std::vector<PipelineSp>::iterator begin,std::vector<PipelineSp>::iterator end)590 void createComputePipelines (const DeviceInterface& vkd,
591 const VkDevice device,
592 VkShaderModule shaderModule,
593 VkPipelineLayout pipelineLayout,
594 VkDeviceSize poolEntrySize,
595 de::SharedPtr<vk::ResourceInterface> resourceInterface,
596 std::vector<PipelineSp>::iterator begin,
597 std::vector<PipelineSp>::iterator end)
598 {
599 for (std::vector<PipelineSp>::iterator it = begin; it != end; ++it)
600 {
601 VkPipelineShaderStageCreateInfo shaderStageCreateInfo =
602 {
603 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType;
604 DE_NULL, // const void* pNext;
605 (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags;
606 VK_SHADER_STAGE_COMPUTE_BIT, // VkShaderStageFlagBits stage;
607 shaderModule, // VkShaderModule shader;
608 "main", // const char* pName;
609 DE_NULL, // const VkSpecializationInfo* pSpecializationInfo;
610 };
611
612 VkComputePipelineCreateInfo computePipelineCI =
613 {
614 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, // VkStructureType sType
615 DE_NULL, // const void* pNext
616 0u, // VkPipelineCreateFlags flags
617 shaderStageCreateInfo, // VkPipelineShaderStageCreateInfo stage
618 pipelineLayout, // VkPipelineLayout layout
619 (vk::VkPipeline)0, // VkPipeline basePipelineHandle
620 0u, // deInt32 basePipelineIndex
621 };
622
623 // we have to ensure that proper poolEntrySize is used
624 VkPipelineOfflineCreateInfo pipelineOfflineCreateInfo;
625 if (poolEntrySize != 0u)
626 {
627 pipelineOfflineCreateInfo = resetPipelineOfflineCreateInfo();
628 std::size_t hashValue = calculateComputePipelineHash(computePipelineCI, resourceInterface->getObjectHashes());
629 memcpy(pipelineOfflineCreateInfo.pipelineIdentifier, &hashValue, sizeof(std::size_t));
630 pipelineOfflineCreateInfo.poolEntrySize = poolEntrySize;
631 computePipelineCI.pNext = &pipelineOfflineCreateInfo;
632 }
633
634 *it = PipelineSp(new Unique<VkPipeline>(createComputePipeline(vkd, device, (VkPipelineCache)0u, &computePipelineCI)));
635 }
636 }
637
createDescriptorSetLayouts(const DeviceInterface & vkd,const VkDevice device,std::vector<DescriptorSetLayoutSp>::iterator begin,std::vector<DescriptorSetLayoutSp>::iterator end)638 void createDescriptorSetLayouts (const DeviceInterface& vkd,
639 const VkDevice device,
640 std::vector<DescriptorSetLayoutSp>::iterator begin,
641 std::vector<DescriptorSetLayoutSp>::iterator end)
642 {
643 for (std::vector<DescriptorSetLayoutSp>::iterator it = begin; it != end; ++it)
644 {
645 const VkDescriptorSetLayoutBinding descriptorSetLayoutBinding =
646 {
647 0, // binding
648 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, // descriptorType
649 1u, // descriptorCount
650 VK_SHADER_STAGE_ALL, // stageFlags
651 NULL // pImmutableSamplers
652 };
653
654 const VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCI =
655 {
656 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, // sType
657 NULL, // pNext
658 (VkDescriptorSetLayoutCreateFlags)0u, // flags
659 1u, // bindingCount
660 &descriptorSetLayoutBinding // pBindings
661 };
662 *it = DescriptorSetLayoutSp(new Unique<VkDescriptorSetLayout>(createDescriptorSetLayout(vkd, device, &descriptorSetLayoutCI)));
663 }
664 }
665
createSamplers(const DeviceInterface & vkd,const VkDevice device,std::vector<SamplerSp>::iterator begin,std::vector<SamplerSp>::iterator end)666 void createSamplers (const DeviceInterface& vkd,
667 const VkDevice device,
668 std::vector<SamplerSp>::iterator begin,
669 std::vector<SamplerSp>::iterator end)
670 {
671 for (std::vector<SamplerSp>::iterator it = begin; it != end; ++it)
672 {
673 const VkSamplerCreateInfo samplerCI =
674 {
675 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, //VkStructureType sType
676 DE_NULL, //const void* pNext
677 0u, //VkSamplerCreateFlags flags
678 VK_FILTER_NEAREST, //VkFilter magFilter
679 VK_FILTER_NEAREST, //VkFilter minFilter
680 VK_SAMPLER_MIPMAP_MODE_NEAREST, //VkSamplerMipmapMode mipmapMode
681 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, //VkSamplerAddressMode addressModeU
682 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, //VkSamplerAddressMode addressModeV
683 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, //VkSamplerAddressMode addressModeW
684 0.0f, //float mipLodBias
685 VK_FALSE, //VkBool32 anisotropyEnable
686 1.0f, //float maxAnisotropy
687 VK_FALSE, //VkBool32 compareEnable
688 VK_COMPARE_OP_EQUAL, //VkCompareOp compareOp
689 0.0f, //float minLod
690 0.0f, //float maxLod
691 VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK, //VkBorderColor borderColor
692 VK_TRUE, //VkBool32 unnormalizedCoordinates
693 };
694 *it = SamplerSp(new Unique<VkSampler>(createSampler(vkd, device, &samplerCI)));
695 }
696 }
697
createDescriptorPools(const DeviceInterface & vkd,const VkDevice device,deUint32 maxSets,std::vector<DescriptorPoolSp>::iterator begin,std::vector<DescriptorPoolSp>::iterator end)698 void createDescriptorPools (const DeviceInterface& vkd,
699 const VkDevice device,
700 deUint32 maxSets,
701 std::vector<DescriptorPoolSp>::iterator begin,
702 std::vector<DescriptorPoolSp>::iterator end)
703 {
704 for (std::vector<DescriptorPoolSp>::iterator it = begin; it != end; ++it)
705 {
706 const VkDescriptorPoolSize poolSizes =
707 {
708 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
709 1u
710 };
711 const VkDescriptorPoolCreateInfo descriptorPoolCI =
712 {
713 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, // sType
714 DE_NULL, // pNext
715 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, // flags
716 maxSets, // maxSets
717 1u, // poolSizeCount
718 &poolSizes, // pPoolSizes
719 };
720 *it = DescriptorPoolSp(new Unique<VkDescriptorPool>(createDescriptorPool(vkd, device, &descriptorPoolCI)));
721 }
722 }
723
createDescriptorSets(const DeviceInterface & vkd,const VkDevice device,const VkDescriptorPool descriptorPool,const VkDescriptorSetLayout setLayout,std::vector<DescriptorSetSp>::iterator begin,std::vector<DescriptorSetSp>::iterator end)724 void createDescriptorSets (const DeviceInterface& vkd,
725 const VkDevice device,
726 const VkDescriptorPool descriptorPool,
727 const VkDescriptorSetLayout setLayout,
728 std::vector<DescriptorSetSp>::iterator begin,
729 std::vector<DescriptorSetSp>::iterator end)
730 {
731 for (std::vector<DescriptorSetSp>::iterator it = begin; it != end; ++it)
732 {
733 const VkDescriptorSetAllocateInfo descriptorSetAI =
734 {
735 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, // VkStructureType sType
736 DE_NULL, // const void* pNext
737 descriptorPool, // VkDescriptorPool descriptorPool
738 1u, // deUint32 descriptorSetCount
739 &setLayout // const VkDescriptorSetLayout* pSetLayouts
740 };
741 *it = DescriptorSetSp(new Unique<VkDescriptorSet>(allocateDescriptorSet(vkd, device, &descriptorSetAI)));
742 }
743 }
744
createFramebuffers(const DeviceInterface & vkd,const VkDevice device,const VkRenderPass renderPass,const VkImageView imageView,std::vector<FramebufferSp>::iterator begin,std::vector<FramebufferSp>::iterator end)745 void createFramebuffers (const DeviceInterface& vkd,
746 const VkDevice device,
747 const VkRenderPass renderPass,
748 const VkImageView imageView,
749 std::vector<FramebufferSp>::iterator begin,
750 std::vector<FramebufferSp>::iterator end)
751 {
752 for (std::vector<FramebufferSp>::iterator it = begin; it != end; ++it)
753 {
754 const VkFramebufferCreateInfo framebufferCi =
755 {
756 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // VkStructureType sType
757 DE_NULL, // const void* pNext
758 0u, // VkFramebufferCreateFlags flags
759 renderPass, // VkRenderPass renderPass
760 1u, // uint32_t attachmentCount
761 &imageView, // const VkImageView* pAttachments
762 8u, // uint32_t width
763 8u, // uint32_t height
764 1u // uint32_t layers
765 };
766
767 *it = FramebufferSp(new Unique<VkFramebuffer>(createFramebuffer(vkd, device, &framebufferCi)));
768 }
769 }
770
createCommandPools(const DeviceInterface & vkd,const VkDevice device,std::vector<CommandPoolSp>::iterator begin,std::vector<CommandPoolSp>::iterator end)771 void createCommandPools (const DeviceInterface& vkd,
772 const VkDevice device,
773 std::vector<CommandPoolSp>::iterator begin,
774 std::vector<CommandPoolSp>::iterator end)
775 {
776 for (std::vector<CommandPoolSp>::iterator it = begin; it != end; ++it)
777 {
778 const VkCommandPoolCreateInfo commandPoolCI =
779 {
780 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType
781 DE_NULL, // pNext
782 0u, // flags
783 0u, // queueFamilyIndex
784 };
785 *it = CommandPoolSp(new Unique<VkCommandPool>(createCommandPool(vkd, device, &commandPoolCI)));
786 }
787 }
788
createSamplerYcbcrConversions(const DeviceInterface & vkd,const VkDevice device,std::vector<SamplerYcbcrConversionSp>::iterator begin,std::vector<SamplerYcbcrConversionSp>::iterator end)789 void createSamplerYcbcrConversions (const DeviceInterface& vkd,
790 const VkDevice device,
791 std::vector<SamplerYcbcrConversionSp>::iterator begin,
792 std::vector<SamplerYcbcrConversionSp>::iterator end)
793 {
794 for (std::vector<SamplerYcbcrConversionSp>::iterator it = begin; it != end; ++it)
795 {
796 const VkSamplerYcbcrConversionCreateInfo ycbcrConversionCI =
797 {
798 VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO, // sType
799 DE_NULL, // pNext
800 VK_FORMAT_G8B8G8R8_422_UNORM, // format
801 VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY, // ycbcrModel
802 VK_SAMPLER_YCBCR_RANGE_ITU_FULL, // ycbcrRange
803 {
804 VK_COMPONENT_SWIZZLE_IDENTITY, // r
805 VK_COMPONENT_SWIZZLE_IDENTITY, // g
806 VK_COMPONENT_SWIZZLE_IDENTITY, // b
807 VK_COMPONENT_SWIZZLE_IDENTITY, // a
808 }, // components
809 VK_CHROMA_LOCATION_MIDPOINT, // xChromaOffset
810 VK_CHROMA_LOCATION_MIDPOINT, // yChromaOffset
811 VK_FILTER_NEAREST, // chromaFilter
812 VK_FALSE, // forceExplicitReconstruction
813 };
814 *it = SamplerYcbcrConversionSp(new Unique<VkSamplerYcbcrConversion>(createSamplerYcbcrConversion(vkd, device, &ycbcrConversionCI)));
815 }
816 }
817
818 // Base class for all VkDeviceObjectReservationCreateInfo tests.
819 // Creates a device with 0 for all "max" values / and "RequestCounts"
820 class DeviceObjectReservationInstance : public vkt::TestInstance
821 {
822 public:
823 DeviceObjectReservationInstance (Context& context,
824 const TestParams& testParams_);
825 tcu::TestStatus iterate (void) override;
826
827 virtual Move<VkDevice> createTestDevice (VkDeviceCreateInfo& deviceCreateInfo,
828 VkDeviceObjectReservationCreateInfo& objectInfo,
829 VkPhysicalDeviceVulkanSC10Features& sc10Features);
830 virtual void performTest (const DeviceInterface& vkd,
831 VkDevice device);
832 virtual bool verifyTestResults (const DeviceInterface& vkd,
833 VkDevice device);
834
835 protected:
836 TestParams testParams;
837 vkt::CustomInstance instance;
838 VkPhysicalDevice physicalDevice;
839 };
840
DeviceObjectReservationInstance(Context & context,const TestParams & testParams_)841 DeviceObjectReservationInstance::DeviceObjectReservationInstance (Context& context,
842 const TestParams& testParams_)
843 : vkt::TestInstance ( context )
844 , testParams ( testParams_ )
845 , instance ( vkt::createCustomInstanceFromContext(context) )
846 , physicalDevice ( chooseDevice(instance.getDriver(), instance, context.getTestContext().getCommandLine()) )
847 {
848 }
849
iterate(void)850 tcu::TestStatus DeviceObjectReservationInstance::iterate (void)
851 {
852 const float queuePriority = 1.0f;
853
854 const VkDeviceQueueCreateInfo deviceQueueCI =
855 {
856 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
857 DE_NULL, // pNext
858 (VkDeviceQueueCreateFlags)0u, // flags
859 0, //queueFamilyIndex;
860 1, //queueCount;
861 &queuePriority, //pQueuePriorities;
862 };
863
864 VkDeviceCreateInfo deviceCreateInfo =
865 {
866 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // sType;
867 DE_NULL, // pNext;
868 (VkDeviceCreateFlags)0u, // flags
869 1, // queueRecordCount;
870 &deviceQueueCI, // pRequestedQueues;
871 0, // layerCount;
872 DE_NULL, // ppEnabledLayerNames;
873 0, // extensionCount;
874 DE_NULL, // ppEnabledExtensionNames;
875 DE_NULL, // pEnabledFeatures;
876 };
877
878 void* pNext = DE_NULL;
879
880 VkDeviceObjectReservationCreateInfo objectInfo = resetDeviceObjectReservationCreateInfo();
881 objectInfo.pipelineCacheRequestCount = 1u;
882 objectInfo.pNext = pNext;
883 pNext = &objectInfo;
884
885 VkPhysicalDeviceVulkanSC10Features sc10Features = createDefaultSC10Features();
886 sc10Features.pNext = pNext;
887 pNext = &sc10Features;
888
889 deviceCreateInfo.pNext = pNext;
890
891 Move<VkDevice> device = createTestDevice(deviceCreateInfo, objectInfo, sc10Features);
892 de::MovePtr<DeviceDriverSC, DeinitDeviceDeleter>
893 deviceDriver = de::MovePtr<DeviceDriverSC, DeinitDeviceDeleter>(new DeviceDriverSC(m_context.getPlatformInterface(), instance, *device, m_context.getTestContext().getCommandLine(), m_context.getResourceInterface(), m_context.getDeviceVulkanSC10Properties(), m_context.getDeviceProperties()),
894 DeinitDeviceDeleter(m_context.getResourceInterface().get(), *device));
895
896 performTest(*deviceDriver, *device);
897
898 const VkQueue queue = getDeviceQueue(*deviceDriver, *device, 0, 0);
899 VK_CHECK(deviceDriver->queueWaitIdle(queue));
900
901 if (!verifyTestResults(*deviceDriver, *device))
902 return tcu::TestStatus::fail("Failed");
903 return tcu::TestStatus::pass("Pass");
904 }
905
createTestDevice(VkDeviceCreateInfo & deviceCreateInfo,VkDeviceObjectReservationCreateInfo & objectInfo,VkPhysicalDeviceVulkanSC10Features & sc10Features)906 Move<VkDevice> DeviceObjectReservationInstance::createTestDevice (VkDeviceCreateInfo& deviceCreateInfo,
907 VkDeviceObjectReservationCreateInfo& objectInfo,
908 VkPhysicalDeviceVulkanSC10Features& sc10Features)
909 {
910 DE_UNREF(sc10Features);
911
912 // perform any non pipeline operations - create 2 semaphores
913 objectInfo.semaphoreRequestCount = 2u;
914
915 return createCustomDevice(m_context.getTestContext().getCommandLine().isValidationEnabled(), m_context.getPlatformInterface(), instance, instance.getDriver(), physicalDevice, &deviceCreateInfo);
916 }
917
performTest(const DeviceInterface & vkd,VkDevice device)918 void DeviceObjectReservationInstance::performTest (const DeviceInterface& vkd,
919 VkDevice device)
920 {
921 std::vector<SemaphoreSp> semaphores(2u);
922 createSemaphores(vkd, device, begin(semaphores), end(semaphores));
923 }
924
verifyTestResults(const DeviceInterface & vkd,VkDevice device)925 bool DeviceObjectReservationInstance::verifyTestResults (const DeviceInterface& vkd,
926 VkDevice device)
927 {
928 DE_UNREF(vkd);
929 DE_UNREF(device);
930 return true;
931 }
932
933 // Creates device with multiple VkDeviceObjectReservationCreateInfo and ensures that the limits of an individual VkDeviceObjectReservationCreateInfo can be exceeded.
934 class MultipleReservation : public DeviceObjectReservationInstance
935 {
936 public:
MultipleReservation(Context & context,const TestParams & testParams_)937 MultipleReservation (Context& context,
938 const TestParams& testParams_)
939 : DeviceObjectReservationInstance(context, testParams_)
940 {
941 }
createTestDevice(VkDeviceCreateInfo & deviceCreateInfo,VkDeviceObjectReservationCreateInfo & objectInfo,VkPhysicalDeviceVulkanSC10Features & sc10Features)942 Move<VkDevice> createTestDevice (VkDeviceCreateInfo& deviceCreateInfo,
943 VkDeviceObjectReservationCreateInfo& objectInfo,
944 VkPhysicalDeviceVulkanSC10Features& sc10Features) override
945 {
946 DE_UNREF(sc10Features);
947
948 VkDeviceObjectReservationCreateInfo thirdObjectInfo = resetDeviceObjectReservationCreateInfo();
949 thirdObjectInfo.deviceMemoryRequestCount = 2;
950
951 VkDeviceObjectReservationCreateInfo secondObjectInfo = resetDeviceObjectReservationCreateInfo();
952 secondObjectInfo.deviceMemoryRequestCount = 2;
953 secondObjectInfo.pNext = &thirdObjectInfo;
954
955 objectInfo.deviceMemoryRequestCount = 2;
956 objectInfo.pNext = &secondObjectInfo;
957
958 return createCustomDevice(m_context.getTestContext().getCommandLine().isValidationEnabled(), m_context.getPlatformInterface(), instance, instance.getDriver(), physicalDevice, &deviceCreateInfo);
959 }
960
performTest(const DeviceInterface & vkd,VkDevice device)961 void performTest (const DeviceInterface& vkd,
962 VkDevice device) override
963 {
964 std::vector<VkDeviceMemory> memoryObjects(6, (VkDeviceMemory)0);
965 for (size_t ndx = 0; ndx < 6; ndx++)
966 {
967 VkMemoryAllocateInfo alloc =
968 {
969 VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType
970 DE_NULL, // pNext
971 128U, // allocationSize
972 0U // memoryTypeIndex;
973 };
974
975 VK_CHECK(vkd.allocateMemory(device, &alloc, (const VkAllocationCallbacks*)DE_NULL, &memoryObjects[ndx]));
976
977 TCU_CHECK(!!memoryObjects[ndx]);
978 }
979 }
980 };
981
checkSupportVerifyMaxValues(vkt::Context & context,TestParams testParams)982 void checkSupportVerifyMaxValues (vkt::Context& context, TestParams testParams)
983 {
984 if (testParams.testMaxValues == TMV_MAX_PIPELINESTATISTICS_QUERIES_PER_POOL && context.getDeviceFeatures().pipelineStatisticsQuery == VK_FALSE)
985 TCU_THROW(NotSupportedError, "pipelineStatisticsQuery is not supported");
986 }
987
988 // For each of the various resource "max" values, create resources that exercise the maximum values requested
989
990 class VerifyMaxValues : public DeviceObjectReservationInstance
991 {
992 public:
VerifyMaxValues(Context & context,const TestParams & testParams_)993 VerifyMaxValues (Context& context,
994 const TestParams& testParams_)
995 : DeviceObjectReservationInstance(context, testParams_)
996 {
997 }
createTestDevice(VkDeviceCreateInfo & deviceCreateInfo,VkDeviceObjectReservationCreateInfo & objectInfo,VkPhysicalDeviceVulkanSC10Features & sc10Features)998 Move<VkDevice> createTestDevice (VkDeviceCreateInfo& deviceCreateInfo,
999 VkDeviceObjectReservationCreateInfo& objectInfo,
1000 VkPhysicalDeviceVulkanSC10Features& sc10Features) override
1001 {
1002 DE_UNREF(sc10Features);
1003 switch (testParams.testMaxValues)
1004 {
1005 case TMV_DESCRIPTOR_SET_LAYOUT_BINDING_LIMIT:
1006 objectInfo.descriptorSetLayoutBindingLimit = VERIFYMAXVALUES_OBJECT_COUNT+1u;
1007 objectInfo.descriptorSetLayoutBindingRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1008 objectInfo.descriptorSetLayoutRequestCount = 1u;
1009 break;
1010 case TMV_MAX_IMAGEVIEW_MIPLEVELS:
1011 objectInfo.maxImageViewMipLevels = VERIFYMAXVALUES_MIPLEVELS;
1012 objectInfo.maxImageViewArrayLayers = 1u;
1013 objectInfo.imageRequestCount = 1u;
1014 objectInfo.deviceMemoryRequestCount = 1u;
1015 break;
1016 case TMV_MAX_IMAGEVIEW_ARRAYLAYERS:
1017 objectInfo.maxImageViewMipLevels = 1u;
1018 objectInfo.maxImageViewArrayLayers = VERIFYMAXVALUES_ARRAYLAYERS;
1019 objectInfo.imageRequestCount = 1u;
1020 objectInfo.deviceMemoryRequestCount = 1u;
1021 break;
1022 case TMV_MAX_LAYEREDIMAGEVIEW_MIPLEVELS:
1023 objectInfo.maxLayeredImageViewMipLevels = VERIFYMAXVALUES_MIPLEVELS;
1024 objectInfo.maxImageViewArrayLayers = VERIFYMAXVALUES_ARRAYLAYERS;
1025 objectInfo.imageRequestCount = 1u;
1026 objectInfo.deviceMemoryRequestCount = 1u;
1027 break;
1028 case TMV_MAX_OCCLUSION_QUERIES_PER_POOL:
1029 objectInfo.maxOcclusionQueriesPerPool = VERIFYMAXVALUES_OBJECT_COUNT;
1030 objectInfo.queryPoolRequestCount = 1u;
1031 break;
1032 case TMV_MAX_PIPELINESTATISTICS_QUERIES_PER_POOL:
1033 objectInfo.maxPipelineStatisticsQueriesPerPool = VERIFYMAXVALUES_OBJECT_COUNT;
1034 objectInfo.queryPoolRequestCount = 1u;
1035 break;
1036 case TMV_MAX_TIMESTAMP_QUERIES_PER_POOL:
1037 objectInfo.maxTimestampQueriesPerPool = VERIFYMAXVALUES_OBJECT_COUNT;
1038 objectInfo.queryPoolRequestCount = 1u;
1039 break;
1040 default:
1041 TCU_THROW(InternalError, "Unsupported max value");
1042 }
1043
1044 return createCustomDevice(m_context.getTestContext().getCommandLine().isValidationEnabled(), m_context.getPlatformInterface(), instance, instance.getDriver(), physicalDevice, &deviceCreateInfo);
1045 }
1046
performTest(const DeviceInterface & vkd,VkDevice device)1047 void performTest (const DeviceInterface& vkd,
1048 VkDevice device) override
1049 {
1050 SimpleAllocator allocator(vkd, device, getPhysicalDeviceMemoryProperties(instance.getDriver(), physicalDevice));
1051 de::MovePtr<ImageWithMemory> image;
1052 Move<VkQueryPool> queryPool;
1053 Move<VkDescriptorSetLayout> descriptorSetLayout;
1054 deUint32 queueFamilyIndex = 0u;
1055
1056 switch (testParams.testMaxValues)
1057 {
1058 case TMV_DESCRIPTOR_SET_LAYOUT_BINDING_LIMIT:
1059 {
1060 const VkDescriptorSetLayoutBinding binding =
1061 {
1062 VERIFYMAXVALUES_OBJECT_COUNT, // binding
1063 VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, // descriptorType
1064 1u, // descriptorCount
1065 VK_SHADER_STAGE_ALL, // stageFlags
1066 DE_NULL, // pImmutableSamplers
1067 };
1068
1069 const VkDescriptorSetLayoutCreateInfo layoutCreateInfo =
1070 {
1071 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
1072 DE_NULL, // pNext
1073 0u, // flags
1074 1u, // bindingCount
1075 &binding, // pBindings
1076 };
1077 descriptorSetLayout = createDescriptorSetLayout(vkd, device, &layoutCreateInfo);
1078 break;
1079 }
1080 case TMV_MAX_IMAGEVIEW_MIPLEVELS:
1081 {
1082 const VkImageCreateInfo imageCreateInfo =
1083 {
1084 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
1085 DE_NULL, // const void* pNext;
1086 (VkImageCreateFlags)0u, // VkImageCreateFlags flags;
1087 VK_IMAGE_TYPE_2D, // VkImageType imageType;
1088 VK_FORMAT_R8_UNORM, // VkFormat format;
1089 {
1090 1 << VERIFYMAXVALUES_MIPLEVELS, // deUint32 width;
1091 1 << VERIFYMAXVALUES_MIPLEVELS, // deUint32 height;
1092 1u // deUint32 depth;
1093 }, // VkExtent3D extent;
1094 VERIFYMAXVALUES_MIPLEVELS, // deUint32 mipLevels;
1095 1u, // deUint32 arrayLayers;
1096 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
1097 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
1098 VK_IMAGE_USAGE_SAMPLED_BIT, // VkImageUsageFlags usage;
1099 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1100 1u, // deUint32 queueFamilyIndexCount;
1101 &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
1102 VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout;
1103 };
1104 image = de::MovePtr<ImageWithMemory>(new ImageWithMemory(vkd, device, allocator, imageCreateInfo, MemoryRequirement::Any));
1105 break;
1106 }
1107 case TMV_MAX_IMAGEVIEW_ARRAYLAYERS:
1108 {
1109 const VkImageCreateInfo imageCreateInfo =
1110 {
1111 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
1112 DE_NULL, // const void* pNext;
1113 (VkImageCreateFlags)0u, // VkImageCreateFlags flags;
1114 VK_IMAGE_TYPE_2D, // VkImageType imageType;
1115 VK_FORMAT_R8_UNORM, // VkFormat format;
1116 {
1117 16U, // deUint32 width;
1118 16U, // deUint32 height;
1119 1u // deUint32 depth;
1120 }, // VkExtent3D extent;
1121 1u, // deUint32 mipLevels;
1122 VERIFYMAXVALUES_ARRAYLAYERS, // deUint32 arrayLayers;
1123 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
1124 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
1125 VK_IMAGE_USAGE_SAMPLED_BIT, // VkImageUsageFlags usage;
1126 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1127 1u, // deUint32 queueFamilyIndexCount;
1128 &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
1129 VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout;
1130 };
1131 image = de::MovePtr<ImageWithMemory>(new ImageWithMemory(vkd, device, allocator, imageCreateInfo, MemoryRequirement::Any));
1132 break;
1133 }
1134 case TMV_MAX_LAYEREDIMAGEVIEW_MIPLEVELS:
1135 {
1136 const VkImageCreateInfo imageCreateInfo =
1137 {
1138 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
1139 DE_NULL, // const void* pNext;
1140 (VkImageCreateFlags)0u, // VkImageCreateFlags flags;
1141 VK_IMAGE_TYPE_2D, // VkImageType imageType;
1142 VK_FORMAT_R8_UNORM, // VkFormat format;
1143 {
1144 1 << VERIFYMAXVALUES_MIPLEVELS, // deUint32 width;
1145 1 << VERIFYMAXVALUES_MIPLEVELS, // deUint32 height;
1146 1u // deUint32 depth;
1147 }, // VkExtent3D extent;
1148 VERIFYMAXVALUES_MIPLEVELS, // deUint32 mipLevels;
1149 VERIFYMAXVALUES_ARRAYLAYERS, // deUint32 arrayLayers;
1150 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
1151 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
1152 VK_IMAGE_USAGE_SAMPLED_BIT, // VkImageUsageFlags usage;
1153 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1154 1u, // deUint32 queueFamilyIndexCount;
1155 &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
1156 VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout;
1157 };
1158 image = de::MovePtr<ImageWithMemory>(new ImageWithMemory(vkd, device, allocator, imageCreateInfo, MemoryRequirement::Any));
1159 break;
1160 }
1161 case TMV_MAX_OCCLUSION_QUERIES_PER_POOL:
1162 {
1163 const VkQueryPoolCreateInfo queryPoolCreateInfo =
1164 {
1165 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // VkStructureType sType;
1166 DE_NULL, // const void* pNext;
1167 (VkQueryPoolCreateFlags)0, // VkQueryPoolCreateFlags flags;
1168 VK_QUERY_TYPE_OCCLUSION, // VkQueryType queryType;
1169 VERIFYMAXVALUES_OBJECT_COUNT, // deUint32 queryCount;
1170 0u, // VkQueryPipelineStatisticFlags pipelineStatistics;
1171 };
1172 queryPool = createQueryPool(vkd, device, &queryPoolCreateInfo);
1173 break;
1174 }
1175 case TMV_MAX_PIPELINESTATISTICS_QUERIES_PER_POOL:
1176 {
1177 const VkQueryPoolCreateInfo queryPoolCreateInfo =
1178 {
1179 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // VkStructureType sType;
1180 DE_NULL, // const void* pNext;
1181 (VkQueryPoolCreateFlags)0, // VkQueryPoolCreateFlags flags;
1182 VK_QUERY_TYPE_PIPELINE_STATISTICS, // VkQueryType queryType;
1183 VERIFYMAXVALUES_OBJECT_COUNT, // deUint32 queryCount;
1184 0u, // VkQueryPipelineStatisticFlags pipelineStatistics;
1185 };
1186 queryPool = createQueryPool(vkd, device, &queryPoolCreateInfo);
1187 break;
1188 }
1189 case TMV_MAX_TIMESTAMP_QUERIES_PER_POOL:
1190 {
1191 const VkQueryPoolCreateInfo queryPoolCreateInfo =
1192 {
1193 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, // VkStructureType sType;
1194 DE_NULL, // const void* pNext;
1195 (VkQueryPoolCreateFlags)0, // VkQueryPoolCreateFlags flags;
1196 VK_QUERY_TYPE_TIMESTAMP, // VkQueryType queryType;
1197 VERIFYMAXVALUES_OBJECT_COUNT, // deUint32 queryCount;
1198 0u, // VkQueryPipelineStatisticFlags pipelineStatistics;
1199 };
1200 queryPool = createQueryPool(vkd, device, &queryPoolCreateInfo);
1201 break;
1202 }
1203 default:
1204 TCU_THROW(InternalError, "Unsupported max value");
1205 }
1206 }
1207 };
1208
checkSupportVerifyRequestCounts(vkt::Context & context,TestParams testParams)1209 void checkSupportVerifyRequestCounts (vkt::Context& context, TestParams testParams)
1210 {
1211 if (testParams.testRequestCounts == TRC_SAMPLERYCBCRCONVERSION && context.getDeviceVulkan11Features().samplerYcbcrConversion == VK_FALSE)
1212 TCU_THROW(NotSupportedError, "samplerYcbcrConversion is not supported");
1213 }
1214
1215 // create programs for VerifyRequestCounts tests
1216 struct ProgramsVerifyLimits
1217 {
initvkt::sc::__anon4737444a0111::ProgramsVerifyLimits1218 void init(SourceCollections& dst, TestParams testParams) const
1219 {
1220 if (testParams.testRequestCounts == TRC_GRAPHICS_PIPELINE || testParams.testPoolSizeType != PST_UNDEFINED)
1221 {
1222 dst.glslSources.add("vertex") << glu::VertexSource(
1223 "#version 450\n"
1224 "\n"
1225 "void main (void)\n"
1226 "{\n"
1227 " gl_Position = vec4(0);\n"
1228 "}\n");
1229 dst.glslSources.add("fragment") << glu::FragmentSource(
1230 "#version 450\n"
1231 "\n"
1232 "layout(location=0) out vec4 x;\n"
1233 "void main (void)\n"
1234 "{\n"
1235 " x = vec4(1);\n"
1236 "}\n");
1237 }
1238 else if (testParams.testRequestCounts == TRC_COMPUTE_PIPELINE)
1239 {
1240 dst.glslSources.add("compute") << glu::ComputeSource(
1241 "#version 450\n"
1242 "layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;\n"
1243 "void main (void)\n"
1244 "{\n"
1245 " uvec4 x = uvec4(0);\n"
1246 "}\n");
1247 }
1248 }
1249 };
1250
1251 // For each of the various resource "max" values, create resources that exercise the maximum values requested
1252 class VerifyRequestCounts : public DeviceObjectReservationInstance
1253 {
1254 public:
VerifyRequestCounts(Context & context,const TestParams & testParams_)1255 VerifyRequestCounts (Context& context,
1256 const TestParams& testParams_)
1257 : DeviceObjectReservationInstance(context, testParams_)
1258 {
1259 }
1260
1261
createTestDevice(VkDeviceCreateInfo & deviceCreateInfo,VkDeviceObjectReservationCreateInfo & objectInfo,VkPhysicalDeviceVulkanSC10Features & sc10Features)1262 Move<VkDevice> createTestDevice (VkDeviceCreateInfo& deviceCreateInfo,
1263 VkDeviceObjectReservationCreateInfo& objectInfo,
1264 VkPhysicalDeviceVulkanSC10Features& sc10Features) override
1265 {
1266 DE_UNREF(sc10Features);
1267
1268 std::vector<VkPipelinePoolSize> poolSizes;
1269 VkDeviceSize pipelineDefaultSize = VkDeviceSize(m_context.getTestContext().getCommandLine().getPipelineDefaultSize());
1270
1271 switch (testParams.testRequestCounts)
1272 {
1273 case TRC_SEMAPHORE:
1274 objectInfo.semaphoreRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1275 break;
1276 case TRC_COMMAND_BUFFER:
1277 objectInfo.commandPoolRequestCount = 1u;
1278 objectInfo.commandBufferRequestCount = 2 * VERIFYMAXVALUES_OBJECT_COUNT + (VERIFYMAXVALUES_OBJECT_COUNT - VERIFYMAXVALUES_OBJECT_COUNT / 2) ;
1279 break;
1280 case TRC_FENCE:
1281 objectInfo.fenceRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1282 break;
1283 case TRC_DEVICE_MEMORY:
1284 objectInfo.deviceMemoryRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1285 break;
1286 case TRC_BUFFER:
1287 objectInfo.bufferRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1288 break;
1289 case TRC_IMAGE:
1290 objectInfo.imageRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1291 objectInfo.maxImageViewMipLevels = 1u;
1292 objectInfo.maxImageViewArrayLayers = 1u;
1293 break;
1294 case TRC_EVENT:
1295 objectInfo.eventRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1296 break;
1297 case TRC_QUERY_POOL:
1298 objectInfo.queryPoolRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1299 break;
1300 case TRC_BUFFER_VIEW:
1301 objectInfo.deviceMemoryRequestCount = 1u;
1302 objectInfo.bufferRequestCount = 1u;
1303 objectInfo.bufferViewRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1304 break;
1305 case TRC_IMAGE_VIEW:
1306 objectInfo.deviceMemoryRequestCount = 1u;
1307 objectInfo.imageViewRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1308 objectInfo.imageRequestCount = 1u;
1309 objectInfo.maxImageViewMipLevels = 1u;
1310 objectInfo.maxImageViewArrayLayers = 1u;
1311 break;
1312 case TRC_LAYERED_IMAGE_VIEW:
1313 objectInfo.deviceMemoryRequestCount = 1u;
1314 objectInfo.imageViewRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1315 objectInfo.layeredImageViewRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1316 objectInfo.imageRequestCount = 1u;
1317 objectInfo.maxImageViewMipLevels = 1u;
1318 objectInfo.maxImageViewArrayLayers = VERIFYMAXVALUES_ARRAYLAYERS;
1319 break;
1320 case TRC_PIPELINE_LAYOUT:
1321 objectInfo.pipelineLayoutRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1322 break;
1323 case TRC_RENDER_PASS:
1324 objectInfo.renderPassRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1325 objectInfo.subpassDescriptionRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1326 objectInfo.attachmentDescriptionRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1327 break;
1328 case TRC_GRAPHICS_PIPELINE:
1329 objectInfo.pipelineLayoutRequestCount = 1u;
1330 objectInfo.renderPassRequestCount = 1u;
1331 objectInfo.subpassDescriptionRequestCount = 1u;
1332 objectInfo.attachmentDescriptionRequestCount = 1u;
1333 objectInfo.graphicsPipelineRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1334 poolSizes.push_back({ VK_STRUCTURE_TYPE_PIPELINE_POOL_SIZE, DE_NULL, pipelineDefaultSize, VERIFYMAXVALUES_OBJECT_COUNT });
1335 break;
1336 case TRC_COMPUTE_PIPELINE:
1337 objectInfo.pipelineLayoutRequestCount = 1u;
1338 objectInfo.computePipelineRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1339 poolSizes.push_back({ VK_STRUCTURE_TYPE_PIPELINE_POOL_SIZE, DE_NULL, pipelineDefaultSize, VERIFYMAXVALUES_OBJECT_COUNT });
1340 break;
1341 case TRC_DESCRIPTORSET_LAYOUT:
1342 objectInfo.descriptorSetLayoutRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1343 objectInfo.descriptorSetLayoutBindingRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1344 objectInfo.descriptorSetLayoutBindingLimit = 2u;
1345 break;
1346 case TRC_SAMPLER:
1347 objectInfo.samplerRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1348 break;
1349 case TRC_DESCRIPTOR_POOL:
1350 objectInfo.descriptorPoolRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1351 break;
1352 case TRC_DESCRIPTORSET:
1353 objectInfo.descriptorSetLayoutRequestCount = 1u;
1354 objectInfo.descriptorSetLayoutBindingRequestCount = 1u;
1355 objectInfo.descriptorSetLayoutBindingLimit = 2u;
1356 objectInfo.descriptorPoolRequestCount = 1u;
1357 objectInfo.descriptorSetRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1358 break;
1359 case TRC_FRAMEBUFFER:
1360 objectInfo.deviceMemoryRequestCount = 1u;
1361 objectInfo.imageViewRequestCount = 1u;
1362 objectInfo.imageRequestCount = 1u;
1363 objectInfo.maxImageViewMipLevels = 1u;
1364 objectInfo.maxImageViewArrayLayers = 1u;
1365 objectInfo.renderPassRequestCount = 1u;
1366 objectInfo.subpassDescriptionRequestCount = 1u;
1367 objectInfo.attachmentDescriptionRequestCount = 1u;
1368 objectInfo.framebufferRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1369 break;
1370 case TRC_COMMANDPOOL:
1371 objectInfo.commandPoolRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1372 objectInfo.commandBufferRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1373 break;
1374 case TRC_SAMPLERYCBCRCONVERSION:
1375 objectInfo.samplerYcbcrConversionRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1376 break;
1377 // case TRC_SURFACE:
1378 // objectInfo.surfaceRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1379 // break;
1380 // case TRC_SWAPCHAIN:
1381 // objectInfo.swapchainRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1382 // break;
1383 // case TRC_DISPLAY_MODE:
1384 // objectInfo.displayModeRequestCount = VERIFYMAXVALUES_OBJECT_COUNT;
1385 // break;
1386 default:
1387 TCU_THROW(InternalError, "Unsupported request count");
1388 }
1389
1390 objectInfo.pipelinePoolSizeCount = deUint32(poolSizes.size());
1391 objectInfo.pPipelinePoolSizes = poolSizes.empty() ? DE_NULL : poolSizes.data();
1392
1393 return createCustomDevice(m_context.getTestContext().getCommandLine().isValidationEnabled(), m_context.getPlatformInterface(), instance, instance.getDriver(), physicalDevice, &deviceCreateInfo);
1394 }
1395
1396
performTest(const DeviceInterface & vkd,VkDevice device)1397 void performTest (const DeviceInterface& vkd,
1398 VkDevice device) override
1399 {
1400 SimpleAllocator allocator (vkd, device, getPhysicalDeviceMemoryProperties(instance.getDriver(), physicalDevice));
1401 VkDeviceSize pipelineDefaultSize = VkDeviceSize(m_context.getTestContext().getCommandLine().getPipelineDefaultSize());
1402 deUint32 queueFamilyIndex = 0u;
1403
1404 switch (testParams.testRequestCounts)
1405 {
1406 case TRC_SEMAPHORE:
1407 {
1408 std::vector<SemaphoreSp> semaphores(VERIFYMAXVALUES_OBJECT_COUNT);
1409 createSemaphores(vkd, device, begin(semaphores), end(semaphores));
1410 std::fill(begin(semaphores) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(semaphores), SemaphoreSp());
1411 createSemaphores(vkd, device, begin(semaphores) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(semaphores));
1412 std::fill(begin(semaphores), end(semaphores), SemaphoreSp());
1413 createSemaphores(vkd, device, begin(semaphores), end(semaphores));
1414 break;
1415 }
1416 case TRC_COMMAND_BUFFER:
1417 {
1418 std::vector<CommandPoolSp> commandPools(1u);
1419 createCommandPools(vkd, device, begin(commandPools), end(commandPools));
1420
1421 std::vector<CommandBufferSp> commandBuffers(VERIFYMAXVALUES_OBJECT_COUNT);
1422 createCommandBuffers(vkd, device, commandPools[0]->get(), begin(commandBuffers), end(commandBuffers));
1423 std::fill(begin(commandBuffers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(commandBuffers), CommandBufferSp());
1424 createCommandBuffers(vkd, device, commandPools[0]->get(), begin(commandBuffers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(commandBuffers));
1425 std::fill(begin(commandBuffers), end(commandBuffers), CommandBufferSp());
1426 createCommandBuffers(vkd, device, commandPools[0]->get(), begin(commandBuffers), end(commandBuffers));
1427 break;
1428 }
1429 case TRC_FENCE:
1430 {
1431 std::vector<FenceSp> fences(VERIFYMAXVALUES_OBJECT_COUNT);
1432 createFences(vkd, device, begin(fences), end(fences));
1433 std::fill(begin(fences) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(fences), FenceSp());
1434 createFences(vkd, device, begin(fences) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(fences));
1435 std::fill(begin(fences), end(fences), FenceSp());
1436 createFences(vkd, device, begin(fences), end(fences));
1437 break;
1438 }
1439 case TRC_DEVICE_MEMORY:
1440 {
1441 std::vector<DeviceMemorySp> mems(VERIFYMAXVALUES_OBJECT_COUNT);
1442 allocateDeviceMemory(vkd, device, 16U, begin(mems), end(mems));
1443 break;
1444 }
1445 case TRC_BUFFER:
1446 {
1447 std::vector<BufferSp> buffers(VERIFYMAXVALUES_OBJECT_COUNT);
1448 createBuffers(vkd, device, 32ull, begin(buffers), end(buffers));
1449 std::fill(begin(buffers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(buffers), BufferSp());
1450 createBuffers(vkd, device, 32ull, begin(buffers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(buffers));
1451 std::fill(begin(buffers), end(buffers), BufferSp());
1452 createBuffers(vkd, device, 32ull, begin(buffers), end(buffers));
1453 break;
1454 }
1455 case TRC_IMAGE:
1456 {
1457 std::vector<ImageSp> images(VERIFYMAXVALUES_OBJECT_COUNT);
1458 createImages(vkd, device, 16u, begin(images), end(images));
1459 std::fill(begin(images) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(images), ImageSp());
1460 createImages(vkd, device, 16u, begin(images) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(images));
1461 std::fill(begin(images), end(images), ImageSp());
1462 createImages(vkd, device, 16u, begin(images), end(images));
1463 break;
1464 }
1465 case TRC_EVENT:
1466 {
1467 std::vector<EventSp> events(VERIFYMAXVALUES_OBJECT_COUNT);
1468 createEvents(vkd, device, begin(events), end(events));
1469 std::fill(begin(events) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(events), EventSp());
1470 createEvents(vkd, device, begin(events) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(events));
1471 std::fill(begin(events), end(events), EventSp());
1472 createEvents(vkd, device, begin(events), end(events));
1473 break;
1474 }
1475 case TRC_QUERY_POOL:
1476 {
1477 std::vector<QueryPoolSp> queryPools(VERIFYMAXVALUES_OBJECT_COUNT);
1478 createQueryPools(vkd, device, begin(queryPools), end(queryPools));
1479 break;
1480 }
1481 case TRC_BUFFER_VIEW:
1482 {
1483 const VkBufferCreateInfo bufferCI = makeBufferCreateInfo(128ull, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
1484 BufferWithMemory buffer(vkd, device, allocator, bufferCI, MemoryRequirement::HostVisible);
1485
1486 std::vector<BufferViewSp> bufferViews(VERIFYMAXVALUES_OBJECT_COUNT);
1487 createBufferViews(vkd, device, buffer.get(), 128ull, begin(bufferViews), end(bufferViews));
1488 std::fill(begin(bufferViews) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(bufferViews), BufferViewSp());
1489 createBufferViews(vkd, device, buffer.get(), 128ull, begin(bufferViews) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(bufferViews));
1490 std::fill(begin(bufferViews), end(bufferViews), BufferViewSp());
1491 createBufferViews(vkd, device, buffer.get(), 128ull, begin(bufferViews), end(bufferViews));
1492 break;
1493 }
1494 case TRC_IMAGE_VIEW:
1495 {
1496 const VkImageCreateInfo imageCI =
1497 {
1498 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
1499 DE_NULL, // const void* pNext;
1500 (VkImageCreateFlags)0u, // VkImageCreateFlags flags;
1501 VK_IMAGE_TYPE_2D, // VkImageType imageType;
1502 VK_FORMAT_R8_UNORM, // VkFormat format;
1503 {
1504 8u, // deUint32 width;
1505 8u, // deUint32 height;
1506 1u // deUint32 depth;
1507 }, // VkExtent3D extent;
1508 1u, // deUint32 mipLevels;
1509 1u, // deUint32 arrayLayers;
1510 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
1511 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
1512 VK_IMAGE_USAGE_SAMPLED_BIT, // VkImageUsageFlags usage;
1513 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1514 1u, // deUint32 queueFamilyIndexCount;
1515 &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
1516 VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout;
1517 };
1518 ImageWithMemory image(vkd, device, allocator, imageCI, MemoryRequirement::Any);
1519
1520 std::vector<ImageViewSp> imageViews(VERIFYMAXVALUES_OBJECT_COUNT);
1521 createImageViews(vkd, device, image.get(), begin(imageViews), end(imageViews));
1522 std::fill(begin(imageViews) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(imageViews), ImageViewSp());
1523 createImageViews(vkd, device, image.get(), begin(imageViews) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(imageViews));
1524 std::fill(begin(imageViews), end(imageViews), ImageViewSp());
1525 createImageViews(vkd, device, image.get(), begin(imageViews), end(imageViews));
1526 break;
1527 }
1528 case TRC_LAYERED_IMAGE_VIEW:
1529 {
1530 const VkImageCreateInfo imageCI =
1531 {
1532 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
1533 DE_NULL, // const void* pNext;
1534 (VkImageCreateFlags)0u, // VkImageCreateFlags flags;
1535 VK_IMAGE_TYPE_2D, // VkImageType imageType;
1536 VK_FORMAT_R8_UNORM, // VkFormat format;
1537 {
1538 8u, // deUint32 width;
1539 8u, // deUint32 height;
1540 1u // deUint32 depth;
1541 }, // VkExtent3D extent;
1542 1u, // deUint32 mipLevels;
1543 VERIFYMAXVALUES_ARRAYLAYERS, // deUint32 arrayLayers;
1544 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
1545 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
1546 VK_IMAGE_USAGE_SAMPLED_BIT, // VkImageUsageFlags usage;
1547 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1548 1u, // deUint32 queueFamilyIndexCount;
1549 &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
1550 VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout;
1551 };
1552 ImageWithMemory image(vkd, device, allocator, imageCI, MemoryRequirement::Any);
1553
1554 std::vector<ImageViewSp> imageViews(VERIFYMAXVALUES_OBJECT_COUNT);
1555 createImageViews(vkd, device, image.get(), begin(imageViews), end(imageViews));
1556 std::fill(begin(imageViews) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(imageViews), ImageViewSp());
1557 createImageViews(vkd, device, image.get(), begin(imageViews) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(imageViews));
1558 std::fill(begin(imageViews), end(imageViews), ImageViewSp());
1559 createImageViews(vkd, device, image.get(), begin(imageViews), end(imageViews));
1560 break;
1561 }
1562 case TRC_PIPELINE_LAYOUT:
1563 {
1564 std::vector<PipelineLayoutSp> pipelineLayouts(VERIFYMAXVALUES_OBJECT_COUNT);
1565 createPipelineLayouts(vkd, device, begin(pipelineLayouts), end(pipelineLayouts));
1566 std::fill(begin(pipelineLayouts) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(pipelineLayouts), PipelineLayoutSp());
1567 createPipelineLayouts(vkd, device, begin(pipelineLayouts) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(pipelineLayouts));
1568 std::fill(begin(pipelineLayouts), end(pipelineLayouts), PipelineLayoutSp());
1569 createPipelineLayouts(vkd, device, begin(pipelineLayouts), end(pipelineLayouts));
1570 break;
1571 }
1572 case TRC_RENDER_PASS:
1573 {
1574 VkAttachmentDescription attachmentDescription =
1575 {
1576 0u, // VkAttachmentDescriptionFlags flags;
1577 VK_FORMAT_R8G8B8A8_UNORM, // VkFormat format;
1578 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
1579 VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp loadOp;
1580 VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp storeOp;
1581 VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp stencilLoadOp;
1582 VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp stencilStoreOp;
1583 VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout;
1584 VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout finalLayout;
1585 };
1586
1587 std::vector<RenderPassSp> renderPasses(VERIFYMAXVALUES_OBJECT_COUNT);
1588 createRenderPasses(vkd, device, &attachmentDescription, begin(renderPasses), end(renderPasses));
1589 std::fill(begin(renderPasses) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(renderPasses), RenderPassSp());
1590 createRenderPasses(vkd, device, &attachmentDescription, begin(renderPasses) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(renderPasses));
1591 std::fill(begin(renderPasses), end(renderPasses), RenderPassSp());
1592 createRenderPasses(vkd, device, &attachmentDescription, begin(renderPasses), end(renderPasses));
1593 break;
1594 }
1595 case TRC_GRAPHICS_PIPELINE:
1596 {
1597 VkAttachmentDescription attachmentDescription =
1598 {
1599 0u, // VkAttachmentDescriptionFlags flags;
1600 VK_FORMAT_R8G8B8A8_UNORM, // VkFormat format;
1601 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
1602 VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp loadOp;
1603 VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp storeOp;
1604 VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp stencilLoadOp;
1605 VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp stencilStoreOp;
1606 VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout;
1607 VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout finalLayout;
1608 };
1609 std::vector<RenderPassSp> renderPasses(1u);
1610 createRenderPasses(vkd, device, &attachmentDescription, begin(renderPasses), end(renderPasses));
1611 std::vector<PipelineLayoutSp> pipelineLayouts(1u);
1612 createPipelineLayouts(vkd, device, begin(pipelineLayouts), end(pipelineLayouts));
1613 Move<VkShaderModule> vertexShaderModule = createShaderModule(vkd, device, m_context.getBinaryCollection().get("vertex"), 0u);
1614 Move<VkShaderModule> fragmentShaderModule = createShaderModule(vkd, device, m_context.getBinaryCollection().get("fragment"), 0u);
1615
1616 std::vector<PipelineSp> pipelines(VERIFYMAXVALUES_OBJECT_COUNT);
1617 createGraphicsPipelines(vkd, device, vertexShaderModule.get(), fragmentShaderModule.get(), renderPasses[0]->get(), pipelineLayouts[0]->get(), pipelineDefaultSize, m_context.getResourceInterface(), begin(pipelines), end(pipelines));
1618
1619 if (m_context.getDeviceVulkanSC10Properties().recyclePipelineMemory)
1620 {
1621 std::fill(begin(pipelines) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(pipelines), PipelineSp());
1622 createGraphicsPipelines(vkd, device, vertexShaderModule.get(), fragmentShaderModule.get(), renderPasses[0]->get(), pipelineLayouts[0]->get(), pipelineDefaultSize, m_context.getResourceInterface(), begin(pipelines) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(pipelines));
1623 std::fill(begin(pipelines), end(pipelines), PipelineSp());
1624 createGraphicsPipelines(vkd, device, vertexShaderModule.get(), fragmentShaderModule.get(), renderPasses[0]->get(), pipelineLayouts[0]->get(), pipelineDefaultSize, m_context.getResourceInterface(), begin(pipelines), end(pipelines));
1625 }
1626
1627 break;
1628 }
1629 case TRC_COMPUTE_PIPELINE:
1630 {
1631 std::vector<PipelineLayoutSp> pipelineLayouts (1u);
1632 createPipelineLayouts(vkd, device, begin(pipelineLayouts), end(pipelineLayouts));
1633 Move<VkShaderModule> shaderModule = createShaderModule(vkd, device, m_context.getBinaryCollection().get("compute"), 0u);
1634
1635 std::vector<PipelineSp> pipelines(VERIFYMAXVALUES_OBJECT_COUNT);
1636 createComputePipelines(vkd, device, shaderModule.get(), pipelineLayouts[0]->get(), pipelineDefaultSize, m_context.getResourceInterface(), begin(pipelines), end(pipelines));
1637
1638 if (m_context.getDeviceVulkanSC10Properties().recyclePipelineMemory)
1639 {
1640 std::fill(begin(pipelines) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(pipelines), PipelineSp());
1641 createComputePipelines(vkd, device, shaderModule.get(), pipelineLayouts[0]->get(), pipelineDefaultSize, m_context.getResourceInterface(), begin(pipelines) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(pipelines));
1642 std::fill(begin(pipelines), end(pipelines), PipelineSp());
1643 createComputePipelines(vkd, device, shaderModule.get(), pipelineLayouts[0]->get(), pipelineDefaultSize, m_context.getResourceInterface(), begin(pipelines), end(pipelines));
1644 }
1645 break;
1646 }
1647 case TRC_DESCRIPTORSET_LAYOUT:
1648 {
1649 std::vector<DescriptorSetLayoutSp> descriptorSetLayouts(VERIFYMAXVALUES_OBJECT_COUNT);
1650 createDescriptorSetLayouts(vkd, device, begin(descriptorSetLayouts), end(descriptorSetLayouts));
1651 std::fill(begin(descriptorSetLayouts) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(descriptorSetLayouts), DescriptorSetLayoutSp());
1652 createDescriptorSetLayouts(vkd, device, begin(descriptorSetLayouts) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(descriptorSetLayouts));
1653 std::fill(begin(descriptorSetLayouts), end(descriptorSetLayouts), DescriptorSetLayoutSp());
1654 createDescriptorSetLayouts(vkd, device, begin(descriptorSetLayouts), end(descriptorSetLayouts));
1655 break;
1656 }
1657 case TRC_SAMPLER:
1658 {
1659 std::vector<SamplerSp> samplers(VERIFYMAXVALUES_OBJECT_COUNT);
1660 createSamplers(vkd, device, begin(samplers), end(samplers));
1661 std::fill(begin(samplers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(samplers), SamplerSp());
1662 createSamplers(vkd, device, begin(samplers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(samplers));
1663 std::fill(begin(samplers), end(samplers), SamplerSp());
1664 createSamplers(vkd, device, begin(samplers), end(samplers));
1665 break;
1666 }
1667 case TRC_DESCRIPTOR_POOL:
1668 {
1669 std::vector<DescriptorPoolSp> descriptorPools(VERIFYMAXVALUES_OBJECT_COUNT);
1670 createDescriptorPools(vkd, device, 1u, begin(descriptorPools), end(descriptorPools));
1671 break;
1672 }
1673 case TRC_DESCRIPTORSET:
1674 {
1675 std::vector<DescriptorSetLayoutSp> descriptorSetLayouts(1u);
1676 createDescriptorSetLayouts(vkd, device, begin(descriptorSetLayouts), end(descriptorSetLayouts));
1677 std::vector<DescriptorPoolSp> descriptorPools(1u);
1678 createDescriptorPools(vkd, device, VERIFYMAXVALUES_OBJECT_COUNT, begin(descriptorPools), end(descriptorPools));
1679
1680 std::vector<DescriptorSetSp> descriptorSets(VERIFYMAXVALUES_OBJECT_COUNT);
1681 createDescriptorSets(vkd, device, descriptorPools[0]->get(), descriptorSetLayouts[0]->get(), begin(descriptorSets), end(descriptorSets));
1682 if (m_context.getDeviceVulkanSC10Properties().recycleDescriptorSetMemory)
1683 {
1684 std::fill(begin(descriptorSets) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(descriptorSets), DescriptorSetSp());
1685 createDescriptorSets(vkd, device, descriptorPools[0]->get(), descriptorSetLayouts[0]->get(), begin(descriptorSets) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(descriptorSets));
1686 std::fill(begin(descriptorSets), end(descriptorSets), DescriptorSetSp());
1687 createDescriptorSets(vkd, device, descriptorPools[0]->get(), descriptorSetLayouts[0]->get(), begin(descriptorSets), end(descriptorSets));
1688 }
1689 break;
1690 }
1691 case TRC_FRAMEBUFFER:
1692 {
1693 VkImageCreateInfo imageCI =
1694 {
1695 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType
1696 DE_NULL, // const void* pNext
1697 (VkImageCreateFlags)0u, // VkImageCreateFlags flags
1698 VK_IMAGE_TYPE_2D, // VkImageType imageType
1699 VK_FORMAT_R8G8B8A8_UNORM, // VkFormat format
1700 {
1701 8u, // deUint32 width
1702 8u, // deUint32 height
1703 1u // deUint32 depth
1704 }, // VkExtent3D extent
1705 1u, // deUint32 mipLevels
1706 1u, // deUint32 arrayLayers
1707 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples
1708 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling
1709 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, // VkImageUsageFlags usage;
1710 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1711 1u, // deUint32 queueFamilyIndexCount;
1712 &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
1713 VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout;
1714 };
1715 ImageWithMemory image(vkd, device, allocator, imageCI, MemoryRequirement::Any);
1716
1717 VkAttachmentDescription attachmentDescription =
1718 {
1719 0u, // VkAttachmentDescriptionFlags flags;
1720 VK_FORMAT_R8G8B8A8_UNORM, // VkFormat format;
1721 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
1722 VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp loadOp;
1723 VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp storeOp;
1724 VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp stencilLoadOp;
1725 VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp stencilStoreOp;
1726 VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout;
1727 VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout finalLayout;
1728 };
1729
1730 std::vector<RenderPassSp> renderPasses(1u);
1731 createRenderPasses(vkd, device, &attachmentDescription, begin(renderPasses), end(renderPasses));
1732
1733 std::vector<ImageViewSp> imageViews(1u);
1734 createImageViews(vkd, device, image.get(), begin(imageViews), end(imageViews));
1735
1736 std::vector<FramebufferSp> framebuffers(VERIFYMAXVALUES_OBJECT_COUNT);
1737 createFramebuffers(vkd, device, renderPasses[0]->get(), imageViews[0]->get(), begin(framebuffers), end(framebuffers));
1738 std::fill(begin(framebuffers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(framebuffers), FramebufferSp());
1739 createFramebuffers(vkd, device, renderPasses[0]->get(), imageViews[0]->get(), begin(framebuffers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(framebuffers));
1740 std::fill(begin(framebuffers), end(framebuffers), FramebufferSp());
1741 createFramebuffers(vkd, device, renderPasses[0]->get(), imageViews[0]->get(), begin(framebuffers), end(framebuffers));
1742 break;
1743 }
1744 case TRC_COMMANDPOOL:
1745 {
1746 std::vector<CommandPoolSp> commandPools(VERIFYMAXVALUES_OBJECT_COUNT);
1747 createCommandPools(vkd, device, begin(commandPools), end(commandPools));
1748 break;
1749 }
1750 case TRC_SAMPLERYCBCRCONVERSION:
1751 {
1752 std::vector<SamplerYcbcrConversionSp> samplers(VERIFYMAXVALUES_OBJECT_COUNT);
1753 createSamplerYcbcrConversions(vkd, device, begin(samplers), end(samplers));
1754 std::fill(begin(samplers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(samplers), SamplerYcbcrConversionSp());
1755 createSamplerYcbcrConversions(vkd, device, begin(samplers) + VERIFYMAXVALUES_OBJECT_COUNT / 2, end(samplers));
1756 std::fill(begin(samplers), end(samplers), SamplerYcbcrConversionSp());
1757 createSamplerYcbcrConversions(vkd, device, begin(samplers), end(samplers));
1758 break;
1759 }
1760 // case TRC_SURFACE:
1761 // break;
1762 // case TRC_SWAPCHAIN:
1763 // break;
1764 // case TRC_DISPLAY_MODE:
1765 // break;
1766 default:
1767 TCU_THROW(InternalError, "Unsupported max value");
1768 }
1769 }
1770 };
1771
1772 // test pipeline pool sizes
1773 class VerifyPipelinePoolSizes : public DeviceObjectReservationInstance
1774 {
1775 public:
VerifyPipelinePoolSizes(Context & context,const TestParams & testParams_)1776 VerifyPipelinePoolSizes (Context& context,
1777 const TestParams& testParams_)
1778 : DeviceObjectReservationInstance(context, testParams_)
1779 {
1780 }
1781
createTestDevice(VkDeviceCreateInfo & deviceCreateInfo,VkDeviceObjectReservationCreateInfo & objectInfo,VkPhysicalDeviceVulkanSC10Features & sc10Features)1782 Move<VkDevice> createTestDevice (VkDeviceCreateInfo& deviceCreateInfo,
1783 VkDeviceObjectReservationCreateInfo& objectInfo,
1784 VkPhysicalDeviceVulkanSC10Features& sc10Features) override
1785 {
1786 DE_UNREF(sc10Features);
1787
1788 std::vector<VkPipelinePoolSize> poolSizes;
1789
1790 const VkDeviceSize psTooSmall = 64u;
1791 const VkDeviceSize psForOnePipeline = VkDeviceSize(m_context.getTestContext().getCommandLine().getPipelineDefaultSize());
1792
1793 switch (testParams.testPoolSizeType)
1794 {
1795 case PST_NONE:
1796 objectInfo.graphicsPipelineRequestCount = 1u;
1797 break;
1798 case PST_ZERO:
1799 objectInfo.graphicsPipelineRequestCount = 1u;
1800 poolSizes.push_back({ VK_STRUCTURE_TYPE_PIPELINE_POOL_SIZE, DE_NULL, 0u, 1u });
1801 break;
1802 case PST_TOO_SMALL_SIZE:
1803 poolSizes.push_back({ VK_STRUCTURE_TYPE_PIPELINE_POOL_SIZE, DE_NULL, psTooSmall, 1u });
1804 objectInfo.graphicsPipelineRequestCount = 1u;
1805 break;
1806 case PST_ONE_FITS:
1807 poolSizes.push_back({ VK_STRUCTURE_TYPE_PIPELINE_POOL_SIZE, DE_NULL, psForOnePipeline, 1u });
1808 objectInfo.graphicsPipelineRequestCount = 1u;
1809 break;
1810 case PST_MULTIPLE_FIT:
1811 poolSizes.push_back({ VK_STRUCTURE_TYPE_PIPELINE_POOL_SIZE, DE_NULL, psForOnePipeline, 16u });
1812 objectInfo.graphicsPipelineRequestCount = 16u;
1813 break;
1814 default:
1815 TCU_THROW(InternalError, "Unsupported pool size type");
1816 }
1817
1818 objectInfo.pipelinePoolSizeCount = deUint32(poolSizes.size());
1819 objectInfo.pPipelinePoolSizes = poolSizes.empty() ? DE_NULL : poolSizes.data();
1820 objectInfo.pipelineLayoutRequestCount = 1u;
1821 objectInfo.renderPassRequestCount = 1u;
1822 objectInfo.subpassDescriptionRequestCount = 1u;
1823 objectInfo.attachmentDescriptionRequestCount = 1u;
1824
1825 return createCustomDevice(m_context.getTestContext().getCommandLine().isValidationEnabled(), m_context.getPlatformInterface(), instance, instance.getDriver(), physicalDevice, &deviceCreateInfo);
1826 }
1827
performTest(const DeviceInterface & vk,VkDevice device)1828 void performTest (const DeviceInterface& vk,
1829 VkDevice device) override
1830 {
1831 const vk::PlatformInterface& vkp = m_context.getPlatformInterface();
1832 const InstanceInterface& vki = instance.getDriver();
1833
1834 Move<VkShaderModule> vertexShader = createShaderModule(vk, device, m_context.getBinaryCollection().get("vertex"), 0);
1835 Move<VkShaderModule> fragmentShader = createShaderModule(vk, device, m_context.getBinaryCollection().get("fragment"), 0);
1836
1837 std::vector<VkPipelineShaderStageCreateInfo> shaderStageCreateInfos =
1838 {
1839 {
1840 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType;
1841 DE_NULL, // const void* pNext;
1842 (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags;
1843 VK_SHADER_STAGE_VERTEX_BIT, // VkShaderStageFlagBits stage;
1844 *vertexShader, // VkShaderModule shader;
1845 "main", // const char* pName;
1846 DE_NULL, // const VkSpecializationInfo* pSpecializationInfo;
1847 },
1848 {
1849 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType;
1850 DE_NULL, // const void* pNext;
1851 (VkPipelineShaderStageCreateFlags)0, // VkPipelineShaderStageCreateFlags flags;
1852 VK_SHADER_STAGE_FRAGMENT_BIT, // VkShaderStageFlagBits stage;
1853 *fragmentShader, // VkShaderModule shader;
1854 "main", // const char* pName;
1855 DE_NULL, // const VkSpecializationInfo* pSpecializationInfo;
1856 }
1857 };
1858
1859 VkPipelineVertexInputStateCreateInfo vertexInputStateCreateInfo;
1860 VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCreateInfo;
1861 VkPipelineViewportStateCreateInfo viewPortStateCreateInfo;
1862 VkPipelineRasterizationStateCreateInfo rasterizationStateCreateInfo;
1863 VkPipelineMultisampleStateCreateInfo multisampleStateCreateInfo;
1864 VkPipelineColorBlendAttachmentState colorBlendAttachmentState;
1865 VkPipelineColorBlendStateCreateInfo colorBlendStateCreateInfo;
1866 VkPipelineDynamicStateCreateInfo dynamicStateCreateInfo;
1867 std::vector<VkDynamicState> dynamicStates = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
1868
1869 const VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo =
1870 {
1871 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // VkStructureType sType;
1872 DE_NULL, // const void* pNext;
1873 (VkPipelineLayoutCreateFlags)0u, // VkPipelineLayoutCreateFlags flags;
1874 0u, // deUint32 setLayoutCount;
1875 DE_NULL, // const VkDescriptorSetLayout* pSetLayouts;
1876 0u, // deUint32 pushConstantRangeCount;
1877 DE_NULL // const VkPushConstantRange* pPushConstantRanges;
1878 };
1879 Move<VkPipelineLayout> pipelineLayout = createPipelineLayout(vk, device, &pipelineLayoutCreateInfo);
1880
1881 const VkFormat format = getRenderTargetFormat(vki, physicalDevice);
1882
1883 VkAttachmentDescription attachmentDescription;
1884 VkAttachmentReference attachmentReference;
1885 VkSubpassDescription subpassDescription;
1886 VkRenderPassCreateInfo renderPassCreateInfo = prepareSimpleRenderPassCI(format, attachmentDescription, attachmentReference, subpassDescription);
1887 Move<VkRenderPass> renderPass = createRenderPass(vk, device, &renderPassCreateInfo);
1888
1889 VkGraphicsPipelineCreateInfo graphicsPipelineCreateInfo = prepareSimpleGraphicsPipelineCI(vertexInputStateCreateInfo, shaderStageCreateInfos,
1890 inputAssemblyStateCreateInfo, viewPortStateCreateInfo, rasterizationStateCreateInfo, multisampleStateCreateInfo, colorBlendAttachmentState, colorBlendStateCreateInfo,
1891 dynamicStateCreateInfo, dynamicStates, *pipelineLayout, *renderPass);
1892
1893 // create custom VkPipelineIdentifierInfo
1894 VkPipelineOfflineCreateInfo pipelineID = resetPipelineOfflineCreateInfo();
1895 applyPipelineIdentifier(pipelineID, "ID_DR_PS_00");
1896 pipelineID.pNext = graphicsPipelineCreateInfo.pNext;
1897 graphicsPipelineCreateInfo.pNext = &pipelineID;
1898
1899 if (m_context.getTestContext().getCommandLine().isSubProcess())
1900 {
1901 pipelineID.poolEntrySize = VkDeviceSize(m_context.getTestContext().getCommandLine().getPipelineDefaultSize());
1902 }
1903
1904 std::size_t pipelineCount = 0u;
1905 switch (testParams.testPoolSizeType)
1906 {
1907 case PST_NONE:
1908 case PST_ZERO:
1909 case PST_TOO_SMALL_SIZE:
1910 case PST_ONE_FITS:
1911 pipelineCount = 1u;
1912 break;
1913 case PST_MULTIPLE_FIT:
1914 pipelineCount = 16u;
1915 break;
1916 default:
1917 TCU_THROW(InternalError, "Unsupported pool size type");
1918 };
1919
1920 if (!m_context.getTestContext().getCommandLine().isSubProcess())
1921 {
1922 std::vector<Move<VkPipeline>> pipelines;
1923 for (deUint32 i = 0; i < pipelineCount; ++i)
1924 pipelines.emplace_back(createGraphicsPipeline(vk, device, DE_NULL, &graphicsPipelineCreateInfo));
1925 return;
1926 }
1927
1928 GetDeviceProcAddrFunc getDeviceProcAddrFunc = (GetDeviceProcAddrFunc)vkp.getInstanceProcAddr(instance, "vkGetDeviceProcAddr");
1929 CreateGraphicsPipelinesFunc createGraphicsPipelinesFunc = (CreateGraphicsPipelinesFunc)getDeviceProcAddrFunc(device, "vkCreateGraphicsPipelines");
1930 DestroyPipelineFunc destroyPipelineFunc = (DestroyPipelineFunc)getDeviceProcAddrFunc(device, "vkDestroyPipeline");
1931 VkPipelineCache pipelineCache = m_context.getResourceInterface()->getPipelineCache(device);
1932 std::vector<VkPipeline> pipelines (pipelineCount, VkPipeline(DE_NULL));
1933 deUint32 iterations = m_context.getDeviceVulkanSC10Properties().recyclePipelineMemory ? 1u : 4u;
1934
1935 // if recyclePipelineMemory is set then we are able to create the same pipelines again
1936 for (deUint32 iter = 0; iter < iterations; ++iter)
1937 {
1938 for (deUint32 i = 0; i < pipelineCount; ++i)
1939 {
1940 VkResult result = createGraphicsPipelinesFunc(device, pipelineCache, 1u, &graphicsPipelineCreateInfo, DE_NULL, &pipelines[i]);
1941 results.push_back(result);
1942 if (result != VK_SUCCESS)
1943 {
1944 for (deUint32 j = 0; j < pipelineCount; ++j)
1945 if (pipelines[j].getInternal() != DE_NULL)
1946 destroyPipelineFunc(device, pipelines[j], DE_NULL);
1947 return;
1948 }
1949 }
1950
1951 for (deUint32 i = 0; i < pipelineCount; ++i)
1952 {
1953 destroyPipelineFunc(device, pipelines[i], DE_NULL);
1954 pipelines[i] = VkPipeline(DE_NULL);
1955 }
1956 }
1957 }
1958
verifyTestResults(const DeviceInterface & vkd,VkDevice device)1959 bool verifyTestResults (const DeviceInterface& vkd,
1960 VkDevice device) override
1961 {
1962 DE_UNREF(vkd);
1963 DE_UNREF(device);
1964
1965 if (!m_context.getTestContext().getCommandLine().isSubProcess())
1966 return true;
1967
1968 switch (testParams.testPoolSizeType)
1969 {
1970 case PST_NONE:
1971 case PST_ZERO:
1972 case PST_TOO_SMALL_SIZE:
1973 return (results.back() == VK_ERROR_OUT_OF_POOL_MEMORY);
1974 case PST_ONE_FITS:
1975 return (results.back() == VK_SUCCESS);
1976 case PST_MULTIPLE_FIT:
1977 return (results.back() == VK_SUCCESS);
1978 default:
1979 TCU_THROW(InternalError, "Unsupported pool size type");
1980 };
1981 return true;
1982 }
1983
1984 std::vector<VkResult> results;
1985 };
1986
1987 } // anonymous
1988
createDeviceObjectReservationTests(tcu::TestContext & testCtx)1989 tcu::TestCaseGroup* createDeviceObjectReservationTests (tcu::TestContext& testCtx)
1990 {
1991 de::MovePtr<tcu::TestCaseGroup> group(new tcu::TestCaseGroup(testCtx, "device_object_reservation", "Tests verifying VkDeviceObjectReservationCreateInfo"));
1992
1993 // add basic tests
1994 {
1995 de::MovePtr<tcu::TestCaseGroup> basicGroup(new tcu::TestCaseGroup(group->getTestContext(), "basic", ""));
1996
1997 basicGroup->addChild(new InstanceFactory1<DeviceObjectReservationInstance, TestParams>(testCtx, tcu::NODETYPE_SELF_VALIDATE, "create_device", "", TestParams()));
1998 basicGroup->addChild(new InstanceFactory1<MultipleReservation, TestParams>(testCtx, tcu::NODETYPE_SELF_VALIDATE, "multiple_device_object_reservation", "", TestParams()));
1999
2000 group->addChild(basicGroup.release());
2001 }
2002
2003 // add tests verifying device limits
2004 {
2005 de::MovePtr<tcu::TestCaseGroup> limitGroup(new tcu::TestCaseGroup(group->getTestContext(), "limits", ""));
2006 struct TestMaxValuesData
2007 {
2008 TestMaxValues testMaxValues;
2009 const char* name;
2010 } testMaxValues[] =
2011 {
2012 { TMV_DESCRIPTOR_SET_LAYOUT_BINDING_LIMIT, "descriptor_set_layout_binding_limit" },
2013 { TMV_MAX_IMAGEVIEW_MIPLEVELS, "max_imageview_miplevels" },
2014 { TMV_MAX_IMAGEVIEW_ARRAYLAYERS, "max_imageview_arraylayers" },
2015 { TMV_MAX_LAYEREDIMAGEVIEW_MIPLEVELS, "max_layeredimageview_miplevels" },
2016 { TMV_MAX_OCCLUSION_QUERIES_PER_POOL, "max_occlusion_queries_per_pool" },
2017 { TMV_MAX_PIPELINESTATISTICS_QUERIES_PER_POOL, "max_pipelinestatistics_queries_per_pool" },
2018 { TMV_MAX_TIMESTAMP_QUERIES_PER_POOL, "max_timestamp_queries_per_pool" },
2019 };
2020 {
2021 de::MovePtr<tcu::TestCaseGroup> maxValGroup(new tcu::TestCaseGroup(group->getTestContext(), "max_values", ""));
2022
2023 for (deInt32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(testMaxValues); ndx++)
2024 {
2025 TestParams testParams
2026 {
2027 testMaxValues[ndx].testMaxValues,
2028 TRC_UNDEFINED
2029 };
2030 maxValGroup->addChild(new InstanceFactory1WithSupport<VerifyMaxValues, TestParams, FunctionSupport1<TestParams>>(testCtx, tcu::NODETYPE_SELF_VALIDATE, testMaxValues[ndx].name, "", testParams,
2031 typename FunctionSupport1<TestParams>::Args(checkSupportVerifyMaxValues, testParams)));
2032 }
2033
2034 limitGroup->addChild(maxValGroup.release());
2035 }
2036
2037 struct TestRequestCountData
2038 {
2039 TestRequestCounts requestCount;
2040 const char* name;
2041 } testRequestCounts[] =
2042 {
2043 { TRC_SEMAPHORE, "semaphore" },
2044 { TRC_COMMAND_BUFFER, "command_buffer" },
2045 { TRC_FENCE, "fence" },
2046 { TRC_DEVICE_MEMORY, "device_memory" },
2047 { TRC_BUFFER, "buffer" },
2048 { TRC_IMAGE, "image" },
2049 { TRC_EVENT, "event" },
2050 { TRC_QUERY_POOL, "query_pool" },
2051 { TRC_BUFFER_VIEW, "buffer_view" },
2052 { TRC_IMAGE_VIEW, "image_view" },
2053 { TRC_LAYERED_IMAGE_VIEW, "layered_image_view" },
2054 { TRC_PIPELINE_LAYOUT, "pipeline_layout" },
2055 { TRC_RENDER_PASS, "render_pass" },
2056 { TRC_GRAPHICS_PIPELINE, "graphics_pipeline" },
2057 { TRC_COMPUTE_PIPELINE, "compute_pipeline" },
2058 { TRC_DESCRIPTORSET_LAYOUT, "descriptorset_layout" },
2059 { TRC_SAMPLER, "sampler" },
2060 { TRC_DESCRIPTOR_POOL, "descriptor_pool" },
2061 { TRC_DESCRIPTORSET, "descriptorset" },
2062 { TRC_FRAMEBUFFER, "framebuffer" },
2063 { TRC_COMMANDPOOL, "commandpool" },
2064 { TRC_SAMPLERYCBCRCONVERSION, "samplerycbcrconversion" },
2065 // { TRC_SURFACE, "surface" },
2066 // { TRC_SWAPCHAIN, "swapchain" },
2067 // { TRC_DISPLAY_MODE, "display_mode" },
2068 };
2069 {
2070 de::MovePtr<tcu::TestCaseGroup> requestCountGroup(new tcu::TestCaseGroup(group->getTestContext(), "request_count", ""));
2071
2072 for (deInt32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(testRequestCounts); ndx++)
2073 {
2074 TestParams testParams
2075 {
2076 TMV_UNDEFINED,
2077 testRequestCounts[ndx].requestCount
2078 };
2079 requestCountGroup->addChild(new InstanceFactory1WithSupport<VerifyRequestCounts, TestParams, FunctionSupport1<TestParams>, ProgramsVerifyLimits>(testCtx, tcu::NODETYPE_SELF_VALIDATE, testRequestCounts[ndx].name, "",
2080 ProgramsVerifyLimits(), testParams, typename FunctionSupport1<TestParams>::Args(checkSupportVerifyRequestCounts, testParams)));
2081 }
2082
2083 limitGroup->addChild(requestCountGroup.release());
2084 }
2085
2086 group->addChild(limitGroup.release());
2087 }
2088
2089 // add tests verifying pipeline pool sizes
2090 {
2091 de::MovePtr<tcu::TestCaseGroup> ppsGroup(new tcu::TestCaseGroup(group->getTestContext(), "pipeline_pool_size", ""));
2092
2093
2094 struct PoolSizesData
2095 {
2096 TestPoolSizes type;
2097 const char* name;
2098 } poolSizes[] =
2099 {
2100 { PST_NONE, "none" },
2101 { PST_ZERO, "zero" },
2102 { PST_TOO_SMALL_SIZE, "too_small_size" },
2103 { PST_ONE_FITS, "one_fits" },
2104 { PST_MULTIPLE_FIT, "multiple_fit" },
2105 };
2106
2107 for (deInt32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(poolSizes); ndx++)
2108 {
2109 TestParams testParams(TMV_UNDEFINED, TRC_UNDEFINED, poolSizes[ndx].type);
2110
2111 ppsGroup->addChild(new InstanceFactory1<VerifyPipelinePoolSizes, TestParams, ProgramsVerifyLimits>(testCtx, tcu::NODETYPE_SELF_VALIDATE, poolSizes[ndx].name, "", ProgramsVerifyLimits(), testParams));
2112 }
2113
2114
2115 group->addChild(ppsGroup.release());
2116 }
2117
2118 return group.release();
2119 }
2120
2121 } // sc
2122
2123 } // vkt
2124