renderer_vulkan: Import host memory for screenshots (#7132)

This commit is contained in:
Wunk
2023-11-12 13:02:55 -08:00
committed by GitHub
parent 23ca10472a
commit 831c9c4a38
10 changed files with 254 additions and 21 deletions

View File

@ -7,6 +7,7 @@
#include "common/alignment.h"
#include "common/assert.h"
#include "video_core/renderer_vulkan/vk_instance.h"
#include "video_core/renderer_vulkan/vk_memory_util.h"
#include "video_core/renderer_vulkan/vk_scheduler.h"
#include "video_core/renderer_vulkan/vk_stream_buffer.h"
@ -43,19 +44,6 @@ vk::MemoryPropertyFlags MakePropertyFlags(BufferType type) {
}
}
/// Find a memory type with the passed requirements
std::optional<u32> FindMemoryType(
const vk::PhysicalDeviceMemoryProperties& properties, vk::MemoryPropertyFlags wanted,
vk::MemoryPropertyFlags excluded = vk::MemoryPropertyFlagBits::eProtected) {
for (u32 i = 0; i < properties.memoryTypeCount; ++i) {
const auto flags = properties.memoryTypes[i].propertyFlags;
if (((flags & wanted) == wanted) && (!(flags & excluded))) {
return i;
}
}
return std::nullopt;
}
/// Get the preferred host visible memory type.
u32 GetMemoryType(const vk::PhysicalDeviceMemoryProperties& properties, BufferType type) {
vk::MemoryPropertyFlags flags = MakePropertyFlags(type);