mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-16 09:48:26 +00:00
Fixed bug 4890 - Add hint for SDL that the graphics context is externally managed
Aaron Barany Add SDL_HINT_VIDEO_EXTERNAL_CONTEXT hint to notify SDL that the graphics context is external. This disables the automatic context save/restore behavior on Android and avoids using OpenGL by default when SDL_WINDOW_VUKLAN isn't set. When the application wishes to manage the OpenGL contexts on Android, this avoids cases where SDL unbinds the context and creates new contexts, which can interfere with the application's operation. When using Vulkan and Metal renderer implementations, this avoids SDL forcing OpenGL to be enabled on certain platforms. While using the SDL_WINDOW_VULKAN flag can be used to achieve the same thing, it also causes Vulkan to be loaded. If the application uses Vulkan directly, this is not necessary, and fails window creation when using Metal due to Vulkan not being present. (assuming MoltenVK isn't installed)
This commit is contained in:
parent
135a90539b
commit
54748a39be
5 changed files with 39 additions and 10 deletions
|
@ -164,6 +164,21 @@ extern "C" {
|
|||
*/
|
||||
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the graphics context is externally managed.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - SDL will manage graphics contexts that are attached to windows.
|
||||
* "1" - Disable graphics context management on windows.
|
||||
*
|
||||
* By default SDL will manage OpenGL contexts in certain situations. For example, on Android the
|
||||
* context will be automatically saved and restored when pausing the application. Additionally, some
|
||||
* platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this
|
||||
* behavior, which is desireable when the application manages the graphics context, such as
|
||||
* an externally managed OpenGL context or attaching a Vulkan surface to the window.
|
||||
*/
|
||||
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the X11 VidMode extension should be used.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue