mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
Load EGL with glad to fix crash in sf::priv::eglCheckError on DRM
This commit is contained in:
parent
5098b6c22b
commit
ee8f929bd6
@ -12,10 +12,6 @@ set(SRC
|
|||||||
${SRCROOT}/Cursor.cpp
|
${SRCROOT}/Cursor.cpp
|
||||||
${INCROOT}/Cursor.hpp
|
${INCROOT}/Cursor.hpp
|
||||||
${SRCROOT}/CursorImpl.hpp
|
${SRCROOT}/CursorImpl.hpp
|
||||||
${SRCROOT}/EGLCheck.cpp
|
|
||||||
${SRCROOT}/EGLCheck.hpp
|
|
||||||
${SRCROOT}/EglContext.cpp
|
|
||||||
${SRCROOT}/EglContext.hpp
|
|
||||||
${INCROOT}/Export.hpp
|
${INCROOT}/Export.hpp
|
||||||
${SRCROOT}/GlContext.cpp
|
${SRCROOT}/GlContext.cpp
|
||||||
${SRCROOT}/GlContext.hpp
|
${SRCROOT}/GlContext.hpp
|
||||||
@ -63,8 +59,6 @@ if(SFML_OS_WINDOWS)
|
|||||||
${SRCROOT}/Win32/CursorImpl.cpp
|
${SRCROOT}/Win32/CursorImpl.cpp
|
||||||
${SRCROOT}/Win32/ClipboardImpl.hpp
|
${SRCROOT}/Win32/ClipboardImpl.hpp
|
||||||
${SRCROOT}/Win32/ClipboardImpl.cpp
|
${SRCROOT}/Win32/ClipboardImpl.cpp
|
||||||
${SRCROOT}/Win32/WglContext.cpp
|
|
||||||
${SRCROOT}/Win32/WglContext.hpp
|
|
||||||
${SRCROOT}/Win32/InputImpl.cpp
|
${SRCROOT}/Win32/InputImpl.cpp
|
||||||
${SRCROOT}/Win32/InputImpl.hpp
|
${SRCROOT}/Win32/InputImpl.hpp
|
||||||
${SRCROOT}/Win32/JoystickImpl.cpp
|
${SRCROOT}/Win32/JoystickImpl.cpp
|
||||||
@ -77,15 +71,40 @@ if(SFML_OS_WINDOWS)
|
|||||||
${SRCROOT}/Win32/WindowImplWin32.cpp
|
${SRCROOT}/Win32/WindowImplWin32.cpp
|
||||||
${SRCROOT}/Win32/WindowImplWin32.hpp
|
${SRCROOT}/Win32/WindowImplWin32.hpp
|
||||||
)
|
)
|
||||||
|
if(SFML_OPENGL_ES)
|
||||||
|
set(PLATFORM_SRC
|
||||||
|
${PLATFORM_SRC}
|
||||||
|
${SRCROOT}/EGLCheck.cpp
|
||||||
|
${SRCROOT}/EGLCheck.hpp
|
||||||
|
${SRCROOT}/EglContext.cpp
|
||||||
|
${SRCROOT}/EglContext.hpp
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(PLATFORM_SRC
|
||||||
|
${PLATFORM_SRC}
|
||||||
|
${SRCROOT}/Win32/WglContext.cpp
|
||||||
|
${SRCROOT}/Win32/WglContext.hpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
source_group("windows" FILES ${PLATFORM_SRC})
|
source_group("windows" FILES ${PLATFORM_SRC})
|
||||||
|
|
||||||
# make sure that we use the Unicode version of the Win API functions
|
# make sure that we use the Unicode version of the Win API functions
|
||||||
add_definitions(-DUNICODE -D_UNICODE)
|
add_definitions(-DUNICODE -D_UNICODE)
|
||||||
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
||||||
if(SFML_USE_DRM)
|
if(SFML_OPENGL_ES)
|
||||||
|
set(PLATFORM_SRC
|
||||||
|
${PLATFORM_SRC}
|
||||||
|
${SRCROOT}/EGLCheck.cpp
|
||||||
|
${SRCROOT}/EGLCheck.hpp
|
||||||
|
${SRCROOT}/EglContext.cpp
|
||||||
|
${SRCROOT}/EglContext.hpp
|
||||||
|
)
|
||||||
|
elseif(SFML_USE_DRM)
|
||||||
add_definitions(-DSFML_USE_DRM)
|
add_definitions(-DSFML_USE_DRM)
|
||||||
set(PLATFORM_SRC
|
set(PLATFORM_SRC
|
||||||
${PLATFORM_SRC}
|
${PLATFORM_SRC}
|
||||||
|
${SRCROOT}/EGLCheck.cpp
|
||||||
|
${SRCROOT}/EGLCheck.hpp
|
||||||
${SRCROOT}/DRM/CursorImpl.hpp
|
${SRCROOT}/DRM/CursorImpl.hpp
|
||||||
${SRCROOT}/DRM/CursorImpl.cpp
|
${SRCROOT}/DRM/CursorImpl.cpp
|
||||||
${SRCROOT}/DRM/ClipboardImpl.hpp
|
${SRCROOT}/DRM/ClipboardImpl.hpp
|
||||||
@ -146,7 +165,6 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
|||||||
${SRCROOT}/NetBSD/JoystickImpl.cpp
|
${SRCROOT}/NetBSD/JoystickImpl.cpp
|
||||||
${SRCROOT}/NetBSD/JoystickImpl.hpp
|
${SRCROOT}/NetBSD/JoystickImpl.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
source_group("unix" FILES ${PLATFORM_SRC})
|
source_group("unix" FILES ${PLATFORM_SRC})
|
||||||
elseif(SFML_OS_MACOSX)
|
elseif(SFML_OS_MACOSX)
|
||||||
@ -232,6 +250,10 @@ elseif(SFML_OS_IOS)
|
|||||||
source_group("ios" FILES ${PLATFORM_SRC})
|
source_group("ios" FILES ${PLATFORM_SRC})
|
||||||
elseif(SFML_OS_ANDROID)
|
elseif(SFML_OS_ANDROID)
|
||||||
set(PLATFORM_SRC
|
set(PLATFORM_SRC
|
||||||
|
${SRCROOT}/EGLCheck.cpp
|
||||||
|
${SRCROOT}/EGLCheck.hpp
|
||||||
|
${SRCROOT}/EglContext.cpp
|
||||||
|
${SRCROOT}/EglContext.hpp
|
||||||
${SRCROOT}/Android/CursorImpl.hpp
|
${SRCROOT}/Android/CursorImpl.hpp
|
||||||
${SRCROOT}/Android/CursorImpl.cpp
|
${SRCROOT}/Android/CursorImpl.cpp
|
||||||
${SRCROOT}/Android/ClipboardImpl.hpp
|
${SRCROOT}/Android/ClipboardImpl.hpp
|
||||||
|
@ -37,6 +37,14 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
// We check for this definition in order to avoid multiple definitions of GLAD
|
||||||
|
// entities during unity builds of SFML.
|
||||||
|
#ifndef SF_GLAD_EGL_IMPLEMENTATION_INCLUDED
|
||||||
|
#define SF_GLAD_EGL_IMPLEMENTATION_INCLUDED
|
||||||
|
#define SF_GLAD_EGL_IMPLEMENTATION
|
||||||
|
#include <glad/egl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
@ -168,11 +176,15 @@ namespace
|
|||||||
|
|
||||||
if (display == EGL_NO_DISPLAY)
|
if (display == EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
|
gladLoaderLoadEGL(EGL_NO_DISPLAY);
|
||||||
|
|
||||||
eglCheck(display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(gbmDevice)));
|
eglCheck(display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(gbmDevice)));
|
||||||
|
|
||||||
EGLint major, minor;
|
EGLint major, minor;
|
||||||
eglCheck(eglInitialize(display, &major, &minor));
|
eglCheck(eglInitialize(display, &major, &minor));
|
||||||
|
|
||||||
|
gladLoaderLoadEGL(display);
|
||||||
|
|
||||||
#if defined(SFML_OPENGL_ES)
|
#if defined(SFML_OPENGL_ES)
|
||||||
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
||||||
{
|
{
|
||||||
|
@ -35,9 +35,7 @@
|
|||||||
#include <SFML/Window/VideoMode.hpp>
|
#include <SFML/Window/VideoMode.hpp>
|
||||||
#include <SFML/OpenGL.hpp>
|
#include <SFML/OpenGL.hpp>
|
||||||
#include <drm-common.h>
|
#include <drm-common.h>
|
||||||
#define EGL_NO_X11
|
#include <glad/egl.h>
|
||||||
#define MESA_EGL_NO_X11_HEADERS
|
|
||||||
#include <EGL/egl.h>
|
|
||||||
#include <gbm.h>
|
#include <gbm.h>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/GlContext.hpp>
|
#include <SFML/Window/GlContext.hpp>
|
||||||
#include <SFML/Window/Context.hpp>
|
#include <SFML/Window/Context.hpp>
|
||||||
#include <SFML/Window/EglContext.hpp>
|
|
||||||
#include <SFML/System/ThreadLocalPtr.hpp>
|
#include <SFML/System/ThreadLocalPtr.hpp>
|
||||||
#include <SFML/System/Mutex.hpp>
|
#include <SFML/System/Mutex.hpp>
|
||||||
#include <SFML/System/Lock.hpp>
|
#include <SFML/System/Lock.hpp>
|
||||||
@ -48,6 +47,7 @@
|
|||||||
|
|
||||||
#if defined(SFML_OPENGL_ES)
|
#if defined(SFML_OPENGL_ES)
|
||||||
|
|
||||||
|
#include <SFML/Window/EglContext.hpp>
|
||||||
typedef sf::priv::EglContext ContextType;
|
typedef sf::priv::EglContext ContextType;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
#if defined(SFML_OPENGL_ES)
|
#if defined(SFML_OPENGL_ES)
|
||||||
|
|
||||||
|
#include <SFML/Window/EglContext.hpp>
|
||||||
typedef sf::priv::EglContext ContextType;
|
typedef sf::priv::EglContext ContextType;
|
||||||
|
|
||||||
#elif defined(SFML_USE_DRM)
|
#elif defined(SFML_USE_DRM)
|
||||||
@ -87,6 +88,7 @@
|
|||||||
|
|
||||||
#elif defined(SFML_SYSTEM_ANDROID)
|
#elif defined(SFML_SYSTEM_ANDROID)
|
||||||
|
|
||||||
|
#include <SFML/Window/EglContext.hpp>
|
||||||
typedef sf::priv::EglContext ContextType;
|
typedef sf::priv::EglContext ContextType;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user