REVIEWED: Variable scope #5485

This commit is contained in:
Ray
2026-01-11 21:02:59 +01:00
parent 51bdaa34fa
commit 4badbe2b17

View File

@ -1415,6 +1415,7 @@ int InitPlatform(void)
}; };
EGLint numConfigs = 0; EGLint numConfigs = 0;
const char *eglClientExtensions = NULL;
// Get an EGL device connection // Get an EGL device connection
// NOTE: eglGetPlatformDisplay() is preferred over eglGetDisplay() legacy call // NOTE: eglGetPlatformDisplay() is preferred over eglGetDisplay() legacy call
@ -1424,14 +1425,12 @@ int InitPlatform(void)
#else #else
// Check if extension is available for eglGetPlatformDisplayEXT() // Check if extension is available for eglGetPlatformDisplayEXT()
// NOTE: Better compatibility with some drivers (e.g. Mali Midgard) // NOTE: Better compatibility with some drivers (e.g. Mali Midgard)
const char *eglClientExtensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); eglClientExtensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (eglClientExtensions != NULL) if ((eglClientExtensions != NULL) && (strstr(eglClientExtensions, "EGL_EXT_platform_base") != NULL))
{ {
if (strstr(eglClientExtensions, "EGL_EXT_platform_base") != NULL) PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDisplayEXT");
{
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDisplayEXT"); if (eglGetPlatformDisplayEXT != NULL) platform.device = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_KHR, platform.gbmDevice, NULL);
if (eglGetPlatformDisplayEXT != NULL) platform.device = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_KHR, platform.gbmDevice, NULL);
}
} }
// In case extension not found or display could not be retrieved, try useing legacy version // In case extension not found or display could not be retrieved, try useing legacy version
@ -1520,13 +1519,9 @@ int InitPlatform(void)
if ((eglClientExtensions != NULL) && (strstr(eglClientExtensions, "EGL_EXT_platform_base") != NULL)) if ((eglClientExtensions != NULL) && (strstr(eglClientExtensions, "EGL_EXT_platform_base") != NULL))
{ {
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC eglCreatePlatformWindowSurfaceEXT = PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
(PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
if (eglCreatePlatformWindowSurfaceEXT != NULL) if (eglCreatePlatformWindowSurfaceEXT != NULL) platform.surface = eglCreatePlatformWindowSurfaceEXT(platform.device, platform.config, platform.gbmSurface, NULL);
{
platform.surface = eglCreatePlatformWindowSurfaceEXT(platform.device, platform.config, platform.gbmSurface, NULL);
}
} }
if (platform.surface == EGL_NO_SURFACE) if (platform.surface == EGL_NO_SURFACE)