Fixed OpenVR build

This commit is contained in:
Sam Lantinga
2026-06-29 13:14:33 -07:00
parent 9da5a636ad
commit 92c3150859

View File

@@ -34,13 +34,21 @@
#include "../SDL_egl_c.h"
#include "SDL_openvrvideo.h"
#ifdef SDL_VIDEO_DRIVER_WINDOWS
// Currently only OpenGL, not EGL, is supported on Windows
#include <SDL3/SDL_opengl.h>
#else
// Currently only EGL, not OpenGL, is supported on other platforms
#include <SDL3/SDL_opengles2.h>
#include <SDL3/SDL_opengles2_gl2.h>
#endif
#ifdef SDL_VIDEO_DRIVER_WINDOWS
#include "../windows/SDL_windowsopengles.h"
#include "../windows/SDL_windowsopengl.h"
#include "../windows/SDL_windowsvulkan.h"
#define DEFAULT_OPENGL "OPENGL32.DLL"
static bool OPENVR_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path);
static SDL_GLContext OPENVR_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
@@ -48,10 +56,9 @@ struct SDL_GLContextState
{
HGLRC hglrc;
};
#endif // SDL_VIDEO_DRIVER_WINDOWS
#else
#include <SDL3/SDL_opengles2_gl2.h>
#endif
#ifdef SDL_PLATFORM_WINDOWS
#define SDL_OPENVR_DRIVER_DYNAMIC "openvr_api.dll"
@@ -1626,16 +1633,8 @@ static SDL_VideoDevice *OPENVR_CreateDevice(void)
device->GL_GetSwapInterval = OPENVR_GL_GetSwapInterval;
device->GL_SwapWindow = OPENVR_GL_SwapWindow;
device->GL_DestroyContext = OPENVR_GL_DestroyContext;
#elif SDL_VIDEO_OPENGL_EGL
device->GL_LoadLibrary = WIN_GLES_LoadLibrary;
device->GL_GetProcAddress = WIN_GLES_GetProcAddress;
device->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
device->GL_CreateContext = WIN_GLES_CreateContext;
device->GL_MakeCurrent = WIN_GLES_MakeCurrent;
device->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
device->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
device->GL_SwapWindow = WIN_GLES_SwapWindow;
device->GL_DestroyContext = WIN_GLES_DestroyContext;
#else
#error Needs more work to support EGL
#endif
#else
device->GL_LoadLibrary = OVR_EGL_LoadLibrary;