From b68191161efbde1f85807afd48c9fb0855e7e5ee Mon Sep 17 00:00:00 2001 From: M4xw Date: Sun, 15 Mar 2020 08:40:05 -0700 Subject: [PATCH] Switch: Add EGL interface. --- Common/GL/GLInterface/EGLSwitch.cpp | 21 +++++++++++++++++++++ Common/GL/GLInterface/EGLSwitch.h | 24 ++++++++++++++++++++++++ Common/GL/GLInterface/GLInterface.cpp | 5 +++++ 3 files changed, 50 insertions(+) create mode 100644 Common/GL/GLInterface/EGLSwitch.cpp create mode 100644 Common/GL/GLInterface/EGLSwitch.h diff --git a/Common/GL/GLInterface/EGLSwitch.cpp b/Common/GL/GLInterface/EGLSwitch.cpp new file mode 100644 index 0000000000..4cd670c678 --- /dev/null +++ b/Common/GL/GLInterface/EGLSwitch.cpp @@ -0,0 +1,21 @@ +// Copyright 2014 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "ppsspp_config.h" +#if PPSSPP_PLATFORM(SWITCH) +#include +#include "Common/Log.h" +#include "Common/GL/GLInterface/EGLSwitch.h" + +EGLDisplay cInterfaceEGLSwitch::OpenDisplay() { + return eglGetDisplay(EGL_DEFAULT_DISPLAY); +} + +EGLNativeWindowType cInterfaceEGLSwitch::InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) { + return nwindowGetDefault(); +} + +void cInterfaceEGLSwitch::ShutdownPlatform() { +} +#endif diff --git a/Common/GL/GLInterface/EGLSwitch.h b/Common/GL/GLInterface/EGLSwitch.h new file mode 100644 index 0000000000..b313158429 --- /dev/null +++ b/Common/GL/GLInterface/EGLSwitch.h @@ -0,0 +1,24 @@ +// Copyright 2014 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include "Common/GL/GLInterface/EGL.h" + +class cInterfaceEGLSwitch : public cInterfaceEGL { +public: + cInterfaceEGLSwitch() {} +protected: + EGLDisplay OpenDisplay() override; + EGLNativeWindowType InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) override; + void ShutdownPlatform() override; + void OverrideBackbufferDimensions(int internalWidth, int internalHeight) override { + internalWidth_ = internalWidth; + internalHeight_ = internalHeight; + } + +private: + int internalWidth_ = 0; + int internalHeight_ = 0; +}; diff --git a/Common/GL/GLInterface/GLInterface.cpp b/Common/GL/GLInterface/GLInterface.cpp index 6a8202aaf1..389f650ae7 100644 --- a/Common/GL/GLInterface/GLInterface.cpp +++ b/Common/GL/GLInterface/GLInterface.cpp @@ -2,10 +2,13 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "ppsspp_config.h" #include "Common/GL/GLInterfaceBase.h" #ifdef __ANDROID__ #include "Common/GL/GLInterface/EGLAndroid.h" +#elif PPSSPP_PLATFORM(SWITCH) +#include "Common/GL/GLInterface/EGLSwitch.h" #elif defined(__APPLE__) #include "Common/GL/GLInterface/AGL.h" #elif defined(_WIN32) @@ -23,6 +26,8 @@ cInterfaceBase* HostGL_CreateGLInterface(){ #ifdef __ANDROID__ return new cInterfaceEGLAndroid; + #elif if PPSSPP_PLATFORM(SWITCH) + return new cInterfaceEGLSwitch; #elif defined(__APPLE__) return new cInterfaceAGL; #elif defined(_WIN32)