Only set the OpenGL flag if the OpenVR driver is active

This commit is contained in:
Sam Lantinga
2024-10-21 15:07:43 -07:00
parent 82b3325978
commit 1c51b8dc33

View File

@@ -277,6 +277,11 @@ static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this)
if (_this->Metal_CreateView) { if (_this->Metal_CreateView) {
return SDL_WINDOW_METAL; return SDL_WINDOW_METAL;
} }
#endif
#if defined(SDL_VIDEO_OPENGL) && defined(SDL_VIDEO_DRIVER_OPENVR)
if (SDL_strcmp(_this->name, "openvr") == 0) {
return SDL_WINDOW_OPENGL;
}
#endif #endif
return 0; return 0;
} }
@@ -2342,10 +2347,6 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
flags |= SDL_DefaultGraphicsBackends(_this); flags |= SDL_DefaultGraphicsBackends(_this);
} }
#if defined(SDL_VIDEO_OPENGL) && defined(SDL_VIDEO_DRIVER_OPENVR)
flags |= SDL_WINDOW_OPENGL;
#endif
if (flags & SDL_WINDOW_OPENGL) { if (flags & SDL_WINDOW_OPENGL) {
if (!_this->GL_CreateContext) { if (!_this->GL_CreateContext) {
SDL_ContextNotSupported("OpenGL"); SDL_ContextNotSupported("OpenGL");