diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-01-17 00:42:02 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-02-13 06:16:21 +0100 |
commit | a39d9c5194a5fa230ee987ebfc73476f2011d6fa (patch) | |
tree | aeef5e8bcf2d0577ed84d8d591fbeac40267a962 /src/video_core/vulkan_common/vulkan_memory_allocator.h | |
parent | vulkan_common: Make interop extensions mandatory (diff) | |
download | yuzu-a39d9c5194a5fa230ee987ebfc73476f2011d6fa.tar yuzu-a39d9c5194a5fa230ee987ebfc73476f2011d6fa.tar.gz yuzu-a39d9c5194a5fa230ee987ebfc73476f2011d6fa.tar.bz2 yuzu-a39d9c5194a5fa230ee987ebfc73476f2011d6fa.tar.lz yuzu-a39d9c5194a5fa230ee987ebfc73476f2011d6fa.tar.xz yuzu-a39d9c5194a5fa230ee987ebfc73476f2011d6fa.tar.zst yuzu-a39d9c5194a5fa230ee987ebfc73476f2011d6fa.zip |
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_memory_allocator.h')
-rw-r--r-- | src/video_core/vulkan_common/vulkan_memory_allocator.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.h b/src/video_core/vulkan_common/vulkan_memory_allocator.h index 9e6cfabf9..86393310a 100644 --- a/src/video_core/vulkan_common/vulkan_memory_allocator.h +++ b/src/video_core/vulkan_common/vulkan_memory_allocator.h @@ -43,6 +43,9 @@ public: /// It will map the backing allocation if it hasn't been mapped before. std::span<u8> Map(); + /// Returns an non-owning OpenGL handle, creating one if it doesn't exist. + u32 ExportOpenGLHandle() const; + /// Returns the Vulkan memory handler. VkDeviceMemory Memory() const { return memory; @@ -67,7 +70,15 @@ private: /// Allocates and releases memory allocations on demand. class MemoryAllocator { public: - explicit MemoryAllocator(const Device& device_); + /** + * Construct memory allocator + * + * @param device_ Device to allocate from + * @param export_allocations_ True when allocations have to be exported + * + * @throw vk::Exception on failure + */ + explicit MemoryAllocator(const Device& device_, bool export_allocations_ = false); ~MemoryAllocator(); MemoryAllocator& operator=(const MemoryAllocator&) = delete; @@ -106,8 +117,9 @@ private: /// Returns index to the fastest memory type compatible with the passed requirements. std::optional<u32> FindType(VkMemoryPropertyFlags flags, u32 type_mask) const; - const Device& device; ///< Device handle. - const VkPhysicalDeviceMemoryProperties properties; ///< Physical device properties. + const Device& device; ///< Device handle. + const VkPhysicalDeviceMemoryProperties properties; ///< Physical device properties. + const bool export_allocations; ///< True when memory allocations have to be exported. std::vector<std::unique_ptr<MemoryAllocation>> allocations; ///< Current allocations. }; |