1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2016 The Khronos Group Inc.
6 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 *//*!
21 * \file
22 * \brief Memory Commitment tests
23 *//*--------------------------------------------------------------------*/
24
25 #include "vktApiGetMemoryCommitment.hpp"
26
27 #include "vkDeviceUtil.hpp"
28 #include "vkQueryUtil.hpp"
29 #include "vkRefUtil.hpp"
30 #include "vkImageUtil.hpp"
31 #include "vkMemUtil.hpp"
32 #include "vkPrograms.hpp"
33 #include "vktTestCase.hpp"
34 #include "vkTypeUtil.hpp"
35 #include "vkCmdUtil.hpp"
36 #include "vkObjUtil.hpp"
37
38 #include "tcuTestLog.hpp"
39
40 using namespace vk;
41 using tcu::TestLog;
42
43 namespace vkt
44 {
45 namespace api
46 {
47
48 struct MemoryCommitmentCaseParams
49 {
50 uint32_t bufferSize;
51 uint32_t bufferViewSize;
52 uint32_t elementOffset;
53 };
54
55 namespace
56 {
57
getMemoryTypeIndices(VkMemoryPropertyFlags propertyFlag,const VkPhysicalDeviceMemoryProperties & pMemoryProperties)58 std::vector<uint32_t> getMemoryTypeIndices(VkMemoryPropertyFlags propertyFlag,
59 const VkPhysicalDeviceMemoryProperties &pMemoryProperties)
60 {
61 std::vector<uint32_t> indices;
62 for (uint32_t typeIndex = 0u; typeIndex < pMemoryProperties.memoryTypeCount; ++typeIndex)
63 {
64 if ((pMemoryProperties.memoryTypes[typeIndex].propertyFlags & propertyFlag) == propertyFlag)
65 indices.push_back(typeIndex);
66 }
67 return indices;
68 }
69
70 } // namespace
71
72 class MemoryCommitmentTestInstance : public vkt::TestInstance
73 {
74 public:
75 MemoryCommitmentTestInstance(Context &context, MemoryCommitmentCaseParams testCase);
76 tcu::TestStatus iterate(void);
77 Move<VkCommandPool> createCommandPool() const;
78 Move<VkCommandBuffer> allocatePrimaryCommandBuffer(VkCommandPool commandPool) const;
79 bool isDeviceMemoryCommitmentOk(const VkMemoryRequirements memoryRequirements);
80
81 private:
82 const tcu::IVec2 m_renderSize;
83 };
84
MemoryCommitmentTestInstance(Context & context,MemoryCommitmentCaseParams testCase)85 MemoryCommitmentTestInstance::MemoryCommitmentTestInstance(Context &context, MemoryCommitmentCaseParams testCase)
86 : vkt::TestInstance(context)
87 , m_renderSize(testCase.bufferViewSize, testCase.bufferViewSize)
88 {
89 }
90
91 class MemoryCommitmentTestCase : public vkt::TestCase
92 {
93 public:
MemoryCommitmentTestCase(tcu::TestContext & testCtx,const std::string & name,MemoryCommitmentCaseParams memoryCommitmentTestInfo)94 MemoryCommitmentTestCase(tcu::TestContext &testCtx, const std::string &name,
95 MemoryCommitmentCaseParams memoryCommitmentTestInfo)
96 : vkt::TestCase(testCtx, name)
97 , m_memoryCommitmentTestInfo(memoryCommitmentTestInfo)
98 {
99 }
~MemoryCommitmentTestCase(void)100 virtual ~MemoryCommitmentTestCase(void)
101 {
102 }
103 virtual void initPrograms(SourceCollections &programCollection) const;
createInstance(Context & context) const104 virtual TestInstance *createInstance(Context &context) const
105 {
106 return new MemoryCommitmentTestInstance(context, m_memoryCommitmentTestInfo);
107 }
108
109 private:
110 MemoryCommitmentCaseParams m_memoryCommitmentTestInfo;
111 };
112
iterate(void)113 tcu::TestStatus MemoryCommitmentTestInstance::iterate(void)
114 {
115 const VkMemoryPropertyFlags propertyFlag = VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;
116 const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
117 const InstanceInterface &vki = m_context.getInstanceInterface();
118 const VkPhysicalDeviceMemoryProperties pMemoryProperties = getPhysicalDeviceMemoryProperties(vki, physicalDevice);
119 const std::vector<uint32_t> memoryTypeIndices = getMemoryTypeIndices(propertyFlag, pMemoryProperties);
120 Allocator &memAlloc = m_context.getDefaultAllocator();
121 bool isMemoryAllocationOK = false;
122 const uint32_t queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
123 const VkComponentMapping componentMappingRGBA = {VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
124 VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A};
125 const DeviceInterface &vkd = m_context.getDeviceInterface();
126 const Move<VkCommandPool> cmdPool = createCommandPool();
127 const Move<VkCommandBuffer> cmdBuffer = allocatePrimaryCommandBuffer(*cmdPool);
128 const VkDevice device = m_context.getDevice();
129 Move<VkImageView> colorAttachmentView;
130 Move<VkRenderPass> renderPass;
131 Move<VkFramebuffer> framebuffer;
132 Move<VkDescriptorSetLayout> descriptorSetLayout;
133 Move<VkPipelineLayout> pipelineLayout;
134 Move<VkShaderModule> vertexShaderModule;
135 Move<VkShaderModule> fragmentShaderModule;
136 Move<VkPipeline> graphicsPipelines;
137
138 // Note we can still fail later if none of lazily allocated memory types can be used with the image below.
139 if (memoryTypeIndices.empty())
140 TCU_THROW(NotSupportedError, "Lazily allocated bit is not supported by any memory type");
141
142 const VkImageCreateInfo imageParams = {
143 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
144 DE_NULL, // const void* pNext;
145 0u, // VkImageCreateFlags flags;
146 VK_IMAGE_TYPE_2D, // VkImageType imageType;
147 VK_FORMAT_R32_UINT, // VkFormat format;
148 {256u, 256u, 1}, // VkExtent3D extent;
149 1u, // uint32_t mipLevels;
150 1u, // uint32_t arraySize;
151 VK_SAMPLE_COUNT_1_BIT, // uint32_t samples;
152 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
153 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, // VkImageUsageFlags usage;
154 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
155 1u, // uint32_t queueFamilyCount;
156 &queueFamilyIndex, // const uint32_t* pQueueFamilyIndices;
157 VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout;
158 };
159
160 Move<VkImage> image = createImage(vkd, device, &imageParams);
161 const VkMemoryRequirements memoryRequirements = getImageMemoryRequirements(vkd, device, *image);
162 de::MovePtr<Allocation> imageAlloc = memAlloc.allocate(memoryRequirements, MemoryRequirement::LazilyAllocated);
163
164 VK_CHECK(vkd.bindImageMemory(device, *image, imageAlloc->getMemory(), imageAlloc->getOffset()));
165
166 const VkImageViewCreateInfo colorAttachmentViewParams = {
167 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // VkStructureType sType;
168 DE_NULL, // const void* pNext;
169 0u, // VkImageViewCreateFlags flags;
170 *image, // VkImage image;
171 VK_IMAGE_VIEW_TYPE_2D, // VkImageViewType viewType;
172 VK_FORMAT_R32_UINT, // VkFormat format;
173 componentMappingRGBA, // VkComponentMapping components;
174 {VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u} // VkImageSubresourceRange subresourceRange;
175 };
176
177 colorAttachmentView = createImageView(vkd, device, &colorAttachmentViewParams);
178
179 // Create render pass
180 renderPass = makeRenderPass(vkd, device, VK_FORMAT_R32_UINT);
181
182 // Create framebuffer
183 {
184 const VkImageView attachmentBindInfos[1] = {
185 *colorAttachmentView,
186 };
187
188 const VkFramebufferCreateInfo framebufferParams = {
189 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // VkStructureType sType;
190 DE_NULL, // const void* pNext;
191 (VkFramebufferCreateFlags)0,
192 *renderPass, // VkRenderPass renderPass;
193 1u, // uint32_t attachmentCount;
194 attachmentBindInfos, // const VkImageView* pAttachments;
195 (uint32_t)m_renderSize.x(), // uint32_t width;
196 (uint32_t)m_renderSize.y(), // uint32_t height;
197 1u // uint32_t layers;
198 };
199
200 framebuffer = createFramebuffer(vkd, device, &framebufferParams);
201 }
202
203 // Create descriptors
204 {
205 const VkDescriptorSetLayoutBinding layoutBindings[1] = {
206 {
207 0u, // uint32_t binding;
208 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, // VkDescriptorType descriptorType;
209 1u, // uint32_t arraySize;
210 VK_SHADER_STAGE_ALL, // VkShaderStageFlags stageFlags;
211 DE_NULL // const VkSampler* pImmutableSamplers;
212 },
213 };
214
215 const VkDescriptorSetLayoutCreateInfo descriptorLayoutParams = {
216 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, // VkStructureType sType;
217 DE_NULL, // const void* pNext;
218 (VkDescriptorSetLayoutCreateFlags)0,
219 DE_LENGTH_OF_ARRAY(layoutBindings), // uint32_t count;
220 layoutBindings // const VkDescriptorSetLayoutBinding pBinding;
221 };
222
223 descriptorSetLayout = createDescriptorSetLayout(vkd, device, &descriptorLayoutParams);
224 }
225
226 // Create pipeline layout
227 {
228 const VkPipelineLayoutCreateInfo pipelineLayoutParams = {
229 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // VkStructureType sType;
230 DE_NULL, // const void* pNext;
231 (VkPipelineLayoutCreateFlags)0,
232 1u, // uint32_t descriptorSetCount;
233 &*descriptorSetLayout, // const VkDescriptorSetLayout* pSetLayouts;
234 0u, // uint32_t pushConstantRangeCount;
235 DE_NULL // const VkPushConstantRange* pPushConstantRanges;
236 };
237
238 pipelineLayout = createPipelineLayout(vkd, device, &pipelineLayoutParams);
239 }
240
241 // Create shaders
242 {
243 vertexShaderModule = createShaderModule(vkd, device, m_context.getBinaryCollection().get("vert"), 0);
244 fragmentShaderModule = createShaderModule(vkd, device, m_context.getBinaryCollection().get("frag"), 0);
245 }
246
247 // Create pipeline
248 {
249 const std::vector<VkViewport> viewports(1, makeViewport(m_renderSize));
250 const std::vector<VkRect2D> scissors(1, makeRect2D(m_renderSize));
251
252 graphicsPipelines =
253 makeGraphicsPipeline(vkd, // const DeviceInterface& vk
254 device, // const VkDevice device
255 *pipelineLayout, // const VkPipelineLayout pipelineLayout
256 *vertexShaderModule, // const VkShaderModule vertexShaderModule
257 DE_NULL, // const VkShaderModule tessellationControlModule
258 DE_NULL, // const VkShaderModule tessellationEvalModule
259 DE_NULL, // const VkShaderModule geometryShaderModule
260 *fragmentShaderModule, // const VkShaderModule fragmentShaderModule
261 *renderPass, // const VkRenderPass renderPass
262 viewports, // const std::vector<VkViewport>& viewports
263 scissors); // const std::vector<VkRect2D>& scissors
264 }
265
266 // getMemoryCommitment
267 isMemoryAllocationOK = isDeviceMemoryCommitmentOk(memoryRequirements);
268
269 const uint32_t clearColor[4] = {1u, 1u, 1u, 1u};
270 const VkClearAttachment clearAttachment = {
271 VK_IMAGE_ASPECT_COLOR_BIT, // VkImageAspectFlags aspectMask;
272 0u, // uint32_t colorAttachment;
273 makeClearValueColorU32(clearColor[0], clearColor[1], clearColor[2],
274 clearColor[3]) // VkClearValue clearValue;
275 };
276
277 const VkOffset2D offset = {0, 0};
278
279 const VkExtent2D extent = {256u, 256u};
280
281 const VkRect2D rect = {offset, extent};
282
283 const VkClearRect clearRect = {
284 rect,
285 0u, // baseArrayLayer
286 1u // layerCount
287 };
288
289 // beginCommandBuffer
290 beginCommandBuffer(vkd, *cmdBuffer);
291
292 const VkImageMemoryBarrier initialImageBarrier = {
293 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType;
294 DE_NULL, // const void* pNext;
295 0, // VkMemoryOutputFlags outputMask;
296 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, // VkMemoryInputFlags inputMask;
297 VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout oldLayout;
298 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // VkImageLayout newLayout;
299 VK_QUEUE_FAMILY_IGNORED, // uint32_t srcQueueFamilyIndex;
300 VK_QUEUE_FAMILY_IGNORED, // uint32_t destQueueFamilyIndex;
301 image.get(), // VkImage image;
302 {
303 // VkImageSubresourceRange subresourceRange;
304 VK_IMAGE_ASPECT_COLOR_BIT, // VkImageAspectFlags aspectMask;
305 0u, // uint32_t baseMipLevel;
306 1u, // uint32_t mipLevels;
307 0u, // uint32_t baseArraySlice;
308 1u // uint32_t arraySize;
309 }};
310
311 vkd.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
312 (VkDependencyFlags)0, 0, (const VkMemoryBarrier *)DE_NULL, 0,
313 (const VkBufferMemoryBarrier *)DE_NULL, 1, &initialImageBarrier);
314 beginRenderPass(vkd, *cmdBuffer, *renderPass, *framebuffer, makeRect2D(0, 0, 256u, 256u),
315 tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
316 vkd.cmdBindPipeline(*cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *graphicsPipelines);
317 // clearAttachments
318 vkd.cmdClearAttachments(*cmdBuffer, 1, &clearAttachment, 1u, &clearRect);
319 endRenderPass(vkd, *cmdBuffer);
320 endCommandBuffer(vkd, *cmdBuffer);
321
322 // queueSubmit
323 const VkQueue queue = m_context.getUniversalQueue();
324 submitCommandsAndWait(vkd, device, queue, *cmdBuffer);
325
326 // getMemoryCommitment
327 isMemoryAllocationOK = (isMemoryAllocationOK && isDeviceMemoryCommitmentOk(memoryRequirements)) ? true : false;
328
329 if (isMemoryAllocationOK)
330 return tcu::TestStatus::pass("Pass");
331
332 return tcu::TestStatus::fail("Fail");
333 }
334
335 class MemoryCommitmentAllocateOnlyTestInstance : public vkt::TestInstance
336 {
337 public:
338 MemoryCommitmentAllocateOnlyTestInstance(Context &context);
339 tcu::TestStatus iterate(void);
340 };
341
342 class MemoryCommitmentAllocateOnlyTestCase : public vkt::TestCase
343 {
344 public:
MemoryCommitmentAllocateOnlyTestCase(tcu::TestContext & testCtx,const std::string & name)345 MemoryCommitmentAllocateOnlyTestCase(tcu::TestContext &testCtx, const std::string &name)
346 : vkt::TestCase(testCtx, name)
347 {
348 }
~MemoryCommitmentAllocateOnlyTestCase(void)349 virtual ~MemoryCommitmentAllocateOnlyTestCase(void)
350 {
351 }
createInstance(Context & context) const352 virtual TestInstance *createInstance(Context &context) const
353 {
354 return new MemoryCommitmentAllocateOnlyTestInstance(context);
355 }
356 };
357
MemoryCommitmentAllocateOnlyTestInstance(Context & context)358 MemoryCommitmentAllocateOnlyTestInstance::MemoryCommitmentAllocateOnlyTestInstance(Context &context)
359 : vkt::TestInstance(context)
360 {
361 }
362
iterate(void)363 tcu::TestStatus MemoryCommitmentAllocateOnlyTestInstance::iterate(void)
364 {
365 const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
366 const VkDevice device = m_context.getDevice();
367 const InstanceInterface &vki = m_context.getInstanceInterface();
368 const DeviceInterface &vkd = m_context.getDeviceInterface();
369 const VkPhysicalDeviceMemoryProperties pMemoryProperties = getPhysicalDeviceMemoryProperties(vki, physicalDevice);
370 const VkMemoryPropertyFlags propertyFlag = VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;
371 const std::vector<uint32_t> memoryTypeIndices = getMemoryTypeIndices(propertyFlag, pMemoryProperties);
372 const int arrayLength = 10;
373 VkDeviceSize pCommittedMemoryInBytes = 0u;
374 VkDeviceSize allocSize[arrayLength];
375
376 if (memoryTypeIndices.empty())
377 TCU_THROW(NotSupportedError, "Lazily allocated bit is not supported by any memory type");
378
379 // generating random allocation sizes
380 for (int i = 0; i < arrayLength; ++i)
381 {
382 allocSize[i] = rand() % 1000 + 1;
383 }
384
385 for (const auto memoryTypeIndex : memoryTypeIndices)
386 {
387 for (int i = 0; i < arrayLength; ++i)
388 {
389 const VkMemoryAllocateInfo memAllocInfo = {
390 VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // VkStructureType sType
391 NULL, // const void* pNext
392 allocSize[i], // VkDeviceSize allocationSize
393 memoryTypeIndex // uint32_t memoryTypeIndex
394 };
395
396 Move<VkDeviceMemory> memory =
397 allocateMemory(vkd, device, &memAllocInfo, (const VkAllocationCallbacks *)DE_NULL);
398
399 vkd.getDeviceMemoryCommitment(device, memory.get(), &pCommittedMemoryInBytes);
400 if (pCommittedMemoryInBytes != 0)
401 {
402 tcu::TestLog &log = m_context.getTestContext().getLog();
403 log << TestLog::Message << "Warning: Memory commitment not null before binding." << TestLog::EndMessage;
404 }
405 if (pCommittedMemoryInBytes > allocSize[i])
406 return tcu::TestStatus::fail("Fail");
407 }
408 }
409 return tcu::TestStatus::pass("Pass");
410 }
411
initPrograms(SourceCollections & programCollection) const412 void MemoryCommitmentTestCase::initPrograms(SourceCollections &programCollection) const
413 {
414 programCollection.glslSources.add("vert") << glu::VertexSource("#version 310 es\n"
415 "layout (location = 0) in highp vec4 a_position;\n"
416 "void main()\n"
417 "{\n"
418 " gl_Position = a_position;\n"
419 "}\n");
420
421 programCollection.glslSources.add("frag")
422 << glu::FragmentSource("#version 310 es\n"
423 "#extension GL_EXT_texture_buffer : enable\n"
424 "layout (set=0, binding=0) uniform highp usamplerBuffer u_buffer;\n"
425 "layout (location = 0) out highp uint o_color;\n"
426 "void main()\n"
427 "{\n"
428 " o_color = texelFetch(u_buffer, int(gl_FragCoord.x)).x;\n"
429 "}\n");
430 }
431
createCommandPool() const432 Move<VkCommandPool> MemoryCommitmentTestInstance::createCommandPool() const
433 {
434 const VkDevice device = m_context.getDevice();
435 const DeviceInterface &vkd = m_context.getDeviceInterface();
436 const uint32_t queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
437
438 return vk::createCommandPool(vkd, device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex);
439 }
440
allocatePrimaryCommandBuffer(VkCommandPool commandPool) const441 Move<VkCommandBuffer> MemoryCommitmentTestInstance::allocatePrimaryCommandBuffer(VkCommandPool commandPool) const
442 {
443 const VkDevice device = m_context.getDevice();
444 const DeviceInterface &vkd = m_context.getDeviceInterface();
445
446 return vk::allocateCommandBuffer(vkd, device, commandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
447 }
448
isDeviceMemoryCommitmentOk(const VkMemoryRequirements memoryRequirements)449 bool MemoryCommitmentTestInstance::isDeviceMemoryCommitmentOk(const VkMemoryRequirements memoryRequirements)
450 {
451 const VkFormat colorFormat = VK_FORMAT_R32_UINT;
452 const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
453 const InstanceInterface &vki = m_context.getInstanceInterface();
454 const VkMemoryPropertyFlags propertyFlag = VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;
455 const VkPhysicalDeviceMemoryProperties pMemoryProperties = getPhysicalDeviceMemoryProperties(vki, physicalDevice);
456 const VkDeviceSize pixelDataSize = m_renderSize.x() * m_renderSize.y() * mapVkFormat(colorFormat).getPixelSize();
457
458 for (uint32_t memTypeNdx = 0u; memTypeNdx < VK_MAX_MEMORY_TYPES; ++memTypeNdx)
459 {
460 if ((pMemoryProperties.memoryTypes[memTypeNdx].propertyFlags & propertyFlag) ==
461 propertyFlag) //if supports Lazy allocation
462 {
463 const VkMemoryAllocateInfo memAllocInfo = {
464 VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // VkStructureType sType
465 NULL, // const void* pNext
466 pixelDataSize, // VkDeviceSize allocationSize
467 memTypeNdx // uint32_t memoryTypeIndex
468 };
469 const VkDevice device = m_context.getDevice();
470 const DeviceInterface &vkd = m_context.getDeviceInterface();
471 Move<VkDeviceMemory> memory =
472 allocateMemory(vkd, device, &memAllocInfo, (const VkAllocationCallbacks *)DE_NULL);
473 VkDeviceSize pCommittedMemoryInBytes = 0u;
474 vkd.getDeviceMemoryCommitment(device, memory.get(), &pCommittedMemoryInBytes);
475 if (pCommittedMemoryInBytes <= memoryRequirements.size)
476 return true;
477 }
478 }
479 return false;
480 }
481
createMemoryCommitmentTests(tcu::TestContext & testCtx)482 tcu::TestCaseGroup *createMemoryCommitmentTests(tcu::TestContext &testCtx)
483 {
484 static const MemoryCommitmentCaseParams info = {
485 2048u, // uint32_t bufferSize
486 256u, // uint32_t bufferViewSize
487 0u, // uint32_t elementOffset
488 };
489
490 de::MovePtr<tcu::TestCaseGroup> getMemoryCommitmentTests(new tcu::TestCaseGroup(testCtx, "get_memory_commitment"));
491
492 {
493 getMemoryCommitmentTests->addChild(new MemoryCommitmentTestCase(testCtx, "memory_commitment", info));
494 getMemoryCommitmentTests->addChild(
495 new MemoryCommitmentAllocateOnlyTestCase(testCtx, "memory_commitment_allocate_only"));
496 }
497
498 return getMemoryCommitmentTests.release();
499 }
500
501 } // namespace api
502 } // namespace vkt
503