mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-22 10:42:11 -04:00
[Fix] (settings): fix some wild pointer bugs
This commit is contained in:
parent
8727ed43fd
commit
5e46d9e26a
@ -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");
|
||||
|
@ -6,13 +6,14 @@
|
||||
#define MOBILEGLUES_PLUGIN_GPU_UTILS_H
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
std::string getGPUInfo();
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const char *getGPUInfo();
|
||||
|
||||
int isAdreno(const char *gpu);
|
||||
|
||||
int isAdreno740(const char *gpu);
|
||||
|
@ -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")
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user