mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-22 08:35:37 +01:00
externals: add adrenotools for bcenabler
This commit is contained in:
parent
7cdeaa90af
commit
f7a3f1ddf4
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -49,3 +49,6 @@
|
|||||||
[submodule "cpp-jwt"]
|
[submodule "cpp-jwt"]
|
||||||
path = externals/cpp-jwt
|
path = externals/cpp-jwt
|
||||||
url = https://github.com/arun11299/cpp-jwt.git
|
url = https://github.com/arun11299/cpp-jwt.git
|
||||||
|
[submodule "externals/libadrenotools"]
|
||||||
|
path = externals/libadrenotools
|
||||||
|
url = https://github.com/bylaws/libadrenotools
|
||||||
|
4
externals/CMakeLists.txt
vendored
4
externals/CMakeLists.txt
vendored
@ -147,3 +147,7 @@ endif()
|
|||||||
|
|
||||||
add_library(stb stb/stb_dxt.cpp)
|
add_library(stb stb/stb_dxt.cpp)
|
||||||
target_include_directories(stb PUBLIC ./stb)
|
target_include_directories(stb PUBLIC ./stb)
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
add_subdirectory(libadrenotools)
|
||||||
|
endif()
|
||||||
|
1
externals/libadrenotools
vendored
Submodule
1
externals/libadrenotools
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit a6c0947df6b152b350342f5191b3082768e15e38
|
@ -345,3 +345,7 @@ endif()
|
|||||||
if (YUZU_ENABLE_LTO)
|
if (YUZU_ENABLE_LTO)
|
||||||
set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
set_property(TARGET video_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
target_link_libraries(video_core PRIVATE adrenotools)
|
||||||
|
endif()
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
#include "video_core/vulkan_common/vulkan_device.h"
|
#include "video_core/vulkan_common/vulkan_device.h"
|
||||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
#include <adrenotools/bcenabler.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
using namespace Common::Literals;
|
using namespace Common::Literals;
|
||||||
namespace {
|
namespace {
|
||||||
@ -356,6 +360,32 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
|||||||
CollectPhysicalMemoryInfo();
|
CollectPhysicalMemoryInfo();
|
||||||
CollectToolingInfo();
|
CollectToolingInfo();
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
if (is_adreno) {
|
||||||
|
LOG_WARNING(Render_Vulkan, "Adreno drivers have broken VK_EXT_extended_dynamic_state");
|
||||||
|
extensions.extended_dynamic_state = false;
|
||||||
|
loaded_extensions.erase(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
|
||||||
|
|
||||||
|
// Patch the driver to enable BCn textures.
|
||||||
|
const auto major = (properties.properties.driverVersion >> 24) << 2;
|
||||||
|
const auto minor = (properties.properties.driverVersion >> 12) & 0xFFFU;
|
||||||
|
const auto vendor = properties.properties.vendorID;
|
||||||
|
const auto patch_status = adrenotools_get_bcn_type(major, minor, vendor);
|
||||||
|
|
||||||
|
if (patch_status == ADRENOTOOLS_BCN_PATCH) {
|
||||||
|
LOG_INFO(Render_Vulkan, "Patching Adreno driver to support BCn texture formats");
|
||||||
|
if (!adrenotools_patch_bcn(
|
||||||
|
reinterpret_cast<void*>(dld.vkGetPhysicalDeviceFormatProperties))) {
|
||||||
|
LOG_ERROR(Render_Vulkan, "Patch failed! Driver code may now crash");
|
||||||
|
}
|
||||||
|
} else if (patch_status == ADRENOTOOLS_BCN_BLOB) {
|
||||||
|
LOG_INFO(Render_Vulkan, "Adreno driver supports BCn textures without patches");
|
||||||
|
} else {
|
||||||
|
LOG_WARNING(Render_Vulkan, "Adreno driver can't be patched to enable BCn textures");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // ANDROID
|
||||||
|
|
||||||
if (is_nvidia) {
|
if (is_nvidia) {
|
||||||
const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff;
|
const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff;
|
||||||
const auto arch = GetNvidiaArchitecture(physical, supported_extensions);
|
const auto arch = GetNvidiaArchitecture(physical, supported_extensions);
|
||||||
|
Loading…
Reference in New Issue
Block a user