foxygit / doom Log in
commit 439d4f5ea9417cf6a4ef8eb10c9133778d10c4a8
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Sun Mar 19 16:31:38 2017 +0100
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Sun Mar 19 16:31:38 2017 +0100

    video: do not ignore 0x0 max texture dimensions

    If max texture dimensions are reported as 0x0, do not merely ignore
    this but create an actual 0x0 texture instead.
---
 src/i_video.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index e396e0a9..18551c40 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -564,18 +564,17 @@ static void LimitTextureSize(int *w_upscale, int *h_upscale)
                 SDL_GetError());
     }

-    while (rinfo.max_texture_width > 0 &&
-           *w_upscale * SCREENWIDTH > rinfo.max_texture_width)
+    while (*w_upscale * SCREENWIDTH > rinfo.max_texture_width)
     {
         --*w_upscale;
     }
-    while (rinfo.max_texture_height > 0 &&
-           *h_upscale * SCREENHEIGHT > rinfo.max_texture_height)
+    while (*h_upscale * SCREENHEIGHT > rinfo.max_texture_height)
     {
         --*h_upscale;
     }

-    if (*w_upscale < 1 || *h_upscale < 1)
+    if ((*w_upscale < 1 && rinfo.max_texture_width > 0) ||
+        (*h_upscale < 1 && rinfo.max_texture_height > 0))
     {
         I_Error("CreateUpscaledTexture: Can't create a texture big enough for "
                 "the whole screen! Maximum texture size %dx%d",