diff options
| -rw-r--r-- | .gitmodules | 3 | ||||
| -rw-r--r-- | externals/CMakeLists.txt | 4 | ||||
| m--------- | externals/libadrenotools | 0 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 30 |
5 files changed, 41 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index 75c7b5fe0..ad7a9b970 100644 --- a/.gitmodules +++ b/.gitmodules | |||
| @@ -49,3 +49,6 @@ | |||
| 49 | [submodule "cpp-jwt"] | 49 | [submodule "cpp-jwt"] |
| 50 | path = externals/cpp-jwt | 50 | path = externals/cpp-jwt |
| 51 | url = https://github.com/arun11299/cpp-jwt.git | 51 | url = https://github.com/arun11299/cpp-jwt.git |
| 52 | [submodule "externals/libadrenotools"] | ||
| 53 | path = externals/libadrenotools | ||
| 54 | url = https://github.com/bylaws/libadrenotools | ||
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index d78d10147..2bd7b457a 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -147,3 +147,7 @@ endif() | |||
| 147 | 147 | ||
| 148 | add_library(stb stb/stb_dxt.cpp) | 148 | add_library(stb stb/stb_dxt.cpp) |
| 149 | target_include_directories(stb PUBLIC ./stb) | 149 | target_include_directories(stb PUBLIC ./stb) |
| 150 | |||
| 151 | if (ANDROID) | ||
| 152 | add_subdirectory(libadrenotools) | ||
| 153 | endif() | ||
diff --git a/externals/libadrenotools b/externals/libadrenotools new file mode 160000 | |||
| Subproject a6c0947df6b152b350342f5191b3082768e15e3 | |||
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 027259f57..05aa5cfe2 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -345,3 +345,7 @@ endif() | |||
| 345 | if (YUZU_ENABLE_LTO) | 345 | if (YUZU_ENABLE_LTO) |
| 346 | set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) | 346 | set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) |
| 347 | endif() | 347 | endif() |
| 348 | |||
| 349 | if (ANDROID) | ||
| 350 | target_link_libraries(video_core PRIVATE adrenotools) | ||
| 351 | endif() | ||
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 9ab8e46a1..8847c6aa3 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -18,6 +18,10 @@ | |||
| 18 | #include "video_core/vulkan_common/vulkan_device.h" | 18 | #include "video_core/vulkan_common/vulkan_device.h" |
| 19 | #include "video_core/vulkan_common/vulkan_wrapper.h" | 19 | #include "video_core/vulkan_common/vulkan_wrapper.h" |
| 20 | 20 | ||
| 21 | #ifdef ANDROID | ||
| 22 | #include <adrenotools/bcenabler.h> | ||
| 23 | #endif | ||
| 24 | |||
| 21 | namespace Vulkan { | 25 | namespace Vulkan { |
| 22 | using namespace Common::Literals; | 26 | using namespace Common::Literals; |
| 23 | namespace { | 27 | namespace { |
| @@ -356,6 +360,32 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 356 | CollectPhysicalMemoryInfo(); | 360 | CollectPhysicalMemoryInfo(); |
| 357 | CollectToolingInfo(); | 361 | CollectToolingInfo(); |
| 358 | 362 | ||
| 363 | #ifdef ANDROID | ||
| 364 | if (is_adreno) { | ||
| 365 | LOG_WARNING(Render_Vulkan, "Adreno drivers have broken VK_EXT_extended_dynamic_state"); | ||
| 366 | extensions.extended_dynamic_state = false; | ||
| 367 | loaded_extensions.erase(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME); | ||
| 368 | |||
| 369 | // Patch the driver to enable BCn textures. | ||
| 370 | const auto major = (properties.properties.driverVersion >> 24) << 2; | ||
| 371 | const auto minor = (properties.properties.driverVersion >> 12) & 0xFFFU; | ||
| 372 | const auto vendor = properties.properties.vendorID; | ||
| 373 | const auto patch_status = adrenotools_get_bcn_type(major, minor, vendor); | ||
| 374 | |||
| 375 | if (patch_status == ADRENOTOOLS_BCN_PATCH) { | ||
| 376 | LOG_INFO(Render_Vulkan, "Patching Adreno driver to support BCn texture formats"); | ||
| 377 | if (!adrenotools_patch_bcn( | ||
| 378 | reinterpret_cast<void*>(dld.vkGetPhysicalDeviceFormatProperties))) { | ||
| 379 | LOG_ERROR(Render_Vulkan, "Patch failed! Driver code may now crash"); | ||
| 380 | } | ||
| 381 | } else if (patch_status == ADRENOTOOLS_BCN_BLOB) { | ||
| 382 | LOG_INFO(Render_Vulkan, "Adreno driver supports BCn textures without patches"); | ||
| 383 | } else { | ||
| 384 | LOG_WARNING(Render_Vulkan, "Adreno driver can't be patched to enable BCn textures"); | ||
| 385 | } | ||
| 386 | } | ||
| 387 | #endif // ANDROID | ||
| 388 | |||
| 359 | if (is_nvidia) { | 389 | if (is_nvidia) { |
| 360 | const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff; | 390 | const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff; |
| 361 | const auto arch = GetNvidiaArchitecture(physical, supported_extensions); | 391 | const auto arch = GetNvidiaArchitecture(physical, supported_extensions); |