video: Don't use texture framebuffer on Windows Subsystem for Linux.

Reference Issue #6333.
main
Ryan C. Gordon 2022-10-27 13:54:53 -04:00
parent 4223e6ac7a
commit 9e8d2f3948
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 16 additions and 0 deletions

View File

@ -56,6 +56,13 @@
#include <emscripten.h>
#endif
#ifdef __LINUX__
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#endif
/* Available video drivers */
static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_COCOA
@ -2640,6 +2647,15 @@ SDL_CreateWindowFramebuffer(SDL_Window * window)
attempt_texture_framebuffer = SDL_FALSE;
}
#if defined(__LINUX__)
/* On WSL, direct X11 is faster than using OpenGL for window framebuffers, so try to detect WSL and avoid texture framebuffer. */
else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "x11") == 0)) {
struct stat sb;
if ((stat("/proc/sys/fs/binfmt_misc/WSLInterop", &sb) == 0) || (stat("/run/WSL", &sb) == 0)) { /* if either of these exist, we're on WSL. */
attempt_texture_framebuffer = SDL_FALSE;
}
}
#endif
#if defined(__WIN32__) || defined(__WINGDK__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */
else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "windows") == 0)) {
attempt_texture_framebuffer = SDL_FALSE;