diff --git a/Common/ColorConvNEON.cpp b/Common/ColorConvNEON.cpp index 46a5cea5fd..375bcd0e75 100644 --- a/Common/ColorConvNEON.cpp +++ b/Common/ColorConvNEON.cpp @@ -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 #else #include diff --git a/Core/Config.cpp b/Core/Config.cpp index 0ed26c391b..69b96c1ef1 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -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; } diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 843c89c009..89f860eeea 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -47,7 +47,7 @@ #include #endif #if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && defined(_M_ARM64) +#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) #include #else #include diff --git a/Core/MIPS/IR/IRInterpreter.cpp b/Core/MIPS/IR/IRInterpreter.cpp index 29e34249a9..51724a80ef 100644 --- a/Core/MIPS/IR/IRInterpreter.cpp +++ b/Core/MIPS/IR/IRInterpreter.cpp @@ -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 #else #include diff --git a/Core/MemMap.h b/Core/MemMap.h index 5c41f1e683..39cb86109f 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -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)); diff --git a/Core/Util/AudioFormatNEON.cpp b/Core/Util/AudioFormatNEON.cpp index 78c154c365..8a3bc61579 100644 --- a/Core/Util/AudioFormatNEON.cpp +++ b/Core/Util/AudioFormatNEON.cpp @@ -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 #else #include diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 971fdfb645..a5e6951559 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include +#include "ppsspp_config.h" #include "profiler/profiler.h" #include "Common/ColorConv.h" #include "Common/MemoryUtil.h" @@ -35,7 +36,7 @@ #include #endif #if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && defined(_M_ARM64) +#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) #include #else #include diff --git a/GPU/Common/TextureDecoderNEON.cpp b/GPU/Common/TextureDecoderNEON.cpp index 481144015d..af56567a45 100644 --- a/GPU/Common/TextureDecoderNEON.cpp +++ b/GPU/Common/TextureDecoderNEON.cpp @@ -21,7 +21,7 @@ #include "ext/xxhash.h" -#if defined(_MSC_VER) && defined(_M_ARM64) +#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) #include #else #include diff --git a/GPU/GPU.cpp b/GPU/GPU.cpp index 5681fd442d..47944003a7 100644 --- a/GPU/GPU.cpp +++ b/GPU/GPU.cpp @@ -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 diff --git a/GPU/GPUState.cpp b/GPU/GPUState.cpp index 5ac8b8013a..44c9419cb9 100644 --- a/GPU/GPUState.cpp +++ b/GPU/GPUState.cpp @@ -28,7 +28,7 @@ #include #endif #if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && defined(_M_ARM64) +#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) #include #else #include diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index ccd4e58225..e6be9b4956 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -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; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 6fb2784622..c747c627dd 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -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)) { diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index d46553743f..f52506da4a 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -24,6 +24,7 @@ #include "Common/CommonWindows.h" #include "Common/KeyMap.h" #include "Common/OSVersion.h" +#include "ppsspp_config.h" #include #include @@ -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; diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index bf869c6823..24b3b7c571 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -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 diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index 194503d11e..0195caf18b 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -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; diff --git a/Windows/main.cpp b/Windows/main.cpp index 00aa3a2969..d59eb688a2 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -22,6 +22,7 @@ #include "Common/CommonWindows.h" #include "Common/OSVersion.h" #include "Common/Vulkan/VulkanLoader.h" +#include "ppsspp_config.h" #include #include @@ -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)); diff --git a/Windows/main.h b/Windows/main.h index 9018b41bc8..d25d8ed006 100644 --- a/Windows/main.h +++ b/Windows/main.h @@ -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 diff --git a/ext/native/gfx_es2/gpu_features.cpp b/ext/native/gfx_es2/gpu_features.cpp index f23c310357..b51b550f6b 100644 --- a/ext/native/gfx_es2/gpu_features.cpp +++ b/ext/native/gfx_es2/gpu_features.cpp @@ -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) { diff --git a/ext/native/math/dataconv.h b/ext/native/math/dataconv.h index fafe6a4a44..8852d9d4c5 100644 --- a/ext/native/math/dataconv.h +++ b/ext/native/math/dataconv.h @@ -10,7 +10,7 @@ #include #endif #if PPSSPP_PLATFORM(ARM_NEON) -#if defined(_MSC_VER) && defined(_M_ARM64) +#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) #include #else #include diff --git a/headless/Headless.cpp b/headless/Headless.cpp index e4bf824602..e438aa63a0 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -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); diff --git a/headless/WindowsHeadlessHost.cpp b/headless/WindowsHeadlessHost.cpp index f25c709629..dba04b79ad 100644 --- a/headless/WindowsHeadlessHost.cpp +++ b/headless/WindowsHeadlessHost.cpp @@ -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; diff --git a/ppsspp_config.h b/ppsspp_config.h index 91150cbbe7..43e90da724 100644 --- a/ppsspp_config.h +++ b/ppsspp_config.h @@ -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