sdl12-compat: Software surface now default to not-vsync'd.

From f89db4ab8c9a3fd61e29af5b815401a8a6aca773 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 26 Feb 2021 13:11:09 -0500
Subject: [PATCH] Software surface now default to not-vsync'd.

This matches how SDL 1.2 handled them on most platforms.

You can change this by setting the SDL12COMPAT_SYNC_TO_BLANK=1
environment variable, if a game is running to quickly or you just
dislike the tearing.

Fixes #13.
---
 src/SDL12_compat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 2070c70..03822b5 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -3093,9 +3093,11 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags12)
         VideoSurface12->flags |= SDL12_OPENGL;
     } else {
         /* always use a renderer for non-OpenGL windows. */
+        const char *env = SDL20_getenv("SDL12COMPAT_SYNC_TO_VBLANK");
+        const SDL_bool want_vsync = (env && SDL20_atoi(env)) ? SDL_TRUE : SDL_FALSE;
         SDL_RendererInfo rinfo;
         SDL_assert(!VideoGLContext20);  /* either a new window or we destroyed all this */
-        if (!VideoRenderer20) {
+        if (!VideoRenderer20 && want_vsync) {
             VideoRenderer20 = SDL20_CreateRenderer(VideoWindow20, -1, SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC);
         }
         if (!VideoRenderer20) {