windows: support forcing EGL for GL desktop

This will theoretically support ANGLE's GL desktop frontend whenever it
becomes fully implemented and enabled in the future.
main
Steven Noonan 2022-09-11 12:30:18 -07:00
parent 085a276d6c
commit e8fbb02d16
No known key found for this signature in database
GPG Key ID: 408EEB508ED0CD4D
3 changed files with 9 additions and 4 deletions

View File

@ -76,6 +76,7 @@
#elif SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT #elif SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
/* EGL AND OpenGL ES support via ANGLE */ /* EGL AND OpenGL ES support via ANGLE */
#define DEFAULT_EGL "libEGL.dll" #define DEFAULT_EGL "libEGL.dll"
#define DEFAULT_OGL "opengl32.dll"
#define DEFAULT_OGL_ES2 "libGLESv2.dll" #define DEFAULT_OGL_ES2 "libGLESv2.dll"
#define DEFAULT_OGL_ES_PVR "libGLES_CM.dll" #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll"
#define DEFAULT_OGL_ES "libGLESv1_CM.dll" #define DEFAULT_OGL_ES "libGLESv1_CM.dll"

View File

@ -22,6 +22,7 @@
#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#include "SDL_hints.h"
#include "SDL_windowsvideo.h" #include "SDL_windowsvideo.h"
#include "SDL_windowsopengles.h" #include "SDL_windowsopengles.h"
#include "SDL_windowsopengl.h" #include "SDL_windowsopengl.h"
@ -33,7 +34,8 @@ int
WIN_GLES_LoadLibrary(_THIS, const char *path) { WIN_GLES_LoadLibrary(_THIS, const char *path) {
/* If the profile requested is not GL ES, switch over to WIN_GL functions */ /* If the profile requested is not GL ES, switch over to WIN_GL functions */
if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES &&
!SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) {
#if SDL_VIDEO_OPENGL_WGL #if SDL_VIDEO_OPENGL_WGL
WIN_GLES_UnloadLibrary(_this); WIN_GLES_UnloadLibrary(_this);
_this->GL_LoadLibrary = WIN_GL_LoadLibrary; _this->GL_LoadLibrary = WIN_GL_LoadLibrary;
@ -66,7 +68,8 @@ WIN_GLES_CreateContext(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *)window->driverdata; SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
#if SDL_VIDEO_OPENGL_WGL #if SDL_VIDEO_OPENGL_WGL
if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES &&
!SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) {
/* Switch to WGL based functions */ /* Switch to WGL based functions */
WIN_GLES_UnloadLibrary(_this); WIN_GLES_UnloadLibrary(_this);
_this->GL_LoadLibrary = WIN_GL_LoadLibrary; _this->GL_LoadLibrary = WIN_GL_LoadLibrary;

View File

@ -542,9 +542,10 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
/* The rest of this macro mess is for OpenGL or OpenGL ES windows */ /* The rest of this macro mess is for OpenGL or OpenGL ES windows */
#if SDL_VIDEO_OPENGL_ES2 #if SDL_VIDEO_OPENGL_ES2
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES ||
SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) &&
#if SDL_VIDEO_OPENGL_WGL #if SDL_VIDEO_OPENGL_WGL
&& (!_this->gl_data || WIN_GL_UseEGL(_this)) (!_this->gl_data || WIN_GL_UseEGL(_this))
#endif /* SDL_VIDEO_OPENGL_WGL */ #endif /* SDL_VIDEO_OPENGL_WGL */
) { ) {
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL