mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-23 03:04:03 -04:00
fix(gpu_utils): do not probe GPU repeatedly
This commit is contained in:
parent
5514e010d7
commit
21957f9c49
@ -66,15 +66,15 @@ const char* getGPUInfo() {
|
|||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isAdreno740() {
|
int isAdreno740(const char* gpu) {
|
||||||
const char* gpu = getGPUInfo();
|
// const char* gpu = getGPUInfo();
|
||||||
if (!gpu)
|
if (!gpu)
|
||||||
return 0;
|
return 0;
|
||||||
return strstr(gpu, "Adreno") && strstr(gpu, "740");
|
return strstr(gpu, "Adreno") && strstr(gpu, "740");
|
||||||
}
|
}
|
||||||
|
|
||||||
int isAdreno830() {
|
int isAdreno830(const char* gpu) {
|
||||||
const char* gpu = getGPUInfo();
|
// const char* gpu = getGPUInfo();
|
||||||
if (!gpu)
|
if (!gpu)
|
||||||
return 0;
|
return 0;
|
||||||
return strstr(gpu, "Adreno") && strstr(gpu, "830");
|
return strstr(gpu, "Adreno") && strstr(gpu, "830");
|
||||||
|
@ -5,9 +5,11 @@
|
|||||||
#ifndef MOBILEGLUES_PLUGIN_GPU_UTILS_H
|
#ifndef MOBILEGLUES_PLUGIN_GPU_UTILS_H
|
||||||
#define MOBILEGLUES_PLUGIN_GPU_UTILS_H
|
#define MOBILEGLUES_PLUGIN_GPU_UTILS_H
|
||||||
|
|
||||||
int isAdreno740();
|
const char* getGPUInfo();
|
||||||
|
|
||||||
int isAdreno830();
|
int isAdreno740(const char* gpu);
|
||||||
|
|
||||||
|
int isAdreno830(const char* gpu);
|
||||||
|
|
||||||
int hasVulkan13();
|
int hasVulkan13();
|
||||||
|
|
||||||
|
@ -53,12 +53,17 @@ void init_settings() {
|
|||||||
enableExtComputeShader = 0;
|
enableExtComputeShader = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* gpu = getGPUInfo();
|
||||||
|
LOG_D("GPU: %s", gpu);
|
||||||
|
|
||||||
if (enableANGLE == 1) {
|
if (enableANGLE == 1) {
|
||||||
global_settings.angle = (isAdreno740() || !hasVulkan13()) ? 0 : 1;
|
global_settings.angle = (isAdreno740(gpu) || !hasVulkan13()) ? 0 : 1;
|
||||||
} else if (enableANGLE == 2 || enableANGLE == 3) {
|
} else if (enableANGLE == 2 || enableANGLE == 3) {
|
||||||
global_settings.angle = enableANGLE - 2;
|
global_settings.angle = enableANGLE - 2;
|
||||||
} else {
|
} else {
|
||||||
global_settings.angle = isAdreno830() ? 1 : 0;
|
int is830 = isAdreno830(gpu);
|
||||||
|
LOG_D("Is Adreno 830? = %s", is830 ? "true" : "false")
|
||||||
|
global_settings.angle = is830 ? 1 : 0;
|
||||||
}
|
}
|
||||||
if (global_settings.angle) {
|
if (global_settings.angle) {
|
||||||
setenv("LIBGL_GLES", "libGLESv2_angle.so", 1);
|
setenv("LIBGL_GLES", "libGLESv2_angle.so", 1);
|
||||||
|
@ -57,10 +57,12 @@ void show_copyright() {
|
|||||||
void load_libs();
|
void load_libs();
|
||||||
void proc_init() {
|
void proc_init() {
|
||||||
init_config();
|
init_config();
|
||||||
init_settings();
|
|
||||||
|
|
||||||
clear_log();
|
clear_log();
|
||||||
start_log();
|
start_log();
|
||||||
|
|
||||||
|
init_settings();
|
||||||
|
|
||||||
LOG_V("Initializing %s ...", RENDERERNAME);
|
LOG_V("Initializing %s ...", RENDERERNAME);
|
||||||
show_copyright();
|
show_copyright();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user