Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2016 The Khronos Group Inc. |
| 3 | * Copyright (c) 2015-2016 Valve Corporation |
| 4 | * Copyright (c) 2015-2016 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and/or associated documentation files (the "Materials"), to |
| 8 | * deal in the Materials without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Materials, and to permit persons to whom the Materials are |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice(s) and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Materials. |
| 15 | * |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 16 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 19 | * |
| 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 21 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 22 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 23 | * USE OR OTHER DEALINGS IN THE MATERIALS. |
| 24 | * |
| 25 | * Author: Courtney Goeltzenleuchter <courtney@LunarG.com> |
| 26 | * Author: Cody Northrop <cody@lunarg.com> |
| 27 | */ |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 28 | |
| 29 | #ifndef VKTESTBINDING_H |
| 30 | #define VKTESTBINDING_H |
| 31 | |
| 32 | #include <vector> |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 33 | #include <assert.h> |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 34 | |
David Pinedo | 9316d3b | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 35 | #include "vulkan/vulkan.h" |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 36 | |
| 37 | namespace vk_testing { |
| 38 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 39 | typedef void (*ErrorCallback)(const char *expr, const char *file, |
| 40 | unsigned int line, const char *function); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 41 | void set_error_callback(ErrorCallback callback); |
| 42 | |
Chia-I Wu | 999f048 | 2015-07-03 10:32:05 +0800 | [diff] [blame] | 43 | class PhysicalDevice; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 44 | class Device; |
| 45 | class Queue; |
Chia-I Wu | f8f074f | 2015-07-03 10:58:57 +0800 | [diff] [blame] | 46 | class DeviceMemory; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 47 | class Fence; |
| 48 | class Semaphore; |
| 49 | class Event; |
| 50 | class QueryPool; |
| 51 | class Buffer; |
| 52 | class BufferView; |
| 53 | class Image; |
| 54 | class ImageView; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 55 | class DepthStencilView; |
| 56 | class Shader; |
| 57 | class Pipeline; |
| 58 | class PipelineDelta; |
| 59 | class Sampler; |
| 60 | class DescriptorSetLayout; |
Mark Lobodzinski | 0fadf5f | 2015-04-17 14:11:39 -0500 | [diff] [blame] | 61 | class PipelineLayout; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 62 | class DescriptorSetPool; |
| 63 | class DescriptorSet; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 64 | class CommandBuffer; |
| 65 | class CommandPool; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 66 | |
Courtney Goeltzenleuchter | 110fdf9 | 2015-06-29 15:39:26 -0600 | [diff] [blame] | 67 | std::vector<VkLayerProperties> GetGlobalLayers(); |
| 68 | std::vector<VkExtensionProperties> GetGlobalExtensions(); |
| 69 | std::vector<VkExtensionProperties> GetGlobalExtensions(const char *pLayerName); |
| 70 | |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 71 | namespace internal { |
| 72 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 73 | template <typename T> class Handle { |
| 74 | public: |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 75 | const T &handle() const { return handle_; } |
| 76 | bool initialized() const { return (handle_ != VK_NULL_HANDLE); } |
| 77 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 78 | protected: |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 79 | typedef T handle_type; |
| 80 | |
| 81 | explicit Handle() : handle_(VK_NULL_HANDLE) {} |
| 82 | explicit Handle(T handle) : handle_(handle) {} |
| 83 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 84 | void init(T handle) { |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 85 | assert(!initialized()); |
| 86 | handle_ = handle; |
| 87 | } |
| 88 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 89 | private: |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 90 | // handles are non-copyable |
| 91 | Handle(const Handle &); |
| 92 | Handle &operator=(const Handle &); |
| 93 | |
| 94 | T handle_; |
| 95 | }; |
| 96 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 97 | template <typename T> class NonDispHandle : public Handle<T> { |
| 98 | protected: |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 99 | explicit NonDispHandle() : Handle<T>(), dev_handle_(VK_NULL_HANDLE) {} |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 100 | explicit NonDispHandle(VkDevice dev, T handle) |
| 101 | : Handle<T>(handle), dev_handle_(dev) {} |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 102 | |
| 103 | const VkDevice &device() const { return dev_handle_; } |
| 104 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 105 | void init(VkDevice dev, T handle) { |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 106 | assert(!Handle<T>::initialized() && dev_handle_ == VK_NULL_HANDLE); |
| 107 | Handle<T>::init(handle); |
| 108 | dev_handle_ = dev; |
| 109 | } |
| 110 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 111 | private: |
Chia-I Wu | b0ed7d4 | 2015-07-03 10:13:26 +0800 | [diff] [blame] | 112 | VkDevice dev_handle_; |
| 113 | }; |
| 114 | |
| 115 | } // namespace internal |
| 116 | |
Chia-I Wu | 999f048 | 2015-07-03 10:32:05 +0800 | [diff] [blame] | 117 | class PhysicalDevice : public internal::Handle<VkPhysicalDevice> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 118 | public: |
| 119 | explicit PhysicalDevice(VkPhysicalDevice phy) : Handle(phy) { |
Mark Lobodzinski | b3fbcd9 | 2015-07-02 16:49:40 -0600 | [diff] [blame] | 120 | memory_properties_ = memory_properties(); |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 121 | device_properties_ = properties(); |
Mark Lobodzinski | b3fbcd9 | 2015-07-02 16:49:40 -0600 | [diff] [blame] | 122 | } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 123 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 124 | VkPhysicalDeviceProperties properties() const; |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 125 | VkPhysicalDeviceMemoryProperties memory_properties() const; |
Cody Northrop | d080288 | 2015-08-03 17:04:53 -0600 | [diff] [blame] | 126 | std::vector<VkQueueFamilyProperties> queue_properties() const; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 127 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 128 | bool set_memory_type(const uint32_t type_bits, VkMemoryAllocateInfo *info, |
| 129 | const VkMemoryPropertyFlags properties, |
| 130 | const VkMemoryPropertyFlags forbid = 0) const; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 131 | |
Courtney Goeltzenleuchter | 35985f6 | 2015-09-14 17:22:16 -0600 | [diff] [blame] | 132 | // vkEnumerateDeviceExtensionProperties() |
Courtney Goeltzenleuchter | f579fa6 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 133 | std::vector<VkExtensionProperties> extensions() const; |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 134 | std::vector<VkExtensionProperties> extensions(const char *pLayerName) const; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 135 | |
| 136 | // vkEnumerateLayers() |
Courtney Goeltzenleuchter | cd69eee | 2015-07-06 09:10:47 -0600 | [diff] [blame] | 137 | std::vector<VkLayerProperties> layers() const; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 138 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 139 | private: |
| 140 | void |
| 141 | add_extension_dependencies(uint32_t dependency_count, |
| 142 | VkExtensionProperties *depencency_props, |
| 143 | std::vector<VkExtensionProperties> &ext_list); |
Chia-I Wu | 999f048 | 2015-07-03 10:32:05 +0800 | [diff] [blame] | 144 | |
Mark Lobodzinski | b3fbcd9 | 2015-07-02 16:49:40 -0600 | [diff] [blame] | 145 | VkPhysicalDeviceMemoryProperties memory_properties_; |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 146 | |
| 147 | VkPhysicalDeviceProperties device_properties_; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 148 | }; |
| 149 | |
Chia-I Wu | f368b60 | 2015-07-03 10:41:20 +0800 | [diff] [blame] | 150 | class Device : public internal::Handle<VkDevice> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 151 | public: |
Chia-I Wu | 999f048 | 2015-07-03 10:32:05 +0800 | [diff] [blame] | 152 | explicit Device(VkPhysicalDevice phy) : phy_(phy) {} |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 153 | ~Device(); |
| 154 | |
| 155 | // vkCreateDevice() |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 156 | void init(const VkDeviceCreateInfo &info); |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 157 | void init(std::vector<const char *> &layers, |
| 158 | std::vector<const char *> & |
| 159 | extensions); // all queues, all extensions, etc |
| 160 | void init() { |
| 161 | std::vector<const char *> layers; |
| 162 | std::vector<const char *> extensions; |
| 163 | init(layers, extensions); |
| 164 | }; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 165 | |
Chia-I Wu | 999f048 | 2015-07-03 10:32:05 +0800 | [diff] [blame] | 166 | const PhysicalDevice &phy() const { return phy_; } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 167 | |
Jon Ashburn | 8d1b0b5 | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 168 | // vkGetDeviceProcAddr() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 169 | PFN_vkVoidFunction get_proc(const char *name) const { |
| 170 | return vkGetDeviceProcAddr(handle(), name); |
| 171 | } |
Jon Ashburn | 8d1b0b5 | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 172 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 173 | // vkGetDeviceQueue() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 174 | const std::vector<Queue *> &graphics_queues() const { |
| 175 | return queues_[GRAPHICS]; |
| 176 | } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 177 | const std::vector<Queue *> &compute_queues() { return queues_[COMPUTE]; } |
| 178 | const std::vector<Queue *> &dma_queues() { return queues_[DMA]; } |
| 179 | uint32_t graphics_queue_node_index_; |
| 180 | |
| 181 | struct Format { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 182 | VkFormat format; |
| 183 | VkImageTiling tiling; |
| 184 | VkFlags features; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 185 | }; |
| 186 | // vkGetFormatInfo() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 187 | VkFormatProperties format_properties(VkFormat format); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 188 | const std::vector<Format> &formats() const { return formats_; } |
| 189 | |
| 190 | // vkDeviceWaitIdle() |
| 191 | void wait(); |
| 192 | |
| 193 | // vkWaitForFences() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 194 | VkResult wait(const std::vector<const Fence *> &fences, bool wait_all, |
| 195 | uint64_t timeout); |
| 196 | VkResult wait(const Fence &fence) { |
| 197 | return wait(std::vector<const Fence *>(1, &fence), true, (uint64_t)-1); |
| 198 | } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 199 | |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 200 | // vkUpdateDescriptorSets() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 201 | void update_descriptor_sets(const std::vector<VkWriteDescriptorSet> &writes, |
| 202 | const std::vector<VkCopyDescriptorSet> &copies); |
| 203 | void |
| 204 | update_descriptor_sets(const std::vector<VkWriteDescriptorSet> &writes) { |
| 205 | return update_descriptor_sets(writes, |
| 206 | std::vector<VkCopyDescriptorSet>()); |
| 207 | } |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 208 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 209 | static VkWriteDescriptorSet |
| 210 | write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 211 | uint32_t array_element, VkDescriptorType type, |
| 212 | uint32_t count, |
| 213 | const VkDescriptorImageInfo *image_info); |
| 214 | static VkWriteDescriptorSet |
| 215 | write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 216 | uint32_t array_element, VkDescriptorType type, |
| 217 | uint32_t count, |
| 218 | const VkDescriptorBufferInfo *buffer_info); |
| 219 | static VkWriteDescriptorSet |
| 220 | write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 221 | uint32_t array_element, VkDescriptorType type, |
| 222 | uint32_t count, const VkBufferView *buffer_views); |
| 223 | static VkWriteDescriptorSet |
| 224 | write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 225 | uint32_t array_element, VkDescriptorType type, |
| 226 | const std::vector<VkDescriptorImageInfo> &image_info); |
| 227 | static VkWriteDescriptorSet write_descriptor_set( |
| 228 | const DescriptorSet &set, uint32_t binding, uint32_t array_element, |
| 229 | VkDescriptorType type, |
| 230 | const std::vector<VkDescriptorBufferInfo> &buffer_info); |
| 231 | static VkWriteDescriptorSet |
| 232 | write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 233 | uint32_t array_element, VkDescriptorType type, |
| 234 | const std::vector<VkBufferView> &buffer_views); |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 235 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 236 | static VkCopyDescriptorSet |
| 237 | copy_descriptor_set(const DescriptorSet &src_set, uint32_t src_binding, |
| 238 | uint32_t src_array_element, |
| 239 | const DescriptorSet &dst_set, uint32_t dst_binding, |
| 240 | uint32_t dst_array_element, uint32_t count); |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 241 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 242 | private: |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 243 | enum QueueIndex { |
| 244 | GRAPHICS, |
| 245 | COMPUTE, |
| 246 | DMA, |
| 247 | QUEUE_COUNT, |
| 248 | }; |
| 249 | |
| 250 | void init_queues(); |
| 251 | void init_formats(); |
| 252 | |
Chia-I Wu | 999f048 | 2015-07-03 10:32:05 +0800 | [diff] [blame] | 253 | PhysicalDevice phy_; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 254 | |
| 255 | std::vector<Queue *> queues_[QUEUE_COUNT]; |
| 256 | std::vector<Format> formats_; |
| 257 | }; |
| 258 | |
Chia-I Wu | df12ffd | 2015-07-03 10:53:18 +0800 | [diff] [blame] | 259 | class Queue : public internal::Handle<VkQueue> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 260 | public: |
| 261 | explicit Queue(VkQueue queue, int index) : Handle(queue) { |
| 262 | family_index_ = index; |
| 263 | } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 264 | |
| 265 | // vkQueueSubmit() |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 266 | void submit(const std::vector<const CommandBuffer *> &cmds, Fence &fence); |
| 267 | void submit(const CommandBuffer &cmd, Fence &fence); |
| 268 | void submit(const CommandBuffer &cmd); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 269 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 270 | // vkQueueWaitIdle() |
| 271 | void wait(); |
| 272 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 273 | int get_family_index() { return family_index_; } |
Tony Barbour | fb21ea3 | 2015-07-23 10:35:30 -0600 | [diff] [blame] | 274 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 275 | private: |
Tony Barbour | fb21ea3 | 2015-07-23 10:35:30 -0600 | [diff] [blame] | 276 | int family_index_; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 277 | }; |
| 278 | |
Chia-I Wu | f8f074f | 2015-07-03 10:58:57 +0800 | [diff] [blame] | 279 | class DeviceMemory : public internal::NonDispHandle<VkDeviceMemory> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 280 | public: |
Chia-I Wu | f8f074f | 2015-07-03 10:58:57 +0800 | [diff] [blame] | 281 | ~DeviceMemory(); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 282 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 283 | // vkAllocateMemory() |
| 284 | void init(const Device &dev, const VkMemoryAllocateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 285 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 286 | // vkMapMemory() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 287 | const void *map(VkFlags flags) const; |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 288 | void *map(VkFlags flags); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 289 | const void *map() const { return map(0); } |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 290 | void *map() { return map(0); } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 291 | |
| 292 | // vkUnmapMemory() |
| 293 | void unmap() const; |
| 294 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 295 | static VkMemoryAllocateInfo alloc_info(VkDeviceSize size, |
| 296 | uint32_t memory_type_index); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 297 | }; |
| 298 | |
Chia-I Wu | d9e8e82 | 2015-07-03 11:45:55 +0800 | [diff] [blame] | 299 | class Fence : public internal::NonDispHandle<VkFence> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 300 | public: |
Chia-I Wu | d9e8e82 | 2015-07-03 11:45:55 +0800 | [diff] [blame] | 301 | ~Fence(); |
| 302 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 303 | // vkCreateFence() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 304 | void init(const Device &dev, const VkFenceCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 305 | |
| 306 | // vkGetFenceStatus() |
Chia-I Wu | d9e8e82 | 2015-07-03 11:45:55 +0800 | [diff] [blame] | 307 | VkResult status() const { return vkGetFenceStatus(device(), handle()); } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 308 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 309 | static VkFenceCreateInfo create_info(VkFenceCreateFlags flags); |
| 310 | static VkFenceCreateInfo create_info(); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 311 | }; |
| 312 | |
Chia-I Wu | 6b1c248 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 313 | class Semaphore : public internal::NonDispHandle<VkSemaphore> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 314 | public: |
Chia-I Wu | 6b1c248 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 315 | ~Semaphore(); |
| 316 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 317 | // vkCreateSemaphore() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 318 | void init(const Device &dev, const VkSemaphoreCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 319 | |
Tony Barbour | af892a1 | 2015-06-26 12:56:09 -0600 | [diff] [blame] | 320 | static VkSemaphoreCreateInfo create_info(VkFlags flags); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 321 | }; |
| 322 | |
Chia-I Wu | c5c9799 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 323 | class Event : public internal::NonDispHandle<VkEvent> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 324 | public: |
Chia-I Wu | c5c9799 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 325 | ~Event(); |
| 326 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 327 | // vkCreateEvent() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 328 | void init(const Device &dev, const VkEventCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 329 | |
| 330 | // vkGetEventStatus() |
| 331 | // vkSetEvent() |
| 332 | // vkResetEvent() |
Chia-I Wu | c5c9799 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 333 | VkResult status() const { return vkGetEventStatus(device(), handle()); } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 334 | void set(); |
| 335 | void reset(); |
| 336 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 337 | static VkEventCreateInfo create_info(VkFlags flags); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 338 | }; |
| 339 | |
Chia-I Wu | 1b7d476 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 340 | class QueryPool : public internal::NonDispHandle<VkQueryPool> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 341 | public: |
Chia-I Wu | 1b7d476 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 342 | ~QueryPool(); |
| 343 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 344 | // vkCreateQueryPool() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 345 | void init(const Device &dev, const VkQueryPoolCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 346 | |
| 347 | // vkGetQueryPoolResults() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 348 | VkResult results(uint32_t first, uint32_t count, size_t size, void *data, |
| 349 | size_t stride); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 350 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 351 | static VkQueryPoolCreateInfo create_info(VkQueryType type, |
| 352 | uint32_t slot_count); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 353 | }; |
| 354 | |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 355 | class Buffer : public internal::NonDispHandle<VkBuffer> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 356 | public: |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 357 | explicit Buffer() : NonDispHandle() {} |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 358 | explicit Buffer(const Device &dev, const VkBufferCreateInfo &info) { |
| 359 | init(dev, info); |
| 360 | } |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 361 | explicit Buffer(const Device &dev, VkDeviceSize size) { init(dev, size); } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 362 | |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 363 | ~Buffer(); |
| 364 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 365 | // vkCreateBuffer() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 366 | void init(const Device &dev, const VkBufferCreateInfo &info, |
| 367 | VkMemoryPropertyFlags mem_props); |
| 368 | void init(const Device &dev, const VkBufferCreateInfo &info) { |
| 369 | init(dev, info, 0); |
| 370 | } |
| 371 | void init(const Device &dev, VkDeviceSize size, |
| 372 | VkMemoryPropertyFlags mem_props) { |
| 373 | init(dev, create_info(size, 0), mem_props); |
| 374 | } |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 375 | void init(const Device &dev, VkDeviceSize size) { init(dev, size, 0); } |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 376 | void init_as_src(const Device &dev, VkDeviceSize size, |
| 377 | VkMemoryPropertyFlags &reqs) { |
| 378 | init(dev, create_info(size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT), reqs); |
| 379 | } |
| 380 | void init_as_dst(const Device &dev, VkDeviceSize size, |
| 381 | VkMemoryPropertyFlags &reqs) { |
| 382 | init(dev, create_info(size, VK_BUFFER_USAGE_TRANSFER_DST_BIT), reqs); |
| 383 | } |
| 384 | void init_as_src_and_dst(const Device &dev, VkDeviceSize size, |
| 385 | VkMemoryPropertyFlags &reqs) { |
| 386 | init(dev, create_info(size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | |
| 387 | VK_BUFFER_USAGE_TRANSFER_DST_BIT), |
| 388 | reqs); |
| 389 | } |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 390 | void init_no_mem(const Device &dev, const VkBufferCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 391 | |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 392 | // get the internal memory |
| 393 | const DeviceMemory &memory() const { return internal_mem_; } |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 394 | DeviceMemory &memory() { return internal_mem_; } |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 395 | |
| 396 | // vkGetObjectMemoryRequirements() |
| 397 | VkMemoryRequirements memory_requirements() const; |
| 398 | |
| 399 | // vkBindObjectMemory() |
| 400 | void bind_memory(const DeviceMemory &mem, VkDeviceSize mem_offset); |
Mark Lobodzinski | 942b172 | 2015-05-11 17:21:15 -0500 | [diff] [blame] | 401 | |
Tony Barbour | d1c3572 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 402 | static VkBufferCreateInfo create_info(VkDeviceSize size, VkFlags usage); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 403 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 404 | VkBufferMemoryBarrier buffer_memory_barrier(VkFlags output_mask, |
| 405 | VkFlags input_mask, |
| 406 | VkDeviceSize offset, |
| 407 | VkDeviceSize size) const { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 408 | VkBufferMemoryBarrier barrier = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 409 | barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 410 | barrier.buffer = handle(); |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 411 | barrier.srcAccessMask = output_mask; |
| 412 | barrier.dstAccessMask = input_mask; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 413 | barrier.offset = offset; |
| 414 | barrier.size = size; |
| 415 | return barrier; |
| 416 | } |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 417 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 418 | private: |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 419 | VkBufferCreateInfo create_info_; |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 420 | |
| 421 | DeviceMemory internal_mem_; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 422 | }; |
| 423 | |
Chia-I Wu | 3158bf3 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 424 | class BufferView : public internal::NonDispHandle<VkBufferView> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 425 | public: |
Chia-I Wu | 3158bf3 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 426 | ~BufferView(); |
| 427 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 428 | // vkCreateBufferView() |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 429 | void init(const Device &dev, const VkBufferViewCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 430 | }; |
| 431 | |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 432 | class Image : public internal::NonDispHandle<VkImage> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 433 | public: |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 434 | explicit Image() : NonDispHandle(), format_features_(0) {} |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 435 | explicit Image(const Device &dev, const VkImageCreateInfo &info) |
| 436 | : format_features_(0) { |
| 437 | init(dev, info); |
| 438 | } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 439 | |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 440 | ~Image(); |
| 441 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 442 | // vkCreateImage() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 443 | void init(const Device &dev, const VkImageCreateInfo &info, |
| 444 | VkMemoryPropertyFlags mem_props); |
| 445 | void init(const Device &dev, const VkImageCreateInfo &info) { |
| 446 | init(dev, info, 0); |
| 447 | } |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 448 | void init_no_mem(const Device &dev, const VkImageCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 449 | |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 450 | // get the internal memory |
| 451 | const DeviceMemory &memory() const { return internal_mem_; } |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 452 | DeviceMemory &memory() { return internal_mem_; } |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 453 | |
| 454 | // vkGetObjectMemoryRequirements() |
| 455 | VkMemoryRequirements memory_requirements() const; |
| 456 | |
| 457 | // vkBindObjectMemory() |
| 458 | void bind_memory(const DeviceMemory &mem, VkDeviceSize mem_offset); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 459 | |
Tony Barbour | 59a4732 | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 460 | // vkGetImageSubresourceLayout() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 461 | VkSubresourceLayout |
| 462 | subresource_layout(const VkImageSubresource &subres) const; |
| 463 | VkSubresourceLayout |
| 464 | subresource_layout(const VkImageSubresourceLayers &subres) const; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 465 | |
| 466 | bool transparent() const; |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 467 | bool copyable() const { |
| 468 | return (format_features_ & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT); |
| 469 | } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 470 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 471 | VkImageSubresourceRange |
| 472 | subresource_range(VkImageAspectFlagBits aspect) const { |
| 473 | return subresource_range(create_info_, aspect); |
| 474 | } |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 475 | VkExtent3D extent() const { return create_info_.extent; } |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 476 | VkExtent3D extent(uint32_t mip_level) const { |
| 477 | return extent(create_info_.extent, mip_level); |
| 478 | } |
| 479 | VkFormat format() const { return create_info_.format; } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 480 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 481 | VkImageMemoryBarrier |
| 482 | image_memory_barrier(VkFlags output_mask, VkFlags input_mask, |
| 483 | VkImageLayout old_layout, VkImageLayout new_layout, |
| 484 | const VkImageSubresourceRange &range) const { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 485 | VkImageMemoryBarrier barrier = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 486 | barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; |
Chia-I Wu | a459420 | 2015-10-27 19:54:37 +0800 | [diff] [blame] | 487 | barrier.srcAccessMask = output_mask; |
| 488 | barrier.dstAccessMask = input_mask; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 489 | barrier.oldLayout = old_layout; |
| 490 | barrier.newLayout = new_layout; |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 491 | barrier.image = handle(); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 492 | barrier.subresourceRange = range; |
| 493 | return barrier; |
| 494 | } |
| 495 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 496 | static VkImageCreateInfo create_info(); |
Courtney Goeltzenleuchter | 908e767 | 2015-10-21 17:00:51 -0600 | [diff] [blame] | 497 | static VkImageAspectFlagBits image_aspect(VkImageAspectFlags flags); |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 498 | static VkImageSubresource subresource(VkImageAspectFlagBits aspect, |
| 499 | uint32_t mip_level, |
| 500 | uint32_t array_layer); |
| 501 | static VkImageSubresource subresource(const VkImageSubresourceRange &range, |
| 502 | uint32_t mip_level, |
| 503 | uint32_t array_layer); |
| 504 | static VkImageSubresourceLayers subresource(VkImageAspectFlagBits aspect, |
| 505 | uint32_t mip_level, |
| 506 | uint32_t array_layer, |
| 507 | uint32_t array_size); |
| 508 | static VkImageSubresourceLayers |
| 509 | subresource(const VkImageSubresourceRange &range, uint32_t mip_level, |
| 510 | uint32_t array_layer, uint32_t array_size); |
| 511 | static VkImageSubresourceRange |
| 512 | subresource_range(VkImageAspectFlags aspect_mask, uint32_t base_mip_level, |
| 513 | uint32_t mip_levels, uint32_t base_array_layer, |
| 514 | uint32_t num_layers); |
| 515 | static VkImageSubresourceRange |
| 516 | subresource_range(const VkImageCreateInfo &info, |
| 517 | VkImageAspectFlags aspect_mask); |
| 518 | static VkImageSubresourceRange |
| 519 | subresource_range(const VkImageSubresource &subres); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 520 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 521 | static VkExtent2D extent(int32_t width, int32_t height); |
| 522 | static VkExtent2D extent(const VkExtent2D &extent, uint32_t mip_level); |
| 523 | static VkExtent2D extent(const VkExtent3D &extent); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 524 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 525 | static VkExtent3D extent(int32_t width, int32_t height, int32_t depth); |
| 526 | static VkExtent3D extent(const VkExtent3D &extent, uint32_t mip_level); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 527 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 528 | private: |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 529 | void init_info(const Device &dev, const VkImageCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 530 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 531 | VkImageCreateInfo create_info_; |
| 532 | VkFlags format_features_; |
Chia-I Wu | 681d7a0 | 2015-07-03 13:44:34 +0800 | [diff] [blame] | 533 | |
| 534 | DeviceMemory internal_mem_; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 535 | }; |
| 536 | |
Chia-I Wu | 3158bf3 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 537 | class ImageView : public internal::NonDispHandle<VkImageView> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 538 | public: |
Chia-I Wu | 3158bf3 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 539 | ~ImageView(); |
| 540 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 541 | // vkCreateImageView() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 542 | void init(const Device &dev, const VkImageViewCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 543 | }; |
| 544 | |
Chia-I Wu | 4d0c792 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 545 | class ShaderModule : public internal::NonDispHandle<VkShaderModule> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 546 | public: |
Chia-I Wu | 4d0c792 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 547 | ~ShaderModule(); |
| 548 | |
Courtney Goeltzenleuchter | ee4027d | 2015-06-28 13:01:17 -0600 | [diff] [blame] | 549 | // vkCreateShaderModule() |
| 550 | void init(const Device &dev, const VkShaderModuleCreateInfo &info); |
| 551 | VkResult init_try(const Device &dev, const VkShaderModuleCreateInfo &info); |
| 552 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 553 | static VkShaderModuleCreateInfo |
| 554 | create_info(size_t code_size, const uint32_t *code, VkFlags flags); |
Courtney Goeltzenleuchter | ee4027d | 2015-06-28 13:01:17 -0600 | [diff] [blame] | 555 | }; |
| 556 | |
Chia-I Wu | 2ff72fd | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 557 | class Pipeline : public internal::NonDispHandle<VkPipeline> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 558 | public: |
Chia-I Wu | 2ff72fd | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 559 | ~Pipeline(); |
| 560 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 561 | // vkCreateGraphicsPipeline() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 562 | void init(const Device &dev, const VkGraphicsPipelineCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 563 | // vkCreateGraphicsPipelineDerivative() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 564 | void init(const Device &dev, const VkGraphicsPipelineCreateInfo &info, |
| 565 | const VkPipeline basePipeline); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 566 | // vkCreateComputePipeline() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 567 | void init(const Device &dev, const VkComputePipelineCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 568 | // vkLoadPipeline() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 569 | void init(const Device &dev, size_t size, const void *data); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 570 | // vkLoadPipelineDerivative() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 571 | void init(const Device &dev, size_t size, const void *data, |
| 572 | VkPipeline basePipeline); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 573 | |
Chris Forbes | 95292b1 | 2015-05-25 11:13:26 +1200 | [diff] [blame] | 574 | // vkCreateGraphicsPipeline with error return |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 575 | VkResult init_try(const Device &dev, |
| 576 | const VkGraphicsPipelineCreateInfo &info); |
Chris Forbes | 95292b1 | 2015-05-25 11:13:26 +1200 | [diff] [blame] | 577 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 578 | // vkStorePipeline() |
| 579 | size_t store(size_t size, void *data); |
| 580 | }; |
| 581 | |
Chia-I Wu | fd46e7d | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 582 | class PipelineLayout : public internal::NonDispHandle<VkPipelineLayout> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 583 | public: |
Chia-I Wu | fd46e7d | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 584 | ~PipelineLayout(); |
| 585 | |
| 586 | // vCreatePipelineLayout() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 587 | void init(const Device &dev, VkPipelineLayoutCreateInfo &info, |
| 588 | const std::vector<const DescriptorSetLayout *> &layouts); |
Chia-I Wu | fd46e7d | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 589 | }; |
| 590 | |
Chia-I Wu | 8c721c6 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 591 | class Sampler : public internal::NonDispHandle<VkSampler> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 592 | public: |
Chia-I Wu | 8c721c6 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 593 | ~Sampler(); |
| 594 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 595 | // vkCreateSampler() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 596 | void init(const Device &dev, const VkSamplerCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 597 | }; |
| 598 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 599 | class DescriptorSetLayout |
| 600 | : public internal::NonDispHandle<VkDescriptorSetLayout> { |
| 601 | public: |
Chia-I Wu | afdfd7f | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 602 | ~DescriptorSetLayout(); |
| 603 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 604 | // vkCreateDescriptorSetLayout() |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 605 | void init(const Device &dev, const VkDescriptorSetLayoutCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 606 | }; |
| 607 | |
Chia-I Wu | afdfd7f | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 608 | class DescriptorPool : public internal::NonDispHandle<VkDescriptorPool> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 609 | public: |
Chia-I Wu | afdfd7f | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 610 | ~DescriptorPool(); |
| 611 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 612 | // Descriptor sets allocated from this pool will need access to the original |
| 613 | // object |
Cody Northrop | cdc72a4 | 2015-10-08 11:39:25 -0600 | [diff] [blame] | 614 | VkDescriptorPool GetObj() { return pool_; } |
| 615 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 616 | // vkCreateDescriptorPool() |
Courtney Goeltzenleuchter | fe908d3 | 2015-09-16 16:12:45 -0600 | [diff] [blame] | 617 | void init(const Device &dev, const VkDescriptorPoolCreateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 618 | |
| 619 | // vkResetDescriptorPool() |
| 620 | void reset(); |
| 621 | |
Cody Northrop | cdc72a4 | 2015-10-08 11:39:25 -0600 | [diff] [blame] | 622 | // vkFreeDescriptorSet() |
| 623 | void setDynamicUsage(bool isDynamic) { dynamic_usage_ = isDynamic; } |
| 624 | bool getDynamicUsage() { return dynamic_usage_; } |
| 625 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 626 | // vkAllocateDescriptorSets() |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 627 | std::vector<DescriptorSet *> |
| 628 | alloc_sets(const Device &dev, |
| 629 | const std::vector<const DescriptorSetLayout *> &layouts); |
| 630 | std::vector<DescriptorSet *> alloc_sets(const Device &dev, |
| 631 | const DescriptorSetLayout &layout, |
| 632 | uint32_t count); |
| 633 | DescriptorSet *alloc_sets(const Device &dev, |
| 634 | const DescriptorSetLayout &layout); |
Cody Northrop | cdc72a4 | 2015-10-08 11:39:25 -0600 | [diff] [blame] | 635 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 636 | private: |
Cody Northrop | cdc72a4 | 2015-10-08 11:39:25 -0600 | [diff] [blame] | 637 | VkDescriptorPool pool_; |
| 638 | |
| 639 | // Track whether this pool's usage is VK_DESCRIPTOR_POOL_USAGE_DYNAMIC |
| 640 | bool dynamic_usage_; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 641 | }; |
| 642 | |
Chia-I Wu | afdfd7f | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 643 | class DescriptorSet : public internal::NonDispHandle<VkDescriptorSet> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 644 | public: |
Chia-I Wu | afdfd7f | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 645 | ~DescriptorSet(); |
| 646 | |
| 647 | explicit DescriptorSet() : NonDispHandle() {} |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 648 | explicit DescriptorSet(const Device &dev, DescriptorPool *pool, |
| 649 | VkDescriptorSet set) |
| 650 | : NonDispHandle(dev.handle(), set) { |
| 651 | containing_pool_ = pool; |
| 652 | } |
Tony Barbour | 67e9915 | 2015-07-10 14:10:27 -0600 | [diff] [blame] | 653 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 654 | private: |
| 655 | DescriptorPool *containing_pool_; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 656 | }; |
| 657 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 658 | class CommandPool : public internal::NonDispHandle<VkCommandPool> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 659 | public: |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 660 | ~CommandPool(); |
Courtney Goeltzenleuchter | ee5d80b | 2015-07-10 19:50:17 -0600 | [diff] [blame] | 661 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 662 | explicit CommandPool() : NonDispHandle() {} |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 663 | explicit CommandPool(const Device &dev, |
| 664 | const VkCommandPoolCreateInfo &info) { |
| 665 | init(dev, info); |
| 666 | } |
Courtney Goeltzenleuchter | ee5d80b | 2015-07-10 19:50:17 -0600 | [diff] [blame] | 667 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 668 | void init(const Device &dev, const VkCommandPoolCreateInfo &info); |
Courtney Goeltzenleuchter | ee5d80b | 2015-07-10 19:50:17 -0600 | [diff] [blame] | 669 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 670 | static VkCommandPoolCreateInfo create_info(uint32_t queue_family_index); |
Courtney Goeltzenleuchter | ee5d80b | 2015-07-10 19:50:17 -0600 | [diff] [blame] | 671 | }; |
| 672 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 673 | inline VkCommandPoolCreateInfo |
| 674 | CommandPool::create_info(uint32_t queue_family_index) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 675 | VkCommandPoolCreateInfo info = {}; |
| 676 | info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; |
Courtney Goeltzenleuchter | ee5d80b | 2015-07-10 19:50:17 -0600 | [diff] [blame] | 677 | info.queueFamilyIndex = queue_family_index; |
Tobin Ehlis | ac0ef84 | 2015-12-14 13:46:38 -0700 | [diff] [blame] | 678 | info.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; |
Courtney Goeltzenleuchter | ee5d80b | 2015-07-10 19:50:17 -0600 | [diff] [blame] | 679 | return info; |
| 680 | } |
| 681 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 682 | class CommandBuffer : public internal::Handle<VkCommandBuffer> { |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 683 | public: |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 684 | ~CommandBuffer(); |
Chia-I Wu | be2b917 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 685 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 686 | explicit CommandBuffer() : Handle() {} |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 687 | explicit CommandBuffer(const Device &dev, |
| 688 | const VkCommandBufferAllocateInfo &info) { |
| 689 | init(dev, info); |
| 690 | } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 691 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 692 | // vkAllocateCommandBuffers() |
| 693 | void init(const Device &dev, const VkCommandBufferAllocateInfo &info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 694 | |
| 695 | // vkBeginCommandBuffer() |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 696 | void begin(const VkCommandBufferBeginInfo *info); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 697 | void begin(); |
| 698 | |
| 699 | // vkEndCommandBuffer() |
| 700 | // vkResetCommandBuffer() |
| 701 | void end(); |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 702 | void reset(VkCommandBufferResetFlags flags); |
| 703 | void reset() { reset(VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT); } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 704 | |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 705 | static VkCommandBufferAllocateInfo create_info(VkCommandPool const &pool); |
Chia-I Wu | be2b917 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 706 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 707 | private: |
Chia-I Wu | be2b917 | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 708 | VkDevice dev_handle_; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 709 | VkCommandPool cmd_pool_; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 710 | }; |
| 711 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 712 | inline VkMemoryAllocateInfo |
| 713 | DeviceMemory::alloc_info(VkDeviceSize size, uint32_t memory_type_index) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 714 | VkMemoryAllocateInfo info = {}; |
Chia-I Wu | 00ce540 | 2015-11-10 16:21:09 +0800 | [diff] [blame] | 715 | info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; |
Chia-I Wu | f8f074f | 2015-07-03 10:58:57 +0800 | [diff] [blame] | 716 | info.allocationSize = size; |
| 717 | info.memoryTypeIndex = memory_type_index; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 718 | return info; |
| 719 | } |
| 720 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 721 | inline VkBufferCreateInfo Buffer::create_info(VkDeviceSize size, |
| 722 | VkFlags usage) { |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 723 | VkBufferCreateInfo info = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 724 | info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; |
| 725 | info.size = size; |
| 726 | info.usage = usage; |
| 727 | return info; |
| 728 | } |
| 729 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 730 | inline VkFenceCreateInfo Fence::create_info(VkFenceCreateFlags flags) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 731 | VkFenceCreateInfo info = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 732 | info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; |
| 733 | info.flags = flags; |
| 734 | return info; |
| 735 | } |
| 736 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 737 | inline VkFenceCreateInfo Fence::create_info() { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 738 | VkFenceCreateInfo info = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 739 | info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; |
| 740 | return info; |
| 741 | } |
| 742 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 743 | inline VkSemaphoreCreateInfo Semaphore::create_info(VkFlags flags) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 744 | VkSemaphoreCreateInfo info = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 745 | info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 746 | info.flags = flags; |
| 747 | return info; |
| 748 | } |
| 749 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 750 | inline VkEventCreateInfo Event::create_info(VkFlags flags) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 751 | VkEventCreateInfo info = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 752 | info.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO; |
| 753 | info.flags = flags; |
| 754 | return info; |
| 755 | } |
| 756 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 757 | inline VkQueryPoolCreateInfo QueryPool::create_info(VkQueryType type, |
| 758 | uint32_t slot_count) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 759 | VkQueryPoolCreateInfo info = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 760 | info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO; |
| 761 | info.queryType = type; |
Jon Ashburn | f19916e | 2016-01-11 13:12:43 -0700 | [diff] [blame] | 762 | info.queryCount = slot_count; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 763 | return info; |
| 764 | } |
| 765 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 766 | inline VkImageCreateInfo Image::create_info() { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 767 | VkImageCreateInfo info = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 768 | info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; |
| 769 | info.extent.width = 1; |
| 770 | info.extent.height = 1; |
| 771 | info.extent.depth = 1; |
| 772 | info.mipLevels = 1; |
Courtney Goeltzenleuchter | 5d2aed4 | 2015-10-21 17:57:31 -0600 | [diff] [blame] | 773 | info.arrayLayers = 1; |
Chia-I Wu | 5c17c96 | 2015-10-31 00:31:16 +0800 | [diff] [blame] | 774 | info.samples = VK_SAMPLE_COUNT_1_BIT; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 775 | return info; |
| 776 | } |
| 777 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 778 | inline VkImageSubresource Image::subresource(VkImageAspectFlagBits aspect, |
| 779 | uint32_t mip_level, |
| 780 | uint32_t array_layer) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 781 | VkImageSubresource subres = {}; |
Chia-I Wu | 52b07e7 | 2015-10-27 19:55:05 +0800 | [diff] [blame] | 782 | subres.aspectMask = aspect; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 783 | subres.mipLevel = mip_level; |
Courtney Goeltzenleuchter | 4a26189 | 2015-09-10 16:38:41 -0600 | [diff] [blame] | 784 | subres.arrayLayer = array_layer; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 785 | return subres; |
| 786 | } |
| 787 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 788 | inline VkImageSubresource |
| 789 | Image::subresource(const VkImageSubresourceRange &range, uint32_t mip_level, |
| 790 | uint32_t array_layer) { |
| 791 | return subresource(image_aspect(range.aspectMask), |
| 792 | range.baseMipLevel + mip_level, |
| 793 | range.baseArrayLayer + array_layer); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 794 | } |
| 795 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 796 | inline VkImageSubresourceLayers Image::subresource(VkImageAspectFlagBits aspect, |
| 797 | uint32_t mip_level, |
| 798 | uint32_t array_layer, |
| 799 | uint32_t array_size) { |
Chia-I Wu | 1b99bb2 | 2015-10-27 19:25:11 +0800 | [diff] [blame] | 800 | VkImageSubresourceLayers subres = {}; |
Chia-I Wu | ab83a0e | 2015-10-27 19:00:15 +0800 | [diff] [blame] | 801 | subres.aspectMask = aspect; |
Courtney Goeltzenleuchter | 01ee1ca | 2015-09-10 16:41:13 -0600 | [diff] [blame] | 802 | subres.mipLevel = mip_level; |
Courtney Goeltzenleuchter | 8367ce0 | 2015-10-16 09:46:00 -0600 | [diff] [blame] | 803 | subres.baseArrayLayer = array_layer; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 804 | subres.layerCount = array_size; |
Courtney Goeltzenleuchter | 01ee1ca | 2015-09-10 16:41:13 -0600 | [diff] [blame] | 805 | return subres; |
| 806 | } |
| 807 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 808 | inline VkImageAspectFlagBits Image::image_aspect(VkImageAspectFlags flags) { |
Courtney Goeltzenleuchter | ba72451 | 2015-09-10 17:58:54 -0600 | [diff] [blame] | 809 | /* |
| 810 | * This will map VkImageAspectFlags into a single VkImageAspect. |
| 811 | * If there is more than one bit defined we'll get an assertion. |
| 812 | */ |
| 813 | switch (flags) { |
| 814 | case VK_IMAGE_ASPECT_COLOR_BIT: |
Courtney Goeltzenleuchter | 908e767 | 2015-10-21 17:00:51 -0600 | [diff] [blame] | 815 | return VK_IMAGE_ASPECT_COLOR_BIT; |
Courtney Goeltzenleuchter | ba72451 | 2015-09-10 17:58:54 -0600 | [diff] [blame] | 816 | case VK_IMAGE_ASPECT_DEPTH_BIT: |
Courtney Goeltzenleuchter | 908e767 | 2015-10-21 17:00:51 -0600 | [diff] [blame] | 817 | return VK_IMAGE_ASPECT_DEPTH_BIT; |
Courtney Goeltzenleuchter | ba72451 | 2015-09-10 17:58:54 -0600 | [diff] [blame] | 818 | case VK_IMAGE_ASPECT_STENCIL_BIT: |
Courtney Goeltzenleuchter | 908e767 | 2015-10-21 17:00:51 -0600 | [diff] [blame] | 819 | return VK_IMAGE_ASPECT_STENCIL_BIT; |
Courtney Goeltzenleuchter | ba72451 | 2015-09-10 17:58:54 -0600 | [diff] [blame] | 820 | case VK_IMAGE_ASPECT_METADATA_BIT: |
Courtney Goeltzenleuchter | 908e767 | 2015-10-21 17:00:51 -0600 | [diff] [blame] | 821 | return VK_IMAGE_ASPECT_METADATA_BIT; |
Courtney Goeltzenleuchter | ba72451 | 2015-09-10 17:58:54 -0600 | [diff] [blame] | 822 | default: |
| 823 | assert(!"Invalid VkImageAspect"); |
| 824 | } |
Courtney Goeltzenleuchter | 908e767 | 2015-10-21 17:00:51 -0600 | [diff] [blame] | 825 | return VK_IMAGE_ASPECT_COLOR_BIT; |
Courtney Goeltzenleuchter | 01ee1ca | 2015-09-10 16:41:13 -0600 | [diff] [blame] | 826 | } |
| 827 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 828 | inline VkImageSubresourceLayers |
| 829 | Image::subresource(const VkImageSubresourceRange &range, uint32_t mip_level, |
| 830 | uint32_t array_layer, uint32_t array_size) { |
| 831 | return subresource(image_aspect(range.aspectMask), |
| 832 | range.baseMipLevel + mip_level, |
| 833 | range.baseArrayLayer + array_layer, array_size); |
Courtney Goeltzenleuchter | ba72451 | 2015-09-10 17:58:54 -0600 | [diff] [blame] | 834 | } |
| 835 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 836 | inline VkImageSubresourceRange |
| 837 | Image::subresource_range(VkImageAspectFlags aspect_mask, |
| 838 | uint32_t base_mip_level, uint32_t mip_levels, |
| 839 | uint32_t base_array_layer, uint32_t num_layers) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 840 | VkImageSubresourceRange range = {}; |
Courtney Goeltzenleuchter | ba72451 | 2015-09-10 17:58:54 -0600 | [diff] [blame] | 841 | range.aspectMask = aspect_mask; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 842 | range.baseMipLevel = base_mip_level; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 843 | range.levelCount = mip_levels; |
Courtney Goeltzenleuchter | 4a26189 | 2015-09-10 16:38:41 -0600 | [diff] [blame] | 844 | range.baseArrayLayer = base_array_layer; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 845 | range.layerCount = num_layers; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 846 | return range; |
| 847 | } |
| 848 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 849 | inline VkImageSubresourceRange |
| 850 | Image::subresource_range(const VkImageCreateInfo &info, |
| 851 | VkImageAspectFlags aspect_mask) { |
| 852 | return subresource_range(aspect_mask, 0, info.mipLevels, 0, |
| 853 | info.arrayLayers); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 854 | } |
| 855 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 856 | inline VkImageSubresourceRange |
| 857 | Image::subresource_range(const VkImageSubresource &subres) { |
| 858 | return subresource_range(subres.aspectMask, subres.mipLevel, 1, |
| 859 | subres.arrayLayer, 1); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 860 | } |
| 861 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 862 | inline VkExtent2D Image::extent(int32_t width, int32_t height) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 863 | VkExtent2D extent = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 864 | extent.width = width; |
| 865 | extent.height = height; |
| 866 | return extent; |
| 867 | } |
| 868 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 869 | inline VkExtent2D Image::extent(const VkExtent2D &extent, uint32_t mip_level) { |
| 870 | const int32_t width = |
| 871 | (extent.width >> mip_level) ? extent.width >> mip_level : 1; |
| 872 | const int32_t height = |
| 873 | (extent.height >> mip_level) ? extent.height >> mip_level : 1; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 874 | return Image::extent(width, height); |
| 875 | } |
| 876 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 877 | inline VkExtent2D Image::extent(const VkExtent3D &extent) { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 878 | return Image::extent(extent.width, extent.height); |
| 879 | } |
| 880 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 881 | inline VkExtent3D Image::extent(int32_t width, int32_t height, int32_t depth) { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 882 | VkExtent3D extent = {}; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 883 | extent.width = width; |
| 884 | extent.height = height; |
| 885 | extent.depth = depth; |
| 886 | return extent; |
| 887 | } |
| 888 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 889 | inline VkExtent3D Image::extent(const VkExtent3D &extent, uint32_t mip_level) { |
| 890 | const int32_t width = |
| 891 | (extent.width >> mip_level) ? extent.width >> mip_level : 1; |
| 892 | const int32_t height = |
| 893 | (extent.height >> mip_level) ? extent.height >> mip_level : 1; |
| 894 | const int32_t depth = |
| 895 | (extent.depth >> mip_level) ? extent.depth >> mip_level : 1; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 896 | return Image::extent(width, height, depth); |
| 897 | } |
| 898 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 899 | inline VkShaderModuleCreateInfo ShaderModule::create_info(size_t code_size, |
| 900 | const uint32_t *code, |
| 901 | VkFlags flags) { |
Courtney Goeltzenleuchter | ee4027d | 2015-06-28 13:01:17 -0600 | [diff] [blame] | 902 | VkShaderModuleCreateInfo info = {}; |
| 903 | info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; |
| 904 | info.codeSize = code_size; |
| 905 | info.pCode = code; |
| 906 | info.flags = flags; |
| 907 | return info; |
| 908 | } |
| 909 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 910 | inline VkWriteDescriptorSet |
| 911 | Device::write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 912 | uint32_t array_element, VkDescriptorType type, |
| 913 | uint32_t count, |
| 914 | const VkDescriptorImageInfo *image_info) { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 915 | VkWriteDescriptorSet write = {}; |
| 916 | write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 917 | write.dstSet = set.handle(); |
| 918 | write.dstBinding = binding; |
| 919 | write.dstArrayElement = array_element; |
Chia-I Wu | d50a7d7 | 2015-10-26 20:48:51 +0800 | [diff] [blame] | 920 | write.descriptorCount = count; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 921 | write.descriptorType = type; |
Courtney Goeltzenleuchter | 4cb6d92 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 922 | write.pImageInfo = image_info; |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 923 | return write; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 924 | } |
| 925 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 926 | inline VkWriteDescriptorSet |
| 927 | Device::write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 928 | uint32_t array_element, VkDescriptorType type, |
| 929 | uint32_t count, |
| 930 | const VkDescriptorBufferInfo *buffer_info) { |
Courtney Goeltzenleuchter | 4cb6d92 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 931 | VkWriteDescriptorSet write = {}; |
| 932 | write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 933 | write.dstSet = set.handle(); |
| 934 | write.dstBinding = binding; |
| 935 | write.dstArrayElement = array_element; |
Chia-I Wu | d50a7d7 | 2015-10-26 20:48:51 +0800 | [diff] [blame] | 936 | write.descriptorCount = count; |
Courtney Goeltzenleuchter | 4cb6d92 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 937 | write.descriptorType = type; |
| 938 | write.pBufferInfo = buffer_info; |
| 939 | return write; |
| 940 | } |
| 941 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 942 | inline VkWriteDescriptorSet |
| 943 | Device::write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 944 | uint32_t array_element, VkDescriptorType type, |
| 945 | uint32_t count, const VkBufferView *buffer_views) { |
Courtney Goeltzenleuchter | 4cb6d92 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 946 | VkWriteDescriptorSet write = {}; |
| 947 | write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 948 | write.dstSet = set.handle(); |
| 949 | write.dstBinding = binding; |
| 950 | write.dstArrayElement = array_element; |
Chia-I Wu | d50a7d7 | 2015-10-26 20:48:51 +0800 | [diff] [blame] | 951 | write.descriptorCount = count; |
Courtney Goeltzenleuchter | 4cb6d92 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 952 | write.descriptorType = type; |
| 953 | write.pTexelBufferView = buffer_views; |
| 954 | return write; |
| 955 | } |
| 956 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 957 | inline VkWriteDescriptorSet Device::write_descriptor_set( |
| 958 | const DescriptorSet &set, uint32_t binding, uint32_t array_element, |
| 959 | VkDescriptorType type, |
| 960 | const std::vector<VkDescriptorImageInfo> &image_info) { |
| 961 | return write_descriptor_set(set, binding, array_element, type, |
| 962 | image_info.size(), &image_info[0]); |
Courtney Goeltzenleuchter | 4cb6d92 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 963 | } |
| 964 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 965 | inline VkWriteDescriptorSet Device::write_descriptor_set( |
| 966 | const DescriptorSet &set, uint32_t binding, uint32_t array_element, |
| 967 | VkDescriptorType type, |
| 968 | const std::vector<VkDescriptorBufferInfo> &buffer_info) { |
| 969 | return write_descriptor_set(set, binding, array_element, type, |
| 970 | buffer_info.size(), &buffer_info[0]); |
Courtney Goeltzenleuchter | 4cb6d92 | 2015-10-23 13:38:14 -0600 | [diff] [blame] | 971 | } |
| 972 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 973 | inline VkWriteDescriptorSet |
| 974 | Device::write_descriptor_set(const DescriptorSet &set, uint32_t binding, |
| 975 | uint32_t array_element, VkDescriptorType type, |
| 976 | const std::vector<VkBufferView> &buffer_views) { |
| 977 | return write_descriptor_set(set, binding, array_element, type, |
| 978 | buffer_views.size(), &buffer_views[0]); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 979 | } |
| 980 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 981 | inline VkCopyDescriptorSet |
| 982 | Device::copy_descriptor_set(const DescriptorSet &src_set, uint32_t src_binding, |
| 983 | uint32_t src_array_element, |
| 984 | const DescriptorSet &dst_set, uint32_t dst_binding, |
| 985 | uint32_t dst_array_element, uint32_t count) { |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 986 | VkCopyDescriptorSet copy = {}; |
| 987 | copy.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET; |
Chia-I Wu | afdfd7f | 2015-07-03 11:49:42 +0800 | [diff] [blame] | 988 | copy.srcSet = src_set.handle(); |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 989 | copy.srcBinding = src_binding; |
| 990 | copy.srcArrayElement = src_array_element; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 991 | copy.dstSet = dst_set.handle(); |
| 992 | copy.dstBinding = dst_binding; |
| 993 | copy.dstArrayElement = dst_array_element; |
Chia-I Wu | d50a7d7 | 2015-10-26 20:48:51 +0800 | [diff] [blame] | 994 | copy.descriptorCount = count; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 995 | |
Chia-I Wu | 9d00ed7 | 2015-05-25 16:27:55 +0800 | [diff] [blame] | 996 | return copy; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 997 | } |
| 998 | |
Karl Schultz | 6addd81 | 2016-02-02 17:17:23 -0700 | [diff] [blame] | 999 | inline VkCommandBufferAllocateInfo |
| 1000 | CommandBuffer::create_info(VkCommandPool const &pool) { |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1001 | VkCommandBufferAllocateInfo info = {}; |
Chia-I Wu | 00ce540 | 2015-11-10 16:21:09 +0800 | [diff] [blame] | 1002 | info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; |
Chia-I Wu | 3432a0c | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 1003 | info.commandPool = pool; |
Jon Ashburn | f19916e | 2016-01-11 13:12:43 -0700 | [diff] [blame] | 1004 | info.commandBufferCount = 1; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1005 | return info; |
| 1006 | } |
| 1007 | |
| 1008 | }; // namespace vk_testing |
| 1009 | |
| 1010 | #endif // VKTESTBINDING_H |