src/render/opengles2/SDL_render_gles2.c
changeset 12377 84618d571795
parent 12164 8b71c22d6714
child 12381 dc9108cd4340
equal deleted inserted replaced
12376:cfc65d4d49ae 12377:84618d571795
  2120         goto error;
  2120         goto error;
  2121     }
  2121     }
  2122 
  2122 
  2123     data = (GLES2_DriverContext *)SDL_calloc(1, sizeof(GLES2_DriverContext));
  2123     data = (GLES2_DriverContext *)SDL_calloc(1, sizeof(GLES2_DriverContext));
  2124     if (!data) {
  2124     if (!data) {
  2125         GLES2_DestroyRenderer(renderer);
  2125         SDL_free(renderer);
  2126         SDL_OutOfMemory();
  2126         SDL_OutOfMemory();
  2127         goto error;
  2127         goto error;
  2128     }
  2128     }
  2129     renderer->info = GLES2_RenderDriver.info;
  2129     renderer->info = GLES2_RenderDriver.info;
  2130     renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
  2130     renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
  2132     renderer->window = window;
  2132     renderer->window = window;
  2133 
  2133 
  2134     /* Create an OpenGL ES 2.0 context */
  2134     /* Create an OpenGL ES 2.0 context */
  2135     data->context = SDL_GL_CreateContext(window);
  2135     data->context = SDL_GL_CreateContext(window);
  2136     if (!data->context) {
  2136     if (!data->context) {
  2137         GLES2_DestroyRenderer(renderer);
  2137         SDL_free(renderer);
       
  2138         SDL_free(data);
  2138         goto error;
  2139         goto error;
  2139     }
  2140     }
  2140     if (SDL_GL_MakeCurrent(window, data->context) < 0) {
  2141     if (SDL_GL_MakeCurrent(window, data->context) < 0) {
  2141         GLES2_DestroyRenderer(renderer);
  2142         SDL_GL_DeleteContext(data->context);
       
  2143         SDL_free(renderer);
       
  2144         SDL_free(data);
  2142         goto error;
  2145         goto error;
  2143     }
  2146     }
  2144 
  2147 
  2145     if (GLES2_LoadFunctions(data) < 0) {
  2148     if (GLES2_LoadFunctions(data) < 0) {
  2146         GLES2_DestroyRenderer(renderer);
  2149         SDL_GL_DeleteContext(data->context);
       
  2150         SDL_free(renderer);
       
  2151         SDL_free(data);
  2147         goto error;
  2152         goto error;
  2148     }
  2153     }
  2149 
  2154 
  2150 #if __WINRT__
  2155 #if __WINRT__
  2151     /* DLudwig, 2013-11-29: ANGLE for WinRT doesn't seem to work unless VSync
  2156     /* DLudwig, 2013-11-29: ANGLE for WinRT doesn't seem to work unless VSync