Clean up some more ifdefs

This commit is contained in:
Henrik Rydgård 2019-05-10 23:25:57 +02:00
parent 20d666ff55
commit 2f26297062
22 changed files with 55 additions and 46 deletions

View file

@ -18,7 +18,7 @@
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM_NEON)
#if defined(_MSC_VER) && defined(_M_ARM64)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>

View file

@ -566,12 +566,12 @@ int Config::NextValidBackend() {
return (int)GPUBackend::DIRECT3D11;
}
#endif
#if !PPSSPP_PLATFORM(UWP) && !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
if (!failed.count((int)GPUBackend::OPENGL)) {
return (int)GPUBackend::OPENGL;
}
#endif
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
#if PPSSPP_PLATFORM(D3D9)
if (!failed.count((int)GPUBackend::DIRECT3D9)) {
return (int)GPUBackend::DIRECT3D9;
}

View file

@ -47,7 +47,7 @@
#include <emmintrin.h>
#endif
#if PPSSPP_ARCH(ARM_NEON)
#if defined(_MSC_VER) && defined(_M_ARM64)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>

View file

@ -10,7 +10,7 @@
#endif
#if PPSSPP_ARCH(ARM_NEON)
#if defined(_MSC_VER) && defined(_M_ARM64)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>

View file

@ -157,10 +157,6 @@ u16 Read_U16(const u32 _Address);
u32 Read_U32(const u32 _Address);
u64 Read_U64(const u32 _Address);
#if (defined(ARM) || defined(_ARM)) && !defined(_M_ARM)
#define _M_ARM
#endif
inline u8* GetPointerUnchecked(const u32 address) {
#ifdef MASKED_PSP_MEMORY
return (u8 *)(base + (address & MEMVIEW32_MASK));

View file

@ -18,7 +18,7 @@
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM_NEON)
#if defined(_MSC_VER) && defined(_M_ARM64)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>

View file

@ -16,6 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <algorithm>
#include "ppsspp_config.h"
#include "profiler/profiler.h"
#include "Common/ColorConv.h"
#include "Common/MemoryUtil.h"
@ -35,7 +36,7 @@
#include <emmintrin.h>
#endif
#if PPSSPP_ARCH(ARM_NEON)
#if defined(_MSC_VER) && defined(_M_ARM64)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>

View file

@ -21,7 +21,7 @@
#include "ext/xxhash.h"
#if defined(_MSC_VER) && defined(_M_ARM64)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>

View file

@ -24,10 +24,7 @@
#include "GPU/GPU.h"
#include "GPU/GPUInterface.h"
#if PPSSPP_PLATFORM(UWP)
#include "GPU/D3D11/GPU_D3D11.h"
#else
#if !PPSSPP_PLATFORM(WINDOWS) || (!defined(_M_ARM64) && !defined(_M_ARM))
#if PPSSPP_API(ANY_GL)
#include "GPU/GLES/GPU_GLES.h"
#endif
#include "GPU/Vulkan/GPU_Vulkan.h"
@ -39,8 +36,6 @@
#include "GPU/D3D11/GPU_D3D11.h"
#endif
#endif
GPUStatistics gpuStats;
GPUInterface *gpu;
GPUDebugInterface *gpuDebug;
@ -73,7 +68,7 @@ bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) {
break;
case GPUCORE_GLES:
// Disable GLES on ARM Windows (but leave it enabled on other ARM platforms).
#if !PPSSPP_PLATFORM(WINDOWS) || (!defined(_M_ARM64) && !defined(_M_ARM))
#if PPSSPP_API(ANY_GL)
SetGPU(new GPU_GLES(ctx, draw));
break;
#else
@ -90,7 +85,7 @@ bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) {
return false;
#endif
case GPUCORE_DIRECTX11:
#if defined(_WIN32)
#if PPSSPP_API(D3D11)
SetGPU(new GPU_D3D11(ctx, draw));
break;
#else

View file

@ -28,7 +28,7 @@
#include <emmintrin.h>
#endif
#if PPSSPP_ARCH(ARM_NEON)
#if defined(_MSC_VER) && defined(_M_ARM64)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>

View file

@ -219,7 +219,7 @@ void EmuScreen::bootGame(const std::string &filename) {
coreParam.gpuCore = GPUCORE_DIRECTX11;
break;
#if !PPSSPP_PLATFORM(UWP)
#if !defined(_M_ARM) && !defined(_M_ARM64)
#if PPSSPP_API(ANY_GL)
case GPUBackend::OPENGL:
coreParam.gpuCore = GPUCORE_GLES;
break;

View file

@ -203,7 +203,7 @@ void GameSettingsScreen::CreateViews() {
renderingBackendChoice->HideChoice(1); // D3D9
renderingBackendChoice->HideChoice(2); // D3D11
#else
#if defined(_M_ARM) || defined(_M_ARM64)
#if !PPSSPP_API(ANY_GL)
renderingBackendChoice->HideChoice(0); // OpenGL
#endif
if (!DoesVersionMatchWindows(6, 0, 0, 0, true)) {

View file

@ -24,6 +24,7 @@
#include "Common/CommonWindows.h"
#include "Common/KeyMap.h"
#include "Common/OSVersion.h"
#include "ppsspp_config.h"
#include <Windowsx.h>
#include <shellapi.h>
@ -48,7 +49,7 @@
#include "Core/MIPS/JitCommon/JitBlockCache.h"
#include "Windows/InputBox.h"
#include "Windows/InputDevice.h"
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
#include "Windows/GPU/WindowsGLContext.h"
#include "Windows/GEDebugger/GEDebugger.h"
#endif
@ -519,7 +520,7 @@ namespace MainWindow
DialogManager::AddDlg(disasmWindow[0]);
disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad);
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
geDebuggerWindow = new CGEDebugger(MainWindow::GetHInstance(), MainWindow::GetHWND());
DialogManager::AddDlg(geDebuggerWindow);
#endif
@ -533,7 +534,7 @@ namespace MainWindow
delete disasmWindow[0];
disasmWindow[0] = 0;
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
DialogManager::RemoveDlg(geDebuggerWindow);
if (geDebuggerWindow)
delete geDebuggerWindow;

View file

@ -16,7 +16,7 @@
#include "Common/ConsoleListener.h"
#include "Common/OSVersion.h"
#include "Common/Vulkan/VulkanLoader.h"
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
#include "GPU/GLES/TextureScalerGLES.h"
#include "GPU/GLES/TextureCacheGLES.h"
#include "GPU/GLES/FramebufferManagerGLES.h"
@ -887,7 +887,7 @@ namespace MainWindow {
break;
case ID_DEBUG_GEDEBUGGER:
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
if (geDebuggerWindow)
geDebuggerWindow->Show(true);
#endif
@ -1287,7 +1287,7 @@ namespace MainWindow {
bool allowD3D11 = DoesVersionMatchWindows(6, 0, 0, 0, true);
bool allowVulkan = VulkanMayBeAvailable();
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
bool allowOpenGL = true;
#else
bool allowOpenGL = false;
@ -1335,7 +1335,7 @@ namespace MainWindow {
break;
}
#if defined(_M_ARM64) || defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
EnableMenuItem(menu, ID_DEBUG_GEDEBUGGER, MF_GRAYED);
#endif

View file

@ -51,7 +51,7 @@
#include "Windows/WindowsHost.h"
#include "Windows/MainWindow.h"
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
#include "Windows/GPU/WindowsGLContext.h"
#endif
#include "Windows/GPU/WindowsVulkanContext.h"
@ -121,7 +121,7 @@ void WindowsHost::UpdateConsolePosition() {
bool WindowsHost::InitGraphics(std::string *error_message, GraphicsContext **ctx) {
WindowsGraphicsContext *graphicsContext = nullptr;
switch (g_Config.iGPUBackend) {
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
case (int)GPUBackend::OPENGL:
graphicsContext = new WindowsGLContext();
break;

View file

@ -22,6 +22,7 @@
#include "Common/CommonWindows.h"
#include "Common/OSVersion.h"
#include "Common/Vulkan/VulkanLoader.h"
#include "ppsspp_config.h"
#include <Wbemidl.h>
#include <shellapi.h>
@ -56,7 +57,7 @@
#include "Windows/Debugger/Debugger_Disasm.h"
#include "Windows/Debugger/Debugger_MemoryDlg.h"
#include "Windows/Debugger/Debugger_VFPUDlg.h"
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
#include "Windows/GEDebugger/GEDebugger.h"
#endif
#include "Windows/W32Util/DialogManager.h"
@ -82,7 +83,7 @@ extern "C" {
extern "C" {
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
CGEDebugger* geDebuggerWindow = 0;
#endif
@ -595,7 +596,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
CtrlDisAsmView::init();
CtrlMemView::init();
CtrlRegisterList::init();
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
CGEDebugger::Init();
#endif
DialogManager::AddDlg(vfpudlg = new CVFPUDlg(_hInstance, hwndMain, currentDebugMIPS));

View file

@ -27,7 +27,7 @@
extern CDisasm *disasmWindow[MAX_CPUCOUNT];
extern CMemoryDlg *memoryWindow[MAX_CPUCOUNT];
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
#include "Windows/GEDebugger/GEDebugger.h"
extern CGEDebugger* geDebuggerWindow;
#endif

View file

@ -6,15 +6,13 @@
#include "base/logging.h"
#include "base/stringutil.h"
#if !PPSSPP_PLATFORM(WINDOWS) || (!defined(_M_ARM64) && !defined(_M_ARM))
#if !PPSSPP_PLATFORM(UWP)
#if PPSSPP_API(ANY_GL)
#include "gfx/gl_common.h"
#if defined(_WIN32)
#include "GL/wglew.h"
#endif
#endif
#endif
#include "gfx_es2/gpu_features.h"
@ -121,7 +119,7 @@ void ProcessGPUFeatures() {
void CheckGLExtensions() {
#if !PPSSPP_PLATFORM(UWP) && !defined(_M_ARM64) && !defined(_M_ARM)
#if !PPSSPP_PLATFORM(UWP) && !PPSSPP_ARCH(ARM64) && !PPSSPP_ARCH(ARM)
// Make sure to only do this once. It's okay to call CheckGLExtensions from wherever.
if (extensionsDone)
@ -571,7 +569,7 @@ static const char *glsl_fragment_prelude =
"#endif\n";
std::string ApplyGLSLPrelude(const std::string &source, uint32_t stage) {
#if !PPSSPP_PLATFORM(UWP) && !defined(_M_ARM64) && !defined(_M_ARM)
#if !PPSSPP_PLATFORM(UWP) && !PPSSPP_ARCH(ARM64) && !PPSSPP_ARCH(ARM)
std::string temp;
std::string version = "";
if (!gl_extensions.IsGLES && gl_extensions.IsCoreContext) {

View file

@ -10,7 +10,7 @@
#include <emmintrin.h>
#endif
#if PPSSPP_PLATFORM(ARM_NEON)
#if defined(_MSC_VER) && defined(_M_ARM64)
#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>

View file

@ -277,9 +277,13 @@ int main(int argc, const char* argv[])
return printUsage(argv[0], "Unknown gpu backend specified after --graphics=. Allowed: software, directx9, directx11, vulkan, gles, null.");
}
// Default to GLES if no value selected.
else if (!strcmp(argv[i], "--graphics"))
else if (!strcmp(argv[i], "--graphics")) {
#if PPSSPP_API(ANY_GL)
gpuCore = GPUCORE_GLES;
else if (!strncmp(argv[i], "--screenshot=", strlen("--screenshot=")) && strlen(argv[i]) > strlen("--screenshot="))
#else
gpuCore = GPUCORE_DIRECTX11;
#endif
} else if (!strncmp(argv[i], "--screenshot=", strlen("--screenshot=")) && strlen(argv[i]) > strlen("--screenshot="))
screenshotFilename = argv[i] + strlen("--screenshot=");
else if (!strncmp(argv[i], "--timeout=", strlen("--timeout=")) && strlen(argv[i]) > strlen("--timeout="))
timeout = strtod(argv[i] + strlen("--timeout="), NULL);

View file

@ -26,7 +26,7 @@
#include "Core/System.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUState.h"
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
#include "Windows/GPU/WindowsGLContext.h"
#endif
#include "Windows/GPU/D3D9Context.h"
@ -93,7 +93,7 @@ bool WindowsHeadlessHost::InitGraphics(std::string *error_message, GraphicsConte
switch (gpuCore_) {
case GPUCORE_NULL:
case GPUCORE_GLES:
#if !defined(_M_ARM64) && !defined(_M_ARM)
#if PPSSPP_API(ANY_GL)
case GPUCORE_SOFTWARE:
graphicsContext = new WindowsGLContext();
needRenderThread = true;

View file

@ -5,6 +5,7 @@
#define PPSSPP_ARCH(PPSSPP_FEATURE) (PPSSPP_ARCH_##PPSSPP_FEATURE)
#define PPSSPP_PLATFORM(PPSSPP_FEATURE) (PPSSPP_PLATFORM_##PPSSPP_FEATURE)
#define PPSSPP_API(PPSSPP_FEATURE) (PPSSPP_API_##PPSSPP_FEATURE)
// ARCH defines
#if defined(_M_IX86) || defined(__i386__)
@ -115,3 +116,15 @@
#elif defined(__linux__)
#define PPSSPP_PLATFORM_LINUX 1
#endif
// Windows ARM/ARM64, and Windows UWP (all), are the only platform that don't do GL at all (until Apple finally removes it)
#if !PPSSPP_PLATFORM(WINDOWS) || ((!PPSSPP_ARCH(ARM) && !PPSSPP_ARCH(ARM64)) && !PPSSPP_PLATFORM(UWP))
#define PPSSPP_API_ANY_GL 1
#endif
#if PPSSPP_PLATFORM(WINDOWS)
#if !PPSSPP_PLATFORM(UWP)
#define PPSSPP_API_D3D9 1
#endif
#define PPSSPP_API_D3D11 1
#endif