diff --git a/src/main/cpp/config/gpu_utils.cpp b/src/main/cpp/config/gpu_utils.cpp index 510115e..07c24a0 100644 --- a/src/main/cpp/config/gpu_utils.cpp +++ b/src/main/cpp/config/gpu_utils.cpp @@ -20,7 +20,7 @@ static const char *vk_lib[] = { }; -const char* getGPUInfo() { +std::string getGPUInfo() { EGLDisplay eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (eglDisplay == EGL_NO_DISPLAY || eglInitialize(eglDisplay, nullptr, nullptr) != EGL_TRUE) return nullptr; @@ -53,7 +53,7 @@ const char* getGPUInfo() { return nullptr; } - const char* renderer = nullptr; + std::string renderer; void* lib = open_lib(gles3_lib, nullptr); if (lib) { GLES.glGetString = (const GLubyte * (*)( GLenum ))dlsym(lib, "glGetString"); diff --git a/src/main/cpp/config/gpu_utils.h b/src/main/cpp/config/gpu_utils.h index 8549a72..8884be7 100644 --- a/src/main/cpp/config/gpu_utils.h +++ b/src/main/cpp/config/gpu_utils.h @@ -6,13 +6,14 @@ #define MOBILEGLUES_PLUGIN_GPU_UTILS_H #include +#include + +std::string getGPUInfo(); #ifdef __cplusplus extern "C" { #endif -const char *getGPUInfo(); - int isAdreno(const char *gpu); int isAdreno740(const char *gpu); diff --git a/src/main/cpp/config/settings.cpp b/src/main/cpp/config/settings.cpp index 42e19f9..1c8ba5a 100644 --- a/src/main/cpp/config/settings.cpp +++ b/src/main/cpp/config/settings.cpp @@ -57,6 +57,8 @@ void init_settings() { char* var = getenv("MG_DIR_PATH"); + LOG_V("MG_DIR_PATH = %s", var ? var : "(null)") + if (fclVersion == 0 && zlVersion == 0 && pgwVersion == 0 && !var) { LOG_V("Unsupported launcher detected, force using default config.") enableANGLE = 0; @@ -68,16 +70,17 @@ void init_settings() { } // Determining actual ANGLE mode - const char* gpuString = getGPUInfo(); - LOG_D("GPU: %s", gpuString) + std::string gpuString = getGPUInfo(); + const char* gpu_cstr = gpuString.c_str(); + LOG_D("GPU: %s", gpu_cstr ? gpu_cstr : "(unknown)") if (enableANGLE == 2 || enableANGLE == 3) { // Force enable / disable global_settings.angle = enableANGLE - 2; } else { - int isQcom = isAdreno(gpuString); - int is740 = isAdreno740(gpuString); - //int is830 = isAdreno830(gpuString); + int isQcom = isAdreno(gpu_cstr); + int is740 = isAdreno740(gpu_cstr); + //int is830 = isAdreno830(gpu_cstr); int hasVk13 = hasVulkan13(); LOG_D("Is Adreno? = %s", isQcom ? "true" : "false") diff --git a/src/main/cpp/gl/multidraw.cpp b/src/main/cpp/gl/multidraw.cpp index b3eef3e..4352855 100644 --- a/src/main/cpp/gl/multidraw.cpp +++ b/src/main/cpp/gl/multidraw.cpp @@ -368,6 +368,7 @@ GLuint g_compute_program = 0; char g_compile_info[1024]; GLuint compile_compute_program(const std::string& src) { + INIT_CHECK_GL_ERROR auto program = GLES.glCreateProgram(); CHECK_GL_ERROR_NO_INIT GLuint shader = GLES.glCreateShader(GL_COMPUTE_SHADER);