Browse Source

Fixed bug 3173 - SDL_GL_GetAttribute overwrites error code from SDL_GL_GetProcAddress

Yann Dirson

When SDL_GL_GetProcAddress returns in error, the cause of the error is overwritten
in GL_GL_GetAttribute, reporting to the user "Failed getting OpenGL glGetString entry point", whereas the original "OpenGL library not loaded" never makes it
to the user.

Pushed a fix to:
https://github.com/O-Computers/SDL/commit/f94cb13708ef4d236f8a2a330135b9b3a47db204


Note that the "OpenGL library not loaded" error looks like no root cause either,
and I'm still puzzled by the code path used: I'm forcing opengles2 renderer on
the x11 video driver on a rpi2, as in https://bugzilla.libsdl.org/3169, and although I now know that I must force the use of the RPI video driver instead
of the x11 one, I suspect even more accurate info can be given to user.
Sam Lantinga 8 years ago
parent
commit
4a9c6f0a14
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/video/SDL_video.c

+ 4 - 4
src/video/SDL_video.c

@@ -3302,7 +3302,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
 #if SDL_VIDEO_OPENGL
 #if SDL_VIDEO_OPENGL
     glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
     glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
     if (!glGetStringFunc) {
     if (!glGetStringFunc) {
-        return SDL_SetError("Failed getting OpenGL glGetString entry point");
+        return -1;
     }
     }
 
 
     if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
     if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
@@ -3311,7 +3311,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
         if (glGetFramebufferAttachmentParameterivFunc) {
         if (glGetFramebufferAttachmentParameterivFunc) {
             glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value);
             glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value);
         } else {
         } else {
-            return SDL_SetError("Failed getting OpenGL glGetFramebufferAttachmentParameteriv entry point");
+            return -1;
         }
         }
     } else
     } else
 #endif
 #endif
@@ -3321,13 +3321,13 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
         if (glGetIntegervFunc) {
         if (glGetIntegervFunc) {
             glGetIntegervFunc(attrib, (GLint *) value);
             glGetIntegervFunc(attrib, (GLint *) value);
         } else {
         } else {
-            return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point");
+            return -1;
         }
         }
     }
     }
 
 
     glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
     glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
     if (!glGetErrorFunc) {
     if (!glGetErrorFunc) {
-        return SDL_SetError("Failed getting OpenGL glGetError entry point");
+        return -1;
     }
     }
 
 
     error = glGetErrorFunc();
     error = glGetErrorFunc();