mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-23 03:04:03 -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);
|
EGLDisplay eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
if (eglDisplay == EGL_NO_DISPLAY || eglInitialize(eglDisplay, nullptr, nullptr) != EGL_TRUE)
|
if (eglDisplay == EGL_NO_DISPLAY || eglInitialize(eglDisplay, nullptr, nullptr) != EGL_TRUE)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -53,7 +53,7 @@ const char* getGPUInfo() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* renderer = nullptr;
|
std::string renderer;
|
||||||
void* lib = open_lib(gles3_lib, nullptr);
|
void* lib = open_lib(gles3_lib, nullptr);
|
||||||
if (lib) {
|
if (lib) {
|
||||||
GLES.glGetString = (const GLubyte * (*)( GLenum ))dlsym(lib, "glGetString");
|
GLES.glGetString = (const GLubyte * (*)( GLenum ))dlsym(lib, "glGetString");
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
#define MOBILEGLUES_PLUGIN_GPU_UTILS_H
|
#define MOBILEGLUES_PLUGIN_GPU_UTILS_H
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
std::string getGPUInfo();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *getGPUInfo();
|
|
||||||
|
|
||||||
int isAdreno(const char *gpu);
|
int isAdreno(const char *gpu);
|
||||||
|
|
||||||
int isAdreno740(const char *gpu);
|
int isAdreno740(const char *gpu);
|
||||||
|
@ -57,6 +57,8 @@ void init_settings() {
|
|||||||
|
|
||||||
char* var = getenv("MG_DIR_PATH");
|
char* var = getenv("MG_DIR_PATH");
|
||||||
|
|
||||||
|
LOG_V("MG_DIR_PATH = %s", var ? var : "(null)")
|
||||||
|
|
||||||
if (fclVersion == 0 && zlVersion == 0 && pgwVersion == 0 && !var) {
|
if (fclVersion == 0 && zlVersion == 0 && pgwVersion == 0 && !var) {
|
||||||
LOG_V("Unsupported launcher detected, force using default config.")
|
LOG_V("Unsupported launcher detected, force using default config.")
|
||||||
enableANGLE = 0;
|
enableANGLE = 0;
|
||||||
@ -68,16 +70,17 @@ void init_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determining actual ANGLE mode
|
// Determining actual ANGLE mode
|
||||||
const char* gpuString = getGPUInfo();
|
std::string gpuString = getGPUInfo();
|
||||||
LOG_D("GPU: %s", gpuString)
|
const char* gpu_cstr = gpuString.c_str();
|
||||||
|
LOG_D("GPU: %s", gpu_cstr ? gpu_cstr : "(unknown)")
|
||||||
|
|
||||||
if (enableANGLE == 2 || enableANGLE == 3) {
|
if (enableANGLE == 2 || enableANGLE == 3) {
|
||||||
// Force enable / disable
|
// Force enable / disable
|
||||||
global_settings.angle = enableANGLE - 2;
|
global_settings.angle = enableANGLE - 2;
|
||||||
} else {
|
} else {
|
||||||
int isQcom = isAdreno(gpuString);
|
int isQcom = isAdreno(gpu_cstr);
|
||||||
int is740 = isAdreno740(gpuString);
|
int is740 = isAdreno740(gpu_cstr);
|
||||||
//int is830 = isAdreno830(gpuString);
|
//int is830 = isAdreno830(gpu_cstr);
|
||||||
int hasVk13 = hasVulkan13();
|
int hasVk13 = hasVulkan13();
|
||||||
|
|
||||||
LOG_D("Is Adreno? = %s", isQcom ? "true" : "false")
|
LOG_D("Is Adreno? = %s", isQcom ? "true" : "false")
|
||||||
|
@ -368,6 +368,7 @@ GLuint g_compute_program = 0;
|
|||||||
char g_compile_info[1024];
|
char g_compile_info[1024];
|
||||||
|
|
||||||
GLuint compile_compute_program(const std::string& src) {
|
GLuint compile_compute_program(const std::string& src) {
|
||||||
|
INIT_CHECK_GL_ERROR
|
||||||
auto program = GLES.glCreateProgram();
|
auto program = GLES.glCreateProgram();
|
||||||
CHECK_GL_ERROR_NO_INIT
|
CHECK_GL_ERROR_NO_INIT
|
||||||
GLuint shader = GLES.glCreateShader(GL_COMPUTE_SHADER);
|
GLuint shader = GLES.glCreateShader(GL_COMPUTE_SHADER);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user