mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-24 12:05:43 +00:00
gpu/vulkan renderer: Reconfigure the window on renderer creation if it has the OpenGL flag
In some cases, conflicts can occur at the platform or driver level if a window initially configured for OpenGL is then used with a Vulkan-based renderer. Try to reconfigure or recreate the window in the unlikely event that it has the OpenGL flag set when initializing the Vulkan or GPU renderer to remove any platform or driver-specific OpenGL objects and properties.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "../../events/SDL_windowevents_c.h"
|
||||
#include "../../video/SDL_pixels_c.h"
|
||||
#include "../../video/SDL_sysvideo.h"
|
||||
#include "../SDL_d3dmath.h"
|
||||
#include "../SDL_sysrender.h"
|
||||
#include "SDL_gpu_util.h"
|
||||
@@ -1745,6 +1746,13 @@ static bool GPU_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
|
||||
{
|
||||
GPU_RenderData *data = NULL;
|
||||
|
||||
// Clear any OpenGL properties on the window to avoid potential driver conflicts.
|
||||
SDL_WindowFlags flags = SDL_GetWindowFlags(window);
|
||||
if (flags & SDL_WINDOW_OPENGL) {
|
||||
flags &= ~SDL_WINDOW_OPENGL;
|
||||
SDL_ReconfigureWindow(window, flags);
|
||||
}
|
||||
|
||||
SDL_SetupRendererColorspace(renderer, create_props);
|
||||
|
||||
if (renderer->output_colorspace != SDL_COLORSPACE_SRGB &&
|
||||
|
||||
@@ -4549,6 +4549,13 @@ static bool VULKAN_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SD
|
||||
{
|
||||
VULKAN_RenderData *rendererData;
|
||||
|
||||
// Clear any OpenGL properties on the window to avoid potential driver conflicts.
|
||||
SDL_WindowFlags flags = SDL_GetWindowFlags(window);
|
||||
if (flags & SDL_WINDOW_OPENGL) {
|
||||
flags &= ~SDL_WINDOW_OPENGL;
|
||||
SDL_ReconfigureWindow(window, flags);
|
||||
}
|
||||
|
||||
SDL_SetupRendererColorspace(renderer, create_props);
|
||||
|
||||
if (renderer->output_colorspace != SDL_COLORSPACE_SRGB &&
|
||||
|
||||
Reference in New Issue
Block a user