Fixed bug 3355 - false "Invalid renderer" after creating an "opengles2" renderer.
authorSam Lantinga <slouken@libsdl.org>
Thu, 13 Oct 2016 08:46:34 -0700
changeset 10525563503b6b4d1
parent 10524 8ede8e4e5b6f
child 10526 db8472cf0223
Fixed bug 3355 - false "Invalid renderer" after creating an "opengles2" renderer.

Call SDL_GL_GetDrawableSize() directly because we may be in the initialization path and SDL_GetRendererOutputSize() will fail because the renderer magic isn't set up yet.
src/render/opengl/SDL_render_gl.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
     1.1 --- a/src/render/opengl/SDL_render_gl.c	Wed Oct 12 22:34:54 2016 -0700
     1.2 +++ b/src/render/opengl/SDL_render_gl.c	Thu Oct 13 08:46:34 2016 -0700
     1.3 @@ -592,7 +592,6 @@
     1.4  GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
     1.5  {
     1.6      SDL_GL_GetDrawableSize(renderer->window, w, h);
     1.7 -
     1.8      return 0;
     1.9  }
    1.10  
    1.11 @@ -1020,7 +1019,7 @@
    1.12      } else {
    1.13          int w, h;
    1.14  
    1.15 -        SDL_GetRendererOutputSize(renderer, &w, &h);
    1.16 +        SDL_GL_GetDrawableSize(renderer, &w, &h);
    1.17          data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
    1.18                           renderer->viewport.w, renderer->viewport.h);
    1.19      }
    1.20 @@ -1058,7 +1057,7 @@
    1.21          } else {
    1.22              int w, h;
    1.23  
    1.24 -            SDL_GetRendererOutputSize(renderer, &w, &h);
    1.25 +            SDL_GL_GetDrawableSize(renderer, &w, &h);
    1.26              data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
    1.27          }
    1.28      } else {
     2.1 --- a/src/render/opengles/SDL_render_gles.c	Wed Oct 12 22:34:54 2016 -0700
     2.2 +++ b/src/render/opengles/SDL_render_gles.c	Thu Oct 13 08:46:34 2016 -0700
     2.3 @@ -672,7 +672,7 @@
     2.4      } else {
     2.5          int w, h;
     2.6  
     2.7 -        SDL_GetRendererOutputSize(renderer, &w, &h);
     2.8 +        SDL_GL_GetDrawableSize(renderer, &w, &h);
     2.9          data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
    2.10                           renderer->viewport.w, renderer->viewport.h);
    2.11      }
    2.12 @@ -715,7 +715,7 @@
    2.13          } else {
    2.14              int w, h;
    2.15  
    2.16 -            SDL_GetRendererOutputSize(renderer, &w, &h);
    2.17 +            SDL_GL_GetDrawableSize(renderer, &w, &h);
    2.18              data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
    2.19          }
    2.20      } else {
     3.1 --- a/src/render/opengles2/SDL_render_gles2.c	Wed Oct 12 22:34:54 2016 -0700
     3.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Thu Oct 13 08:46:34 2016 -0700
     3.3 @@ -388,7 +388,7 @@
     3.4      } else {
     3.5          int w, h;
     3.6  
     3.7 -        SDL_GetRendererOutputSize(renderer, &w, &h);
     3.8 +        SDL_GL_GetDrawableSize(renderer->window, &w, &h);
     3.9          data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
    3.10                           renderer->viewport.w, renderer->viewport.h);
    3.11      }
    3.12 @@ -417,7 +417,7 @@
    3.13          } else {
    3.14              int w, h;
    3.15  
    3.16 -            SDL_GetRendererOutputSize(renderer, &w, &h);
    3.17 +            SDL_GL_GetDrawableSize(renderer->window, &w, &h);
    3.18              data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
    3.19          }
    3.20      } else {