[Fix] (gpu_utils): Fix undefined behaviour introduced by 5e46d9e26a

This makes (at least without ANGLE) it work on Android Studio's AVD :D
This commit is contained in:
alexytomi 2025-06-01 13:50:51 +08:00
parent db7f06fc73
commit 10e6895cbd

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;