Explorar el Código

video: Wrap OpenGL work in ifdefs.

Apparently the rest of SDL_GL_CreateContext compiles on platforms without
OpenGL, though!  :)
Ryan C. Gordon hace 3 meses
padre
commit
3dc48a4890
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      src/video/SDL_video.c

+ 5 - 0
src/video/SDL_video.c

@@ -5394,12 +5394,15 @@ SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
         return NULL;
         return NULL;
     }
     }
 
 
+#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)
     bool srgb_requested = (_this->gl_config.framebuffer_srgb_capable > 0);
     bool srgb_requested = (_this->gl_config.framebuffer_srgb_capable > 0);
     const char *srgbhint = SDL_GetHint(SDL_HINT_OPENGL_FORCE_SRGB_CAPABLE);
     const char *srgbhint = SDL_GetHint(SDL_HINT_OPENGL_FORCE_SRGB_CAPABLE);
     if (srgbhint && *srgbhint) {
     if (srgbhint && *srgbhint) {
         srgb_requested = SDL_GetStringBoolean(srgbhint, false);
         srgb_requested = SDL_GetStringBoolean(srgbhint, false);
     }
     }
 
 
+#endif
+
     ctx = _this->GL_CreateContext(_this, window);
     ctx = _this->GL_CreateContext(_this, window);
 
 
     // Creating a context is assumed to make it current in the SDL driver.
     // Creating a context is assumed to make it current in the SDL driver.
@@ -5410,6 +5413,7 @@ SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
         SDL_SetTLS(&_this->current_glctx_tls, ctx, NULL);
         SDL_SetTLS(&_this->current_glctx_tls, ctx, NULL);
     }
     }
 
 
+#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)
     // try to force the window framebuffer to the requested sRGB state.
     // try to force the window framebuffer to the requested sRGB state.
     PFNGLENABLEPROC glToggleFunc = (PFNGLENABLEPROC) SDL_GL_GetProcAddress(srgb_requested ? "glEnable" : "glDisable");
     PFNGLENABLEPROC glToggleFunc = (PFNGLENABLEPROC) SDL_GL_GetProcAddress(srgb_requested ? "glEnable" : "glDisable");
     PFNGLGETSTRINGPROC glGetStringFunc = (PFNGLGETSTRINGPROC)SDL_GL_GetProcAddress("glGetString");
     PFNGLGETSTRINGPROC glGetStringFunc = (PFNGLGETSTRINGPROC)SDL_GL_GetProcAddress("glGetString");
@@ -5427,6 +5431,7 @@ SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
             glToggleFunc(GL_FRAMEBUFFER_SRGB);
             glToggleFunc(GL_FRAMEBUFFER_SRGB);
         }
         }
     }
     }
+#endif
 
 
     return ctx;
     return ctx;
 }
 }