mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-10 04:29:00 -04:00
Merge branch 'dev-es' into debug
This commit is contained in:
commit
5d80a28c05
@ -177,6 +177,6 @@ int hasVulkan13() {
|
|||||||
|
|
||||||
vkDestroyInstance(instance, nullptr);
|
vkDestroyInstance(instance, nullptr);
|
||||||
|
|
||||||
dlclose(vk_lib);
|
dlclose(vulkan_lib);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -64,7 +64,7 @@ void init_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* gpuString = getGPUInfo();
|
const char* gpuString = getGPUInfo();
|
||||||
LOG_D("GPU: %s", gpuString);
|
LOG_D("GPU: %s", gpuString)
|
||||||
|
|
||||||
if (enableANGLE == 2 || enableANGLE == 3) {
|
if (enableANGLE == 2 || enableANGLE == 3) {
|
||||||
// Force enable / disable
|
// Force enable / disable
|
||||||
@ -72,16 +72,16 @@ void init_settings() {
|
|||||||
} else {
|
} else {
|
||||||
int isQcom = isAdreno(gpuString);
|
int isQcom = isAdreno(gpuString);
|
||||||
int is740 = isAdreno740(gpuString);
|
int is740 = isAdreno740(gpuString);
|
||||||
int is830 = isAdreno830(gpuString);
|
//int is830 = isAdreno830(gpuString);
|
||||||
int hasVk13 = false;
|
int hasVk13 = hasVulkan13();
|
||||||
|
|
||||||
LOG_D("Is Adreno? = %s", isQcom ? "true" : "false")
|
LOG_D("Is Adreno? = %s", isQcom ? "true" : "false")
|
||||||
LOG_D("Is Adreno 830? = %s", is830 ? "true" : "false")
|
//LOG_D("Is Adreno 830? = %s", is830 ? "true" : "false")
|
||||||
LOG_D("Is Adreno 740? = %s", is740 ? "true" : "false")
|
LOG_D("Is Adreno 740? = %s", is740 ? "true" : "false")
|
||||||
LOG_D("Has Vulkan 1.3? = %s", hasVk13 ? "true" : "false")
|
LOG_D("Has Vulkan 1.3? = %s", hasVk13 ? "true" : "false")
|
||||||
|
|
||||||
if (is830)
|
//if (is830)
|
||||||
global_settings.angle = 1;
|
// global_settings.angle = 1;
|
||||||
if (is740)
|
if (is740)
|
||||||
global_settings.angle = 0;
|
global_settings.angle = 0;
|
||||||
else
|
else
|
||||||
@ -116,9 +116,14 @@ void init_settings() {
|
|||||||
|
|
||||||
global_settings.ext_compute_shader = enableExtComputeShader;
|
global_settings.ext_compute_shader = enableExtComputeShader;
|
||||||
|
|
||||||
global_settings.maxGlslCacheSize = maxGlslCacheSize;
|
global_settings.max_glsl_cache_size = maxGlslCacheSize;
|
||||||
|
|
||||||
global_settings.enableCompatibleMode = enableCompatibleMode;
|
global_settings.enable_compatible_mode = enableCompatibleMode;
|
||||||
|
|
||||||
LOG_D("settings initialized")
|
LOG_V("[MobileGlues] Setting: enableAngle = %s", global_settings.angle ? "true" : "false")
|
||||||
|
LOG_V("[MobileGlues] Setting: ignoreError = %i", global_settings.ignore_error)
|
||||||
|
LOG_V("[MobileGlues] Setting: enableExtComputeShader = %s", global_settings.ext_compute_shader ? "true" : "false")
|
||||||
|
LOG_V("[MobileGlues] Setting: enableExtGL43 = %s", global_settings.ext_gl43 ? "true" : "false")
|
||||||
|
LOG_V("[MobileGlues] Setting: maxGlslCacheSize = %i", global_settings.max_glsl_cache_size / 1024 / 1024)
|
||||||
|
LOG_V("[MobileGlues] Setting: enableCompatibleMode = %s", global_settings.enable_compatible_mode ? "true" : "false")
|
||||||
}
|
}
|
@ -16,8 +16,8 @@ struct global_settings_t {
|
|||||||
int ignore_error; // 0, 1, 2
|
int ignore_error; // 0, 1, 2
|
||||||
int ext_gl43; // 0, 1
|
int ext_gl43; // 0, 1
|
||||||
int ext_compute_shader; // 0, 1
|
int ext_compute_shader; // 0, 1
|
||||||
size_t maxGlslCacheSize; // 0~
|
size_t max_glsl_cache_size; // 0~
|
||||||
int enableCompatibleMode; // 0, 1
|
int enable_compatible_mode; // 0, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct global_settings_t global_settings;
|
extern struct global_settings_t global_settings;
|
||||||
|
@ -13,7 +13,7 @@ GLint maxArrayId = 0;
|
|||||||
std::unordered_map<GLuint, GLuint> g_gen_buffers;
|
std::unordered_map<GLuint, GLuint> g_gen_buffers;
|
||||||
std::unordered_map<GLuint, GLuint> g_gen_arrays;
|
std::unordered_map<GLuint, GLuint> g_gen_arrays;
|
||||||
|
|
||||||
std::unordered_map<GLenum , GLuint> g_bound_buffers;
|
std::unordered_map<GLenum, GLuint> g_bound_buffers;
|
||||||
GLuint bound_array = 0;
|
GLuint bound_array = 0;
|
||||||
|
|
||||||
std::unordered_map<GLuint, BufferMapping> g_active_mappings;
|
std::unordered_map<GLuint, BufferMapping> g_active_mappings;
|
||||||
@ -222,6 +222,25 @@ void glBindBufferBase(GLenum target, GLuint index, GLuint buffer) {
|
|||||||
CHECK_GL_ERROR
|
CHECK_GL_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) {
|
||||||
|
LOG()
|
||||||
|
LOG_D("glBindVertexBuffer, bindingindex = %d, buffer = %d, offset = %p, stride = %i", bindingindex, buffer, offset, stride)
|
||||||
|
// Todo: should record fake buffer binding here, when glGetVertexArrayIntegeri_v is called, should return fake buffer id
|
||||||
|
if (!has_buffer(buffer) || buffer == 0) {
|
||||||
|
GLES.glBindVertexBuffer(bindingindex, buffer, offset, stride);
|
||||||
|
CHECK_GL_ERROR
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GLuint real_buffer = find_real_buffer(buffer);
|
||||||
|
if (!real_buffer) {
|
||||||
|
GLES.glGenBuffers(1, &real_buffer);
|
||||||
|
modify_buffer(buffer, real_buffer);
|
||||||
|
CHECK_GL_ERROR
|
||||||
|
}
|
||||||
|
GLES.glBindVertexBuffer(bindingindex, real_buffer, offset, stride);
|
||||||
|
CHECK_GL_ERROR
|
||||||
|
}
|
||||||
|
|
||||||
void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) {
|
void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) {
|
||||||
LOG()
|
LOG()
|
||||||
LOG_D("glBufferData, target = %s, size = %d, data = 0x%x, usage = %s",
|
LOG_D("glBufferData, target = %s, size = %d, data = 0x%x, usage = %s",
|
||||||
|
@ -67,6 +67,8 @@ GLAPI GLAPIENTRY void glBindBufferRange(GLenum target, GLuint index, GLuint buff
|
|||||||
|
|
||||||
GLAPI GLAPIENTRY void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
|
GLAPI GLAPIENTRY void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
|
||||||
|
|
||||||
|
GLAPI GLAPIENTRY void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
|
||||||
|
|
||||||
GLAPI GLAPIENTRY GLboolean glUnmapBuffer(GLenum target);
|
GLAPI GLAPIENTRY GLboolean glUnmapBuffer(GLenum target);
|
||||||
|
|
||||||
GLAPI GLAPIENTRY void *glMapBuffer(GLenum target, GLenum access);
|
GLAPI GLAPIENTRY void *glMapBuffer(GLenum target, GLenum access);
|
||||||
|
@ -318,7 +318,7 @@ NATIVE_FUNCTION_HEAD(void, glGetMultisamplefv, GLenum pname, GLuint index, GLflo
|
|||||||
NATIVE_FUNCTION_HEAD(void, glSampleMaski, GLuint maskNumber, GLbitfield mask) NATIVE_FUNCTION_END_NO_RETURN(void, glSampleMaski, maskNumber,mask)
|
NATIVE_FUNCTION_HEAD(void, glSampleMaski, GLuint maskNumber, GLbitfield mask) NATIVE_FUNCTION_END_NO_RETURN(void, glSampleMaski, maskNumber,mask)
|
||||||
//NATIVE_FUNCTION_HEAD(void, glGetTexLevelParameteriv, GLenum target, GLint level, GLenum pname, GLint *params) NATIVE_FUNCTION_END_NO_RETURN(void, glGetTexLevelParameteriv, target,level,pname,params)
|
//NATIVE_FUNCTION_HEAD(void, glGetTexLevelParameteriv, GLenum target, GLint level, GLenum pname, GLint *params) NATIVE_FUNCTION_END_NO_RETURN(void, glGetTexLevelParameteriv, target,level,pname,params)
|
||||||
//NATIVE_FUNCTION_HEAD(void, glGetTexLevelParameterfv, GLenum target, GLint level, GLenum pname, GLfloat *params) NATIVE_FUNCTION_END_NO_RETURN(void, glGetTexLevelParameterfv, target,level,pname,params)
|
//NATIVE_FUNCTION_HEAD(void, glGetTexLevelParameterfv, GLenum target, GLint level, GLenum pname, GLfloat *params) NATIVE_FUNCTION_END_NO_RETURN(void, glGetTexLevelParameterfv, target,level,pname,params)
|
||||||
NATIVE_FUNCTION_HEAD(void, glBindVertexBuffer, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) NATIVE_FUNCTION_END_NO_RETURN(void, glBindVertexBuffer, bindingindex,buffer,offset,stride)
|
//NATIVE_FUNCTION_HEAD(void, glBindVertexBuffer, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) NATIVE_FUNCTION_END_NO_RETURN(void, glBindVertexBuffer, bindingindex,buffer,offset,stride)
|
||||||
NATIVE_FUNCTION_HEAD(void, glVertexAttribFormat, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) NATIVE_FUNCTION_END_NO_RETURN(void, glVertexAttribFormat, attribindex,size,type,normalized,relativeoffset)
|
NATIVE_FUNCTION_HEAD(void, glVertexAttribFormat, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) NATIVE_FUNCTION_END_NO_RETURN(void, glVertexAttribFormat, attribindex,size,type,normalized,relativeoffset)
|
||||||
NATIVE_FUNCTION_HEAD(void, glVertexAttribIFormat, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) NATIVE_FUNCTION_END_NO_RETURN(void, glVertexAttribIFormat, attribindex,size,type,relativeoffset)
|
NATIVE_FUNCTION_HEAD(void, glVertexAttribIFormat, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) NATIVE_FUNCTION_END_NO_RETURN(void, glVertexAttribIFormat, attribindex,size,type,relativeoffset)
|
||||||
NATIVE_FUNCTION_HEAD(void, glVertexAttribBinding, GLuint attribindex, GLuint bindingindex) NATIVE_FUNCTION_END_NO_RETURN(void, glVertexAttribBinding, attribindex,bindingindex)
|
NATIVE_FUNCTION_HEAD(void, glVertexAttribBinding, GLuint attribindex, GLuint bindingindex) NATIVE_FUNCTION_END_NO_RETURN(void, glVertexAttribBinding, attribindex,bindingindex)
|
||||||
|
@ -103,7 +103,7 @@ Cache::Cache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* Cache::get(const char* glsl) {
|
const char* Cache::get(const char* glsl) {
|
||||||
if (global_settings.maxGlslCacheSize <= 0)
|
if (global_settings.max_glsl_cache_size <= 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
auto hash = computeSHA256(glsl);
|
auto hash = computeSHA256(glsl);
|
||||||
auto it = cacheMap.find(hash);
|
auto it = cacheMap.find(hash);
|
||||||
@ -114,7 +114,7 @@ const char* Cache::get(const char* glsl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Cache::put(const char* glsl, const char* essl) {
|
void Cache::put(const char* glsl, const char* essl) {
|
||||||
if (global_settings.maxGlslCacheSize <= 0)
|
if (global_settings.max_glsl_cache_size <= 0)
|
||||||
return;
|
return;
|
||||||
auto hash = computeSHA256(glsl);
|
auto hash = computeSHA256(glsl);
|
||||||
size_t esslStrSize = strlen(essl) + 1;
|
size_t esslStrSize = strlen(essl) + 1;
|
||||||
@ -137,9 +137,9 @@ void Cache::put(const char* glsl, const char* essl) {
|
|||||||
|
|
||||||
|
|
||||||
void Cache::maintainCacheSize() {
|
void Cache::maintainCacheSize() {
|
||||||
if (global_settings.maxGlslCacheSize <= 0)
|
if (global_settings.max_glsl_cache_size <= 0)
|
||||||
return;
|
return;
|
||||||
while (cacheSize > global_settings.maxGlslCacheSize && !cacheList.empty()) {
|
while (cacheSize > global_settings.max_glsl_cache_size && !cacheList.empty()) {
|
||||||
const auto& oldEntry = cacheList.front();
|
const auto& oldEntry = cacheList.front();
|
||||||
size_t removedMemory = sizeof(CacheEntry::sha256) + sizeof(size_t) + oldEntry.size;
|
size_t removedMemory = sizeof(CacheEntry::sha256) + sizeof(size_t) + oldEntry.size;
|
||||||
cacheSize -= removedMemory;
|
cacheSize -= removedMemory;
|
||||||
@ -190,7 +190,7 @@ bool Cache::load() {
|
|||||||
|
|
||||||
|
|
||||||
void Cache::save() {
|
void Cache::save() {
|
||||||
if (global_settings.maxGlslCacheSize <= 0)
|
if (global_settings.max_glsl_cache_size <= 0)
|
||||||
return;
|
return;
|
||||||
ofstream file(glsl_cache_file_path, ios::binary);
|
ofstream file(glsl_cache_file_path, ios::binary);
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
@ -59,7 +59,7 @@ void internal_convert(GLenum* internal_format, GLenum* type, GLenum* format) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GL_DEPTH_COMPONENT:
|
case GL_DEPTH_COMPONENT:
|
||||||
// TODO: Add enableCompatibleMode option
|
// TODO: Add enable_compatible_mode option
|
||||||
LOG_D("Find GL_DEPTH_COMPONENT: internalFormat: %s, format: %s, type: %s", glEnumToString(*internal_format), glEnumToString(*format), glEnumToString(*type))
|
LOG_D("Find GL_DEPTH_COMPONENT: internalFormat: %s, format: %s, type: %s", glEnumToString(*internal_format), glEnumToString(*format), glEnumToString(*type))
|
||||||
if(type) {
|
if(type) {
|
||||||
*type = GL_UNSIGNED_INT;
|
*type = GL_UNSIGNED_INT;
|
||||||
|
@ -67,11 +67,11 @@ void proc_init() {
|
|||||||
clear_log();
|
clear_log();
|
||||||
start_log();
|
start_log();
|
||||||
|
|
||||||
init_settings();
|
|
||||||
|
|
||||||
LOG_V("Initializing %s ...", RENDERERNAME);
|
LOG_V("Initializing %s ...", RENDERERNAME);
|
||||||
show_license();
|
show_license();
|
||||||
|
|
||||||
|
init_settings();
|
||||||
|
|
||||||
load_libs();
|
load_libs();
|
||||||
init_target_egl();
|
init_target_egl();
|
||||||
init_target_gles();
|
init_target_gles();
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#define MAJOR 1
|
#define MAJOR 1
|
||||||
#define MINOR 2
|
#define MINOR 2
|
||||||
#define REVISION 1
|
#define REVISION 2
|
||||||
#define PATCH 0
|
#define PATCH 0
|
||||||
|
|
||||||
#define VERSION_TYPE VERSION_RELEASE
|
#define VERSION_TYPE VERSION_RELEASE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user