From 950d71ea596fc5dd35231fefdfa37b7976fabbbf Mon Sep 17 00:00:00 2001 From: John Zulauf Date: Thu, 18 Jan 2018 16:53:07 -0700 Subject: [PATCH] tests: Add create_info to two additional wrappers Added create_info utilies to BufferView and DescriptorPool in vk_testing. Change-Id: I0039aa7177e34a0acc40ec3be5f59957b242bcb6 --- tests/vktestbinding.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/vktestbinding.h b/tests/vktestbinding.h index fbbed3e..843d58e 100644 --- a/tests/vktestbinding.h +++ b/tests/vktestbinding.h @@ -17,6 +17,7 @@ * * Author: Courtney Goeltzenleuchter * Author: Cody Northrop + * Author: John Zulauf */ #ifndef VKTESTBINDING_H @@ -435,8 +436,22 @@ class BufferView : public internal::NonDispHandle { // vkCreateBufferView() void init(const Device &dev, const VkBufferViewCreateInfo &info); + static VkBufferViewCreateInfo createInfo(VkBuffer buffer, VkFormat format, VkDeviceSize offset = 0, + VkDeviceSize range = VK_WHOLE_SIZE); }; +inline VkBufferViewCreateInfo BufferView::createInfo(VkBuffer buffer, VkFormat format, VkDeviceSize offset, VkDeviceSize range) { + VkBufferViewCreateInfo info = {}; + info.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO; + info.pNext = nullptr; + info.flags = VkFlags(0); + info.buffer = buffer; + info.format = format; + info.offset = offset; + info.range = range; + return info; +} + class Image : public internal::NonDispHandle { public: explicit Image() : NonDispHandle(), format_features_(0) {} @@ -628,6 +643,10 @@ class DescriptorPool : public internal::NonDispHandle { std::vector alloc_sets(const Device &dev, const DescriptorSetLayout &layout, uint32_t count); DescriptorSet *alloc_sets(const Device &dev, const DescriptorSetLayout &layout); + template + static VkDescriptorPoolCreateInfo create_info(VkDescriptorPoolCreateFlags flags, uint32_t max_sets, + const PoolSizes &pool_sizes); + private: VkDescriptorPool pool_; @@ -635,6 +654,19 @@ class DescriptorPool : public internal::NonDispHandle { bool dynamic_usage_; }; +template +inline VkDescriptorPoolCreateInfo DescriptorPool::create_info(VkDescriptorPoolCreateFlags flags, uint32_t max_sets, + const PoolSizes &pool_sizes) { + VkDescriptorPoolCreateInfo info{}; + info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; + info.pNext = nullptr; + info.flags = flags; + info.maxSets = max_sets; + info.poolSizeCount = pool_sizes.size(); + info.pPoolSizes = (info.poolSizeCount) ? pool_sizes.data() : nullptr; + return info; +} + class DescriptorSet : public internal::NonDispHandle { public: ~DescriptorSet(); -- 2.7.4