Allow SDL hints to override OpenGL extension availability

This commit is contained in:
Sam Lantinga 2024-08-03 10:56:16 -07:00
parent a97dadf779
commit 95adcc522f
3 changed files with 5 additions and 5 deletions

View file

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

View file

@ -189,14 +189,14 @@ SDL_bool SDL_EGL_HasExtension(SDL_VideoDevice *_this, SDL_EGL_ExtensionType type
return SDL_FALSE; 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 * Unlike the OpenGL override, this will use the set bits of an integer
* to disable the extension. * to disable the extension.
* Bit Action * Bit Action
* 0 If set, the display extension is masked and not present to SDL. * 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. * 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) { if (ext_override) {
int disable_ext = SDL_atoi(ext_override); int disable_ext = SDL_atoi(ext_override);
if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) { if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) {

View file

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