Browse Source

Allow SDL hints to override OpenGL extension availability

Sam Lantinga 8 months ago
parent
commit
95adcc522f
3 changed files with 5 additions and 5 deletions
  1. 1 1
      src/render/opengl/SDL_render_gl.c
  2. 2 2
      src/video/SDL_egl.c
  3. 2 2
      src/video/SDL_video.c

+ 1 - 1
src/render/opengl/SDL_render_gl.c

@@ -1729,7 +1729,7 @@ static int GL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro
         data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
     }
 
-    hint = SDL_getenv("GL_ARB_texture_non_power_of_two");
+    hint = SDL_GetHint("GL_ARB_texture_non_power_of_two");
     if (!hint || *hint != '0') {
         SDL_bool isGL2 = SDL_FALSE;
         const char *verstr = (const char *)data->glGetString(GL_VERSION);

+ 2 - 2
src/video/SDL_egl.c

@@ -189,14 +189,14 @@ SDL_bool SDL_EGL_HasExtension(SDL_VideoDevice *_this, SDL_EGL_ExtensionType type
         return SDL_FALSE;
     }
 
-    /* Extensions can be masked with an environment variable.
+    /* Extensions can be masked with a hint or environment variable.
      * Unlike the OpenGL override, this will use the set bits of an integer
      * to disable the extension.
      *  Bit   Action
      *  0     If set, the display extension is masked and not present to SDL.
      *  1     If set, the client extension is masked and not present to SDL.
      */
-    ext_override = SDL_getenv(ext);
+    ext_override = SDL_GetHint(ext);
     if (ext_override) {
         int disable_ext = SDL_atoi(ext_override);
         if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) {

+ 2 - 2
src/video/SDL_video.c

@@ -4323,8 +4323,8 @@ SDL_bool SDL_GL_ExtensionSupported(const char *extension)
     if (where || *extension == '\0') {
         return SDL_FALSE;
     }
-    /* See if there's an environment variable override */
-    start = SDL_getenv(extension);
+    /* See if there's a hint or environment variable override */
+    start = SDL_GetHint(extension);
     if (start && *start == '0') {
         return SDL_FALSE;
     }