mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-10 13:28:15 +00:00
video: rework how we prepare a texture framebuffer.
Now we see if we can create an SDL_Renderer, and if that renderer reports itself as "accelerated," and added some initial heuristics to the OpenGL renderer to make better decisions about what qualifies as "accelerated." This adds some FIXMEs that might be merely hypothetical, and removes the old OpenGL checks from the video subsystem that probably weren't meaningful in modern times. This will definitely need to improve the existing list in the GL renderer, to catch things like llvmpipe, etc. Reference issue #4624.
This commit is contained in:
@@ -1690,6 +1690,32 @@ GL_SetVSync(SDL_Renderer * renderer, const int vsync)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
GL_IsProbablyAccelerated(const GL_RenderData *data)
|
||||
{
|
||||
/*const char *vendor = (const char *) data->glGetString(GL_VENDOR);*/
|
||||
const char *renderer = (const char *) data->glGetString(GL_RENDERER);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
if (SDL_strcmp(renderer, "GDI Generic") == 0) {
|
||||
return SDL_FALSE; /* Microsoft's fallback software renderer. Fix your system! */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (SDL_strcmp(renderer, "Apple Software Renderer") == 0) {
|
||||
return SDL_FALSE; /* (a probably very old) Apple software-based OpenGL. */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (SDL_strcmp(renderer, "Software Rasterizer") == 0) {
|
||||
return SDL_FALSE; /* (a probably very old) Software Mesa, or some other generic thing. */
|
||||
}
|
||||
|
||||
/* !!! FIXME: swrast? llvmpipe? softpipe? */
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static SDL_Renderer *
|
||||
GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
@@ -1760,7 +1786,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
renderer->GL_BindTexture = GL_BindTexture;
|
||||
renderer->GL_UnbindTexture = GL_UnbindTexture;
|
||||
renderer->info = GL_RenderDriver.info;
|
||||
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
||||
renderer->info.flags = 0; /* will set some flags below. */
|
||||
renderer->driverdata = data;
|
||||
renderer->window = window;
|
||||
|
||||
@@ -1784,6 +1810,10 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (GL_IsProbablyAccelerated(data)) {
|
||||
renderer->info.flags |= SDL_RENDERER_ACCELERATED;
|
||||
}
|
||||
|
||||
#ifdef __MACOSX__
|
||||
/* Enable multi-threaded rendering */
|
||||
/* Disabled until Ryan finishes his VBO/PBO code...
|
||||
|
Reference in New Issue
Block a user