You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/games-emulation/pcsx2/files/pcsx2-1.3.1-egl-optional.patch

170 lines
5.1 KiB

From 9cd13ca5b5a6a90c21abf1f41725e52efe4774c0 Mon Sep 17 00:00:00 2001
From: nE0sIghT <ykonotopov@gmail.com>
Date: Mon, 10 Aug 2015 19:11:00 +0300
Subject: [PATCH 1/3] gsdx-linux: Don't enable EGL by default
I was hoping that EGL become a standard much more faster. Currently it is an useless dep
so let's disable it by default.
Only check for EGL if using EGL_API.
---
cmake/SearchForStuff.cmake | 5 +++--
cmake/SelectPcsx2Plugins.cmake | 2 +-
plugins/GSdx/CMakeLists.txt | 27 ++++++++++-----------------
plugins/GSdx/GS.cpp | 8 ++++----
plugins/GSdx/GSWndEGL.cpp | 2 +-
plugins/GSdx/GSWndEGL.h | 21 +--------------------
6 files changed, 20 insertions(+), 45 deletions(-)
diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake
index 8c8918e..b43a547 100644
--- a/cmake/SearchForStuff.cmake
+++ b/cmake/SearchForStuff.cmake
@@ -69,8 +69,9 @@ include(CheckLib)
if(Linux)
check_lib(AIO aio libaio.h)
endif()
-check_lib(EGL EGL EGL/egl.h)
-check_lib(GLESV2 GLESv2 GLES3/gl3ext.h) # NOTE: looking for GLESv3, not GLESv2
+if(EGL_API)
+ check_lib(EGL EGL EGL/egl.h)
+endif()
check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h)
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h)
diff --git a/cmake/SelectPcsx2Plugins.cmake b/cmake/SelectPcsx2Plugins.cmake
index 726dc2d..ee8138b 100644
--- a/cmake/SelectPcsx2Plugins.cmake
+++ b/cmake/SelectPcsx2Plugins.cmake
@@ -144,7 +144,7 @@ endif()
# requires: -OpenGL
# -X11
#---------------------------------------
-if(OPENGL_FOUND AND X11_FOUND AND EGL_FOUND AND GTKn_FOUND)
+if(OPENGL_FOUND AND X11_FOUND AND GTKn_FOUND AND (EGL_FOUND OR NOT EGL_API))
set(GSdx TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/GSdx")
set(GSdx FALSE)
diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt
index 8859044..13b30c7 100644
--- a/plugins/GSdx/CMakeLists.txt
+++ b/plugins/GSdx/CMakeLists.txt
@@ -38,8 +38,8 @@ if(XDG_STD)
set(GSdxFinalFlags ${GSdxFinalFlags} -DXDG_STD)
endif()
-if(GLES_API AND GLESV2_FOUND)
- set(GSdxFinalFlags ${GSdxFinalFlags} -DENABLE_GLES)
+if(EGL_API AND EGL_FOUND)
+ set(GSdxFinalFlags ${GSdxFinalFlags} -DEGL_SUPPORTED)
endif()
#Clang doesn't support a few common flags that GCC does.
@@ -198,25 +198,18 @@ set(GSdxFinalLibs
${X11_LIBRARIES}
)
-if(GLES_API AND GLESV2_FOUND)
- set(GSdxFinalLibs
- ${GSdxFinalLibs}
- ${GLESV2_LIBRARIES}
- )
-else()
- set(GSdxFinalLibs
- ${GSdxFinalLibs}
- ${OPENGL_LIBRARIES}
- )
-endif()
-
-set(GSdxFinalLibs
- ${GSdxFinalLibs}
- ${EGL_LIBRARIES}
+set(GSdxFinalLibs ${GSdxFinalLibs}
+ ${OPENGL_LIBRARIES}
${GTK2_LIBRARIES}
${LIBC_LIBRARIES}
)
+if(EGL_API AND EGL_FOUND)
+ set(GSdxFinalLibs ${GSdxFinalLibs}
+ ${EGL_LIBRARIES}
+ )
+endif()
+
# Generate Glsl header file. Protect with REBUILD_SHADER to avoid build-dependency on PERL
if (REBUILD_SHADER)
add_custom_command(OUTPUT res/glsl_source.h COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/glsl2h.pl)
diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp
index 3ffb5e8..4836192 100644
--- a/plugins/GSdx/GS.cpp
+++ b/plugins/GSdx/GS.cpp
@@ -291,12 +291,12 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
break;
}
#else
-#ifdef ENABLE_GLES
- wnd[0] = NULL;
-#else
wnd[0] = new GSWndOGL();
-#endif
+#ifdef EGL_SUPPORTED
wnd[1] = new GSWndEGL();
+#else
+ wnd[1] = NULL;
+#endif
#endif
}
}
diff --git a/plugins/GSdx/GSWndEGL.cpp b/plugins/GSdx/GSWndEGL.cpp
index 491f34f..f69ff0c 100644
--- a/plugins/GSdx/GSWndEGL.cpp
+++ b/plugins/GSdx/GSWndEGL.cpp
@@ -22,7 +22,7 @@
#include "stdafx.h"
#include "GSWndEGL.h"
-#if defined(__linux__)
+#if defined(__linux__) && defined(EGL_SUPPORTED)
GSWndEGL::GSWndEGL()
: m_NativeWindow(0), m_NativeDisplay(NULL)
diff --git a/plugins/GSdx/GSWndEGL.h b/plugins/GSdx/GSWndEGL.h
index c5a2573..17804bb 100644
--- a/plugins/GSdx/GSWndEGL.h
+++ b/plugins/GSdx/GSWndEGL.h
@@ -21,30 +21,11 @@
#include "GSWnd.h"
-#if defined(__linux__)
+#if defined(__linux__) && defined(EGL_SUPPORTED)
#include <X11/Xlib.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
-// Need at least MESA 9.0 (plan for october/november 2012)
-// So force the destiny to at least check the compilation
-#ifndef EGL_KHR_create_context
-#define EGL_KHR_create_context 1
-#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
-#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
-#define EGL_CONTEXT_FLAGS_KHR 0x30FC
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
-#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
-#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
-#endif
-
-
class GSWndEGL : public GSWndGL
{
EGLNativeWindowType m_NativeWindow;
--
2.4.6