summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Liam2023-01-01 18:34:38 -0500
committerGravatar bunnei2023-06-03 00:05:28 -0700
commitf7a3f1ddf49a2471fd92ee92faea61880285b2d5 (patch)
treee32ec870444e890b124a819b834a705620e123c1 /src
parentdevice_memory: Use smaller virtual reservation size for compatibility with 39... (diff)
downloadyuzu-f7a3f1ddf49a2471fd92ee92faea61880285b2d5.tar.gz
yuzu-f7a3f1ddf49a2471fd92ee92faea61880285b2d5.tar.xz
yuzu-f7a3f1ddf49a2471fd92ee92faea61880285b2d5.zip
externals: add adrenotools for bcenabler
Diffstat (limited to 'src')
-rw-r--r--src/video_core/CMakeLists.txt4
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp30
2 files changed, 34 insertions, 0 deletions
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()
345if (YUZU_ENABLE_LTO) 345if (YUZU_ENABLE_LTO)
346 set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) 346 set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
347endif() 347endif()
348
349if (ANDROID)
350 target_link_libraries(video_core PRIVATE adrenotools)
351endif()
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
21namespace Vulkan { 25namespace Vulkan {
22using namespace Common::Literals; 26using namespace Common::Literals;
23namespace { 27namespace {
@@ -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);