Android: Fix headless and unittest build.

This commit is contained in:
Unknown W. Brackets committed 2021-01-10 12:16:02 -08:00
1 parent e00f894340
commit e2efc245db
4 files changed
+22 -5

No files matched your search

+1
View File
@@ -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
+6 -2
View File
@@ -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 <cstdio>
#include <cstdlib>
#include <limits>
#if defined(ANDROID)
#if PPSSPP_PLATFORM(ANDROID)
#include <jni.h>
#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 {
+9
View File
@@ -1,3 +1,4 @@
#include "ppsspp_config.h"
#include <algorithm>
#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<uint32_t> 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;
+6 -3
View File
@@ -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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <sstream>
#if defined(ANDROID)
#if PPSSPP_PLATFORM(ANDROID)
#include <jni.h>
#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