diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_memory_allocator.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_memory_allocator.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp index aa173d19e..300a61205 100644 --- a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp +++ b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp | |||
| @@ -228,7 +228,9 @@ void MemoryCommit::Release() { | |||
| 228 | 228 | ||
| 229 | MemoryAllocator::MemoryAllocator(const Device& device_, bool export_allocations_) | 229 | MemoryAllocator::MemoryAllocator(const Device& device_, bool export_allocations_) |
| 230 | : device{device_}, properties{device_.GetPhysical().GetMemoryProperties()}, | 230 | : device{device_}, properties{device_.GetPhysical().GetMemoryProperties()}, |
| 231 | export_allocations{export_allocations_} {} | 231 | export_allocations{export_allocations_}, |
| 232 | buffer_image_granularity{ | ||
| 233 | device_.GetPhysical().GetProperties().limits.bufferImageGranularity} {} | ||
| 232 | 234 | ||
| 233 | MemoryAllocator::~MemoryAllocator() = default; | 235 | MemoryAllocator::~MemoryAllocator() = default; |
| 234 | 236 | ||
| @@ -258,7 +260,9 @@ MemoryCommit MemoryAllocator::Commit(const vk::Buffer& buffer, MemoryUsage usage | |||
| 258 | } | 260 | } |
| 259 | 261 | ||
| 260 | MemoryCommit MemoryAllocator::Commit(const vk::Image& image, MemoryUsage usage) { | 262 | MemoryCommit MemoryAllocator::Commit(const vk::Image& image, MemoryUsage usage) { |
| 261 | auto commit = Commit(device.GetLogical().GetImageMemoryRequirements(*image), usage); | 263 | VkMemoryRequirements requirements = device.GetLogical().GetImageMemoryRequirements(*image); |
| 264 | requirements.size = Common::AlignUp(requirements.size, buffer_image_granularity); | ||
| 265 | auto commit = Commit(requirements, usage); | ||
| 262 | image.BindMemory(commit.Memory(), commit.Offset()); | 266 | image.BindMemory(commit.Memory(), commit.Offset()); |
| 263 | return commit; | 267 | return commit; |
| 264 | } | 268 | } |
diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.h b/src/video_core/vulkan_common/vulkan_memory_allocator.h index b61e931e0..86e8ed119 100644 --- a/src/video_core/vulkan_common/vulkan_memory_allocator.h +++ b/src/video_core/vulkan_common/vulkan_memory_allocator.h | |||
| @@ -123,6 +123,8 @@ private: | |||
| 123 | const VkPhysicalDeviceMemoryProperties properties; ///< Physical device properties. | 123 | const VkPhysicalDeviceMemoryProperties properties; ///< Physical device properties. |
| 124 | const bool export_allocations; ///< True when memory allocations have to be exported. | 124 | const bool export_allocations; ///< True when memory allocations have to be exported. |
| 125 | std::vector<std::unique_ptr<MemoryAllocation>> allocations; ///< Current allocations. | 125 | std::vector<std::unique_ptr<MemoryAllocation>> allocations; ///< Current allocations. |
| 126 | VkDeviceSize buffer_image_granularity; // The granularity for adjacent offsets between buffers | ||
| 127 | // and optimal images | ||
| 126 | }; | 128 | }; |
| 127 | 129 | ||
| 128 | /// Returns true when a memory usage is guaranteed to be host visible. | 130 | /// Returns true when a memory usage is guaranteed to be host visible. |