Add adrenotools direct mapping support

This commit is contained in:
Billy Laws
2022-12-11 14:33:08 +00:00
parent 8846a85d3a
commit 3ecaedd71e
6 changed files with 110 additions and 14 deletions

View File

@ -204,6 +204,12 @@ namespace skyline::gpu {
bcnSupport[4] = isFormatSupported(vk::Format::eBc5UnormBlock) && isFormatSupported(vk::Format::eBc5SnormBlock);
bcnSupport[5] = isFormatSupported(vk::Format::eBc6HSfloatBlock) && isFormatSupported(vk::Format::eBc6HUfloatBlock);
bcnSupport[6] = isFormatSupported(vk::Format::eBc7UnormBlock) && isFormatSupported(vk::Format::eBc7SrgbBlock);
auto memoryProps{physicalDevice.getMemoryProperties2()};
constexpr auto ReqMemFlags{vk::MemoryPropertyFlagBits::eDeviceLocal | vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent | vk::MemoryPropertyFlagBits::eHostCached};
for (u32 i{}; i < memoryProps.memoryProperties.memoryTypeCount; i++)
if ((memoryProps.memoryProperties.memoryTypes[i].propertyFlags & ReqMemFlags) == ReqMemFlags)
hostVisibleCoherentCachedMemoryType = i;
}
std::string TraitManager::Summary() {
@ -269,7 +275,7 @@ namespace skyline::gpu {
);
}
void TraitManager::ApplyDriverPatches(const vk::raii::Context &context) {
void TraitManager::ApplyDriverPatches(const vk::raii::Context &context, adrenotools_gpu_mapping *mapping) {
// Create an instance without validation layers in order to get pointers to the functions we need to patch from the driver
vk::ApplicationInfo applicationInfo{
.apiVersion = VK_API_VERSION_1_0,
@ -294,5 +300,10 @@ namespace skyline::gpu {
Logger::Info("BCeNabler skipped, blob BCN support is present");
bcnSupport.set();
}
if (adrenotools_validate_gpu_mapping(mapping)) {
Logger::Info("Applied GPU memory import patch");
supportsAdrenoDirectMemoryImport = true;
}
}
}