From e2efc245dbb332bb09482f5f7c3f422c3654acfd Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 10 Jan 2021 12:16:02 -0800 Subject: [PATCH 1/3] Android: Fix headless and unittest build. --- android/jni/Android.mk | 1 + headless/Headless.cpp | 8 ++++++-- unittest/TestShaderGenerators.cpp | 9 +++++++++ unittest/UnitTest.cpp | 9 ++++++--- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/android/jni/Android.mk b/android/jni/Android.mk index c527ea2524e0..35cec50d0e09 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -684,6 +684,7 @@ ifeq ($(UNITTEST),1) LOCAL_MODULE := ppsspp_unittest LOCAL_SRC_FILES := \ $(SRC)/unittest/JitHarness.cpp \ + $(SRC)/unittest/TestShaderGenerators.cpp \ $(SRC)/unittest/TestVertexJit.cpp \ $(TESTARMEMITTER_FILE) \ $(SRC)/unittest/UnitTest.cpp diff --git a/headless/Headless.cpp b/headless/Headless.cpp index bbabad7710bf..52331451aebb 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -2,10 +2,11 @@ // See headless.txt. // To build on non-windows systems, just run CMake in the SDL directory, it will build both a normal ppsspp and the headless version. +#include "ppsspp_config.h" #include #include #include -#if defined(ANDROID) +#if PPSSPP_PLATFORM(ANDROID) #include #endif @@ -38,7 +39,7 @@ #include "SDLHeadlessHost.h" #endif -#if defined(ANDROID) +#if PPSSPP_PLATFORM(ANDROID) JNIEnv *getEnv() { return nullptr; } @@ -46,6 +47,9 @@ JNIEnv *getEnv() { jclass findClass(const char *name) { return nullptr; } + +bool audioRecording_Available() { return false; } +bool audioRecording_State() { return false; } #endif class PrintfLogger : public LogListener { diff --git a/unittest/TestShaderGenerators.cpp b/unittest/TestShaderGenerators.cpp index a68c8247ba50..81d74558a449 100644 --- a/unittest/TestShaderGenerators.cpp +++ b/unittest/TestShaderGenerators.cpp @@ -1,3 +1,4 @@ +#include "ppsspp_config.h" #include #include "Common/StringUtils.h" @@ -13,11 +14,13 @@ #include "GPU/Common/VertexShaderGenerator.h" #include "GPU/Common/ReinterpretFramebuffer.h" +#if PPSSPP_PLATFORM(WINDOWS) #include "GPU/D3D11/D3D11Util.h" #include "GPU/D3D11/D3D11Loader.h" #include "GPU/D3D9/D3DCompilerLoader.h" #include "GPU/D3D9/D3D9ShaderCompiler.h" +#endif bool GenerateFShader(FShaderID id, char *buffer, ShaderLanguage lang, Draw::Bugs bugs, std::string *errorString) { uint64_t uniformMask; @@ -89,6 +92,7 @@ bool GenerateVShader(VShaderID id, char *buffer, ShaderLanguage lang, Draw::Bugs bool TestCompileShader(const char *buffer, ShaderLanguage lang, bool vertex, std::string *errorMessage) { std::vector spirv; switch (lang) { +#if PPSSPP_PLATFORM(WINDOWS) case ShaderLanguage::HLSL_D3D11: { auto output = CompileShaderToBytecodeD3D11(buffer, strlen(buffer), vertex ? "vs_4_0" : "ps_4_0", 0); @@ -104,6 +108,7 @@ bool TestCompileShader(const char *buffer, ShaderLanguage lang, bool vertex, std return false; } } +#endif case ShaderLanguage::GLSL_VULKAN: return GLSLtoSPV(vertex ? VK_SHADER_STAGE_VERTEX_BIT : VK_SHADER_STAGE_FRAGMENT_BIT, buffer, GLSLVariant::VULKAN, spirv, errorMessage); @@ -352,9 +357,13 @@ bool TestFragmentShaders() { } bool TestShaderGenerators() { +#if PPSSPP_PLATFORM(WINDOWS) LoadD3D11(); init_glslang(); LoadD3DCompilerDynamic(); +#else + init_glslang(); +#endif if (!TestFragmentShaders()) { return false; diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index 7e5bd98b9772..6547be7ea64a 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -27,17 +27,17 @@ // To use, set command line parameter to one or more of the tests below, or "all". // Search for "availableTests". +#include "ppsspp_config.h" #include #include #include #include #include #include -#if defined(ANDROID) +#if PPSSPP_PLATFORM(ANDROID) #include #endif -#include "ppsspp_config.h" #include "Common/System/NativeApp.h" #include "Common/System/System.h" #include "Common/Input/InputState.h" @@ -72,7 +72,7 @@ bool System_GetPropertyBool(SystemProperty prop) { return false; } -#if defined(ANDROID) +#if PPSSPP_PLATFORM(ANDROID) JNIEnv *getEnv() { return nullptr; } @@ -80,6 +80,9 @@ JNIEnv *getEnv() { jclass findClass(const char *name) { return nullptr; } + +bool audioRecording_Available() { return false; } +bool audioRecording_State() { return false; } #endif #ifndef M_PI_2 From e12651e746c5792136410e6f41d0b9cd501caff4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 10 Jan 2021 12:16:17 -0800 Subject: [PATCH 2/3] Build: Validate unittest/headless on Android. --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c60c43a5498e..b8fddd1a76d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -121,22 +121,22 @@ jobs: extra: android cc: clang cxx: clang++ - args: cd android && ./ab.sh -j2 APP_ABI=arm64-v8a + args: cd android && ./ab.sh -j2 APP_ABI=arm64-v8a UNITTEST=1 HEADLESS=1 - os: ubuntu-latest extra: android cc: clang cxx: clang++ - args: cd android && ./ab.sh -j2 APP_ABI=armeabi-v7a + args: cd android && ./ab.sh -j2 APP_ABI=armeabi-v7a UNITTEST=1 HEADLESS=1 - os: ubuntu-latest extra: android cc: clang cxx: clang++ - args: cd android && ./ab.sh -j2 APP_ABI=x86 + args: cd android && ./ab.sh -j2 APP_ABI=x86 UNITTEST=1 HEADLESS=1 - os: ubuntu-latest extra: android cc: clang cxx: clang++ - args: cd android && ./ab.sh -j2 APP_ABI=x86_64 + args: cd android && ./ab.sh -j2 APP_ABI=x86_64 UNITTEST=1 HEADLESS=1 - os: ubuntu-latest extra: android cc: clang From 3734df347b6da78673b84b0b7650df8724331f64 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 10 Jan 2021 12:38:20 -0800 Subject: [PATCH 3/3] Android: Add NEON/SSE funcs into Headless/UnitTest. --- android/jni/Android.mk | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 35cec50d0e09..4579fd9b7701 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -17,6 +17,7 @@ ARCH_FILES := \ $(SRC)/Common/x64Emitter.cpp \ $(SRC)/Common/x64Analyzer.cpp \ $(SRC)/Common/CPUDetect.cpp \ + $(SRC)/Common/Math/fast/fast_matrix_sse.c \ $(SRC)/Common/Thunk.cpp \ $(SRC)/Core/MIPS/x86/CompALU.cpp \ $(SRC)/Core/MIPS/x86/CompBranch.cpp \ @@ -39,6 +40,7 @@ ARCH_FILES := \ $(SRC)/Common/x64Emitter.cpp \ $(SRC)/Common/x64Analyzer.cpp \ $(SRC)/Common/CPUDetect.cpp \ + $(SRC)/Common/Math/fast/fast_matrix_sse.c \ $(SRC)/Common/Thunk.cpp \ $(SRC)/Core/MIPS/x86/CompALU.cpp \ $(SRC)/Core/MIPS/x86/CompBranch.cpp \ @@ -62,6 +64,7 @@ ARCH_FILES := \ $(SRC)/Common/ArmEmitter.cpp \ $(SRC)/Common/ArmCPUDetect.cpp \ $(SRC)/Common/ColorConvNEON.cpp.neon \ + $(SRC)/Common/Math/fast/fast_matrix_neon.S.neon \ $(SRC)/Core/MIPS/ARM/ArmCompALU.cpp \ $(SRC)/Core/MIPS/ARM/ArmCompBranch.cpp \ $(SRC)/Core/MIPS/ARM/ArmCompFPU.cpp \ @@ -76,6 +79,9 @@ ARCH_FILES := \ $(SRC)/Core/MIPS/ARM/ArmRegCacheFPU.cpp \ $(SRC)/GPU/Common/VertexDecoderArm.cpp \ $(SRC)/ext/disarm.cpp \ + $(SRC)/ext/libpng17/arm/arm_init.c \ + $(SRC)/ext/libpng17/arm/filter_neon_intrinsics.c \ + $(SRC)/ext/libpng17/arm/filter_neon.S.neon \ ArmEmitterTest.cpp endif @@ -620,18 +626,6 @@ LOCAL_SRC_FILES := \ ifeq ($(findstring armeabi-v7a,$(TARGET_ARCH_ABI)),armeabi-v7a) LOCAL_CFLAGS := $(LOCAL_CFLAGS) -DARM -LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ - $(SRC)/Common/Math/fast/fast_matrix_neon.S.neon \ - $(SRC)/ext/libpng17/arm/arm_init.c \ - $(SRC)/ext/libpng17/arm/filter_neon_intrinsics.c \ - $(SRC)/ext/libpng17/arm/filter_neon.S.neon - -else ifeq ($(TARGET_ARCH_ABI),x86) -LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ - $(SRC)/Common/Math/fast/fast_matrix_sse.c -else ifeq ($(TARGET_ARCH_ABI),x86_64) -LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ - $(SRC)/Common/Math/fast/fast_matrix_sse.c endif ifneq ($(SKIPAPP),1)