Merge pull request #18 from alexytomi/dev-es

[Fix] (gpu_utils): Fix undefined behaviour introduced by 5e46d9e
This commit is contained in:
Swung 2025-06-01 13:58:17 +08:00 committed by GitHub
commit 018eb03343
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,7 @@ static const char *vk_lib[] = {
std::string getGPUInfo() {
EGLDisplay eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (eglDisplay == EGL_NO_DISPLAY || eglInitialize(eglDisplay, nullptr, nullptr) != EGL_TRUE)
return nullptr;
return "";
EGLint egl_attributes[] = {
EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8,
@ -36,7 +36,7 @@ std::string getGPUInfo() {
EGLint num_configs = 0;
if (eglChooseConfig(eglDisplay, egl_attributes, nullptr, 0, &num_configs) != EGL_TRUE || num_configs == 0) {
eglTerminate(eglDisplay);
return nullptr;
return "";
}
EGLConfig eglConfig;
@ -46,13 +46,13 @@ std::string getGPUInfo() {
EGLContext context = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, egl_context_attributes);
if (context == EGL_NO_CONTEXT) {
eglTerminate(eglDisplay);
return nullptr;
return "";
}
if (eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, context) != EGL_TRUE) {
eglDestroyContext(eglDisplay, context);
eglTerminate(eglDisplay);
return nullptr;
return "";
}
std::string renderer;