diff options
| author | 2020-03-27 02:53:52 -0300 | |
|---|---|---|
| committer | 2020-03-27 03:21:04 -0300 | |
| commit | 60f351084a060c40c4c1c0e6956ca1e4b284598e (patch) | |
| tree | 42f8c92bd60223377657d779e611c9afadd26051 /src/video_core/renderer_vulkan | |
| parent | renderer_vulkan/wrapper: Add dispatch table and loaders (diff) | |
| download | yuzu-60f351084a060c40c4c1c0e6956ca1e4b284598e.tar.gz yuzu-60f351084a060c40c4c1c0e6956ca1e4b284598e.tar.xz yuzu-60f351084a060c40c4c1c0e6956ca1e4b284598e.zip | |
renderer_vulkan/wrapper: Add destroy and free overload set
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/wrapper.cpp | 105 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/wrapper.h | 28 |
2 files changed, 133 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/wrapper.cpp b/src/video_core/renderer_vulkan/wrapper.cpp index 6d7e141e1..c412b7f20 100644 --- a/src/video_core/renderer_vulkan/wrapper.cpp +++ b/src/video_core/renderer_vulkan/wrapper.cpp | |||
| @@ -234,4 +234,109 @@ const char* ToString(VkResult result) noexcept { | |||
| 234 | return "Unknown"; | 234 | return "Unknown"; |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | void Destroy(VkInstance instance, const InstanceDispatch& dld) noexcept { | ||
| 238 | dld.vkDestroyInstance(instance, nullptr); | ||
| 239 | } | ||
| 240 | |||
| 241 | void Destroy(VkDevice device, const InstanceDispatch& dld) noexcept { | ||
| 242 | dld.vkDestroyDevice(device, nullptr); | ||
| 243 | } | ||
| 244 | |||
| 245 | void Destroy(VkDevice device, VkBuffer handle, const DeviceDispatch& dld) noexcept { | ||
| 246 | dld.vkDestroyBuffer(device, handle, nullptr); | ||
| 247 | } | ||
| 248 | |||
| 249 | void Destroy(VkDevice device, VkBufferView handle, const DeviceDispatch& dld) noexcept { | ||
| 250 | dld.vkDestroyBufferView(device, handle, nullptr); | ||
| 251 | } | ||
| 252 | |||
| 253 | void Destroy(VkDevice device, VkCommandPool handle, const DeviceDispatch& dld) noexcept { | ||
| 254 | dld.vkDestroyCommandPool(device, handle, nullptr); | ||
| 255 | } | ||
| 256 | |||
| 257 | void Destroy(VkDevice device, VkDescriptorPool handle, const DeviceDispatch& dld) noexcept { | ||
| 258 | dld.vkDestroyDescriptorPool(device, handle, nullptr); | ||
| 259 | } | ||
| 260 | |||
| 261 | void Destroy(VkDevice device, VkDescriptorSetLayout handle, const DeviceDispatch& dld) noexcept { | ||
| 262 | dld.vkDestroyDescriptorSetLayout(device, handle, nullptr); | ||
| 263 | } | ||
| 264 | |||
| 265 | void Destroy(VkDevice device, VkDescriptorUpdateTemplateKHR handle, | ||
| 266 | const DeviceDispatch& dld) noexcept { | ||
| 267 | dld.vkDestroyDescriptorUpdateTemplateKHR(device, handle, nullptr); | ||
| 268 | } | ||
| 269 | |||
| 270 | void Destroy(VkDevice device, VkDeviceMemory handle, const DeviceDispatch& dld) noexcept { | ||
| 271 | dld.vkFreeMemory(device, handle, nullptr); | ||
| 272 | } | ||
| 273 | |||
| 274 | void Destroy(VkDevice device, VkFence handle, const DeviceDispatch& dld) noexcept { | ||
| 275 | dld.vkDestroyFence(device, handle, nullptr); | ||
| 276 | } | ||
| 277 | |||
| 278 | void Destroy(VkDevice device, VkFramebuffer handle, const DeviceDispatch& dld) noexcept { | ||
| 279 | dld.vkDestroyFramebuffer(device, handle, nullptr); | ||
| 280 | } | ||
| 281 | |||
| 282 | void Destroy(VkDevice device, VkImage handle, const DeviceDispatch& dld) noexcept { | ||
| 283 | dld.vkDestroyImage(device, handle, nullptr); | ||
| 284 | } | ||
| 285 | |||
| 286 | void Destroy(VkDevice device, VkImageView handle, const DeviceDispatch& dld) noexcept { | ||
| 287 | dld.vkDestroyImageView(device, handle, nullptr); | ||
| 288 | } | ||
| 289 | |||
| 290 | void Destroy(VkDevice device, VkPipeline handle, const DeviceDispatch& dld) noexcept { | ||
| 291 | dld.vkDestroyPipeline(device, handle, nullptr); | ||
| 292 | } | ||
| 293 | |||
| 294 | void Destroy(VkDevice device, VkPipelineLayout handle, const DeviceDispatch& dld) noexcept { | ||
| 295 | dld.vkDestroyPipelineLayout(device, handle, nullptr); | ||
| 296 | } | ||
| 297 | |||
| 298 | void Destroy(VkDevice device, VkQueryPool handle, const DeviceDispatch& dld) noexcept { | ||
| 299 | dld.vkDestroyQueryPool(device, handle, nullptr); | ||
| 300 | } | ||
| 301 | |||
| 302 | void Destroy(VkDevice device, VkRenderPass handle, const DeviceDispatch& dld) noexcept { | ||
| 303 | dld.vkDestroyRenderPass(device, handle, nullptr); | ||
| 304 | } | ||
| 305 | |||
| 306 | void Destroy(VkDevice device, VkSampler handle, const DeviceDispatch& dld) noexcept { | ||
| 307 | dld.vkDestroySampler(device, handle, nullptr); | ||
| 308 | } | ||
| 309 | |||
| 310 | void Destroy(VkDevice device, VkSwapchainKHR handle, const DeviceDispatch& dld) noexcept { | ||
| 311 | dld.vkDestroySwapchainKHR(device, handle, nullptr); | ||
| 312 | } | ||
| 313 | |||
| 314 | void Destroy(VkDevice device, VkSemaphore handle, const DeviceDispatch& dld) noexcept { | ||
| 315 | dld.vkDestroySemaphore(device, handle, nullptr); | ||
| 316 | } | ||
| 317 | |||
| 318 | void Destroy(VkDevice device, VkShaderModule handle, const DeviceDispatch& dld) noexcept { | ||
| 319 | dld.vkDestroyShaderModule(device, handle, nullptr); | ||
| 320 | } | ||
| 321 | |||
| 322 | void Destroy(VkInstance instance, VkDebugUtilsMessengerEXT handle, | ||
| 323 | const InstanceDispatch& dld) noexcept { | ||
| 324 | dld.vkDestroyDebugUtilsMessengerEXT(instance, handle, nullptr); | ||
| 325 | } | ||
| 326 | |||
| 327 | void Destroy(VkInstance instance, VkSurfaceKHR handle, const InstanceDispatch& dld) noexcept { | ||
| 328 | dld.vkDestroySurfaceKHR(instance, handle, nullptr); | ||
| 329 | } | ||
| 330 | |||
| 331 | VkResult Free(VkDevice device, VkDescriptorPool handle, Span<VkDescriptorSet> sets, | ||
| 332 | const DeviceDispatch& dld) noexcept { | ||
| 333 | return dld.vkFreeDescriptorSets(device, handle, sets.size(), sets.data()); | ||
| 334 | } | ||
| 335 | |||
| 336 | VkResult Free(VkDevice device, VkCommandPool handle, Span<VkCommandBuffer> buffers, | ||
| 337 | const DeviceDispatch& dld) noexcept { | ||
| 338 | dld.vkFreeCommandBuffers(device, handle, buffers.size(), buffers.data()); | ||
| 339 | return VK_SUCCESS; | ||
| 340 | } | ||
| 341 | |||
| 237 | } // namespace Vulkan::vk | 342 | } // namespace Vulkan::vk |
diff --git a/src/video_core/renderer_vulkan/wrapper.h b/src/video_core/renderer_vulkan/wrapper.h index f5f868233..e5d9b34f2 100644 --- a/src/video_core/renderer_vulkan/wrapper.h +++ b/src/video_core/renderer_vulkan/wrapper.h | |||
| @@ -250,4 +250,32 @@ bool Load(InstanceDispatch&) noexcept; | |||
| 250 | /// @return True on success, false on error. | 250 | /// @return True on success, false on error. |
| 251 | bool Load(VkInstance, InstanceDispatch&) noexcept; | 251 | bool Load(VkInstance, InstanceDispatch&) noexcept; |
| 252 | 252 | ||
| 253 | void Destroy(VkInstance, const InstanceDispatch&) noexcept; | ||
| 254 | void Destroy(VkDevice, const InstanceDispatch&) noexcept; | ||
| 255 | |||
| 256 | void Destroy(VkDevice, VkBuffer, const DeviceDispatch&) noexcept; | ||
| 257 | void Destroy(VkDevice, VkBufferView, const DeviceDispatch&) noexcept; | ||
| 258 | void Destroy(VkDevice, VkCommandPool, const DeviceDispatch&) noexcept; | ||
| 259 | void Destroy(VkDevice, VkDescriptorPool, const DeviceDispatch&) noexcept; | ||
| 260 | void Destroy(VkDevice, VkDescriptorSetLayout, const DeviceDispatch&) noexcept; | ||
| 261 | void Destroy(VkDevice, VkDescriptorUpdateTemplateKHR, const DeviceDispatch&) noexcept; | ||
| 262 | void Destroy(VkDevice, VkDeviceMemory, const DeviceDispatch&) noexcept; | ||
| 263 | void Destroy(VkDevice, VkFence, const DeviceDispatch&) noexcept; | ||
| 264 | void Destroy(VkDevice, VkFramebuffer, const DeviceDispatch&) noexcept; | ||
| 265 | void Destroy(VkDevice, VkImage, const DeviceDispatch&) noexcept; | ||
| 266 | void Destroy(VkDevice, VkImageView, const DeviceDispatch&) noexcept; | ||
| 267 | void Destroy(VkDevice, VkPipeline, const DeviceDispatch&) noexcept; | ||
| 268 | void Destroy(VkDevice, VkPipelineLayout, const DeviceDispatch&) noexcept; | ||
| 269 | void Destroy(VkDevice, VkQueryPool, const DeviceDispatch&) noexcept; | ||
| 270 | void Destroy(VkDevice, VkRenderPass, const DeviceDispatch&) noexcept; | ||
| 271 | void Destroy(VkDevice, VkSampler, const DeviceDispatch&) noexcept; | ||
| 272 | void Destroy(VkDevice, VkSwapchainKHR, const DeviceDispatch&) noexcept; | ||
| 273 | void Destroy(VkDevice, VkSemaphore, const DeviceDispatch&) noexcept; | ||
| 274 | void Destroy(VkDevice, VkShaderModule, const DeviceDispatch&) noexcept; | ||
| 275 | void Destroy(VkInstance, VkDebugUtilsMessengerEXT, const InstanceDispatch&) noexcept; | ||
| 276 | void Destroy(VkInstance, VkSurfaceKHR, const InstanceDispatch&) noexcept; | ||
| 277 | |||
| 278 | VkResult Free(VkDevice, VkDescriptorPool, Span<VkDescriptorSet>, const DeviceDispatch&) noexcept; | ||
| 279 | VkResult Free(VkDevice, VkCommandPool, Span<VkCommandBuffer>, const DeviceDispatch&) noexcept; | ||
| 280 | |||
| 253 | } // namespace Vulkan::vk | 281 | } // namespace Vulkan::vk |