From 90b676d3681286b9e92db6214e65053e4f4dbbcf Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 17 Feb 2023 16:49:02 +0100 Subject: [PATCH] Android: Fix armeabi-v7a build This very much isn't a build configuration that we're going to ship, but I want to be able to tell people that they can build it on their own if they really want to see how terribly it performs :) Just like before, you'll need to edit two lines in app/build.gradle to define ENABLE_GENERIC=ON and actually enable armeabi-v7a if you want an armeabi-v7a build. This commit just fixes some compilations errors that crop up if you do so. --- CMakeLists.txt | 13 ++++++++----- Source/Core/Common/Hash.cpp | 6 +++--- Source/Core/VideoBackends/Vulkan/VKTexture.cpp | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cc8594f1a..2530c1a0ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -502,12 +502,15 @@ if(ENABLE_HEADLESS) set(USE_DISCORD_PRESENCE 0) endif() -# Set file offset size to 64 bits. +# Set file offset size to 64 bits. On modern Unixes, this is typically already the case. Exceptions: # -# On modern Unixes, this is typically already the case. The lone exception is -# glibc, which may default to 32 bits. glibc allows this to be configured -# by setting _FILE_OFFSET_BITS. -if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") +# glibc may default to 32 bits. This can be configured by setting _FILE_OFFSET_BITS=64. +# +# bionic (Android) defaults to 32 bits for 32-bit ABIs. Here too we can use _FILE_OFFSET_BITS=64, +# but only on API 25 and up. Since we're currently supporting older API levels and 32-bit Android +# isn't a build configuration we officially support, let's leave this as it is for now. +# More details: https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md +if(NOT ANDROID AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows") add_definitions(-D_FILE_OFFSET_BITS=64) add_definitions(-D_LARGEFILE_SOURCE) endif() diff --git a/Source/Core/Common/Hash.cpp b/Source/Core/Common/Hash.cpp index e6b421e96f..51182a0463 100644 --- a/Source/Core/Common/Hash.cpp +++ b/Source/Core/Common/Hash.cpp @@ -216,15 +216,15 @@ static u32 fmix32(u32 h) static void bmix32(u32& h1, u32& h2, u32& k1, u32& k2, u32& c1, u32& c2) { k1 *= c1; - k1 = Common::RotateLeft(k1, 11); + k1 = std::rotl(k1, 11); k1 *= c2; h1 ^= k1; h1 += h2; - h2 = Common::RotateLeft(h2, 17); + h2 = std::rotl(h2, 17); k2 *= c2; - k2 = Common::RotateLeft(k2, 11); + k2 = std::rotl(k2, 11); k2 *= c1; h2 ^= k2; h2 += h1; diff --git a/Source/Core/VideoBackends/Vulkan/VKTexture.cpp b/Source/Core/VideoBackends/Vulkan/VKTexture.cpp index b1c3c122a8..14b33d2376 100644 --- a/Source/Core/VideoBackends/Vulkan/VKTexture.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKTexture.cpp @@ -780,7 +780,7 @@ std::pair VKStagingTexture::CreateLinearImage(StagingTex if (res != VK_SUCCESS) { LOG_VULKAN_ERROR(res, "Linear images are not supported for the staging texture: "); - return std::make_pair(VK_NULL_HANDLE, VK_NULL_HANDLE); + return std::make_pair(VK_NULL_HANDLE, VK_NULL_HANDLE); } VmaAllocationCreateInfo alloc_create_info = {}; @@ -799,7 +799,7 @@ std::pair VKStagingTexture::CreateLinearImage(StagingTex if (res != VK_SUCCESS) { LOG_VULKAN_ERROR(res, "vmaCreateImage failed: "); - return std::make_pair(VK_NULL_HANDLE, VK_NULL_HANDLE); + return std::make_pair(VK_NULL_HANDLE, VK_NULL_HANDLE); } return std::make_pair(image, alloc); }