Fixed build, C89 doesn't allow non-constant static initializers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 1994c56..d4078c3 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -172,39 +172,6 @@ typedef struct {
int bytes_per_pixel;
} SDL_WindowTextureData;
-#if SDL_VIDEO_OPENGL
-static SDL_bool
-HasAcceleratedOpenGL()
-{
- SDL_Window *window;
- SDL_GLContext context;
- SDL_bool hasAcceleratedOpenGL = SDL_FALSE;
-
- window = SDL_CreateWindow("OpenGL test", -32, -32, 32, 32, SDL_WINDOW_OPENGL|SDL_WINDOW_HIDDEN);
- if (window) {
- context = SDL_GL_CreateContext(window);
- if (context) {
- const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
- const char *vendor = NULL;
-
- glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
- if (glGetStringFunc) {
- vendor = (const char *) glGetStringFunc(GL_VENDOR);
- }
- /* Add more vendors here at will... */
- if (vendor &&
- (SDL_strstr(vendor, "ATI Technologies") ||
- SDL_strstr(vendor, "NVIDIA"))) {
- hasAcceleratedOpenGL = SDL_TRUE;
- }
- SDL_GL_DeleteContext(context);
- }
- SDL_DestroyWindow(window);
- }
- return hasAcceleratedOpenGL;
-}
-#endif /* SDL_VIDEO_OPENGL */
-
static SDL_bool
ShouldUseTextureFramebuffer()
{
@@ -243,8 +210,33 @@ ShouldUseTextureFramebuffer()
#elif defined(__LINUX__)
/* Properly configured OpenGL drivers are faster than MIT-SHM */
#if SDL_VIDEO_OPENGL
+ /* Ugh, find a way to cache this value! */
{
- static SDL_bool hasAcceleratedOpenGL = HasAcceleratedOpenGL();
+ SDL_Window *window;
+ SDL_GLContext context;
+ SDL_bool hasAcceleratedOpenGL = SDL_FALSE;
+
+ window = SDL_CreateWindow("OpenGL test", -32, -32, 32, 32, SDL_WINDOW_OPENGL|SDL_WINDOW_HIDDEN);
+ if (window) {
+ context = SDL_GL_CreateContext(window);
+ if (context) {
+ const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
+ const char *vendor = NULL;
+
+ glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+ if (glGetStringFunc) {
+ vendor = (const char *) glGetStringFunc(GL_VENDOR);
+ }
+ /* Add more vendors here at will... */
+ if (vendor &&
+ (SDL_strstr(vendor, "ATI Technologies") ||
+ SDL_strstr(vendor, "NVIDIA"))) {
+ hasAcceleratedOpenGL = SDL_TRUE;
+ }
+ SDL_GL_DeleteContext(context);
+ }
+ SDL_DestroyWindow(window);
+ }
return hasAcceleratedOpenGL;
}
#elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2