From 92c31508591152b5efc47695f46d1637e1793e00 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 29 Jun 2026 13:14:33 -0700
Subject: [PATCH] Fixed OpenVR build
---
src/video/openvr/SDL_openvrvideo.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/video/openvr/SDL_openvrvideo.c b/src/video/openvr/SDL_openvrvideo.c
index a3afd4d50d9a1..393ab1c238b9b 100644
--- a/src/video/openvr/SDL_openvrvideo.c
+++ b/src/video/openvr/SDL_openvrvideo.c
@@ -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;