mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-24 03:31:43 -04:00
misc: add more log, add glBindBuffer as native func
This commit is contained in:
parent
6d99a30b0d
commit
8f1e781cb7
@ -79,28 +79,85 @@ GLAPI GLAPIENTRY void glFramebufferTexture2D(GLenum target, GLenum attachment, G
|
||||
GLbitfield gl_to_es_access(GLenum access) {
|
||||
switch (access) {
|
||||
case GL_READ_ONLY:
|
||||
LOG_V("GL_READ_ONLY -> GL_MAP_READ_BIT");
|
||||
return GL_MAP_READ_BIT;
|
||||
case GL_WRITE_ONLY:
|
||||
LOG_V("GL_WRITE_ONLY -> GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT");
|
||||
return GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT;
|
||||
case GL_READ_WRITE:
|
||||
LOG_V("GL_READ_WRITE -> GL_MAP_READ_BIT | GL_MAP_WRITE_BIT");
|
||||
return GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
|
||||
default:
|
||||
LOG_E("Invalid glMapBuffer access parameter!");
|
||||
LOG_E("Invalid glMapBuffer access parameter: 0x%x!", access);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access) {
|
||||
LOG();
|
||||
LOAD_GLES(glGetBufferParameteriv,void, GLenum target, GLenum pname, GLint* params);
|
||||
LOAD_GLES(glMapBufferRange,void*, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
|
||||
|
||||
GLint buffer_size = 0;
|
||||
gles_glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &buffer_size);
|
||||
gles_glGetBufferParameteriv(target, GL_BUFFER_SIZE, &buffer_size);
|
||||
|
||||
GLbitfield flags = gl_to_es_access(GL_STATIC_DRAW);
|
||||
GLbitfield flags = gl_to_es_access(access);
|
||||
if (flags == 0) {
|
||||
flags = GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT;
|
||||
}
|
||||
void* ptr = gles_glMapBufferRange(target, 0, buffer_size, flags);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
//NATIVE_FUNCTION_HEAD(void,glBufferData,GLenum target, GLsizeiptr size, const void* data, GLenum usage); NATIVE_FUNCTION_END_NO_RETURN(void,glBufferData,target,size,data,usage)
|
||||
|
||||
__attribute__((visibility("default")))void
|
||||
glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) {
|
||||
LOG_D("glBufferData(0x%x, %ld, 0x%lx, 0x%x)", target, size, data, usage);
|
||||
|
||||
typedef void(*glBufferData_PTR)(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
glBufferData_PTR gles_glBufferData = ((void *) 0);
|
||||
__android_log_print(ANDROID_LOG_DEBUG, "MobileGlues", "Use native function: %s @ %s(...)",
|
||||
"MobileGlues", __func__);;
|
||||
{
|
||||
static _Bool first = 1;
|
||||
if (first) {
|
||||
first = 0;
|
||||
if (gles != ((void *) 0)) {
|
||||
gles_glBufferData = (glBufferData_PTR) proc_address(gles, "glBufferData");
|
||||
}
|
||||
if (gles_glBufferData == ((void *) 0)) {
|
||||
__android_log_print(ANDROID_LOG_WARN, "MobileGlues",
|
||||
"%s line %d function %s: " "gles_glBufferData" " is NULL\n",
|
||||
"_file_name_", 112, "_function_name_");;
|
||||
};
|
||||
}
|
||||
};
|
||||
gles_glBufferData(target, size, data, usage);
|
||||
typedef GLenum(*glGetError_PTR)();
|
||||
glGetError_PTR gles_glGetError = ((void *) 0);
|
||||
{
|
||||
static _Bool first = 1;
|
||||
if (first) {
|
||||
first = 0;
|
||||
if (gles != ((void *) 0)) {
|
||||
gles_glGetError = (glGetError_PTR) proc_address(gles, "glGetError");
|
||||
}
|
||||
if (gles_glGetError == ((void *) 0)) {
|
||||
__android_log_print(ANDROID_LOG_WARN, "MobileGlues",
|
||||
"%s line %d function %s: " "gles_glGetError" " is NULL\n",
|
||||
"_file_name_", 112, "_function_name_");;
|
||||
};
|
||||
}
|
||||
}
|
||||
GLenum ERR = gles_glGetError();
|
||||
if (ERR != 0)__android_log_print(ANDROID_LOG_ERROR, "MobileGlues", "ERROR: %d", ERR);
|
||||
|
||||
}
|
||||
|
||||
//GLAPI void APIENTRY glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) {
|
||||
// LOG();
|
||||
// LOAD_GLES(glBufferData, void, GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
// LOG_D("glBufferData(0x%x, %ld, 0x%lx, 0x%x)", target, size, data, usage);
|
||||
// gles_glBufferData(target, size, data, usage);
|
||||
//}
|
||||
|
@ -633,6 +633,7 @@ NATIVE_FUNCTION_HEAD(void, glDisablei,GLenum target, GLuint index) NATIVE_FUNCTI
|
||||
NATIVE_FUNCTION_HEAD(GLboolean, glIsEnabledi,GLenum target, GLuint index) NATIVE_FUNCTION_END(GLboolean,glIsEnabledi,target,index)
|
||||
NATIVE_FUNCTION_HEAD(void, glBeginTransformFeedback,GLenum primitiveMode) NATIVE_FUNCTION_END_NO_RETURN(void,glBeginTransformFeedback,primitiveMode)
|
||||
NATIVE_FUNCTION_HEAD(void, glEndTransformFeedback,void ) NATIVE_FUNCTION_END_NO_RETURN(void,glEndTransformFeedback)
|
||||
NATIVE_FUNCTION_HEAD(void, glBindBuffer,GLenum target,GLuint buffer) NATIVE_FUNCTION_END_NO_RETURN(void,glBindBuffer,target,buffer)
|
||||
NATIVE_FUNCTION_HEAD(void, glBindBufferRange,GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) NATIVE_FUNCTION_END_NO_RETURN(void,glBindBufferRange,target,index,buffer,offset,size)
|
||||
NATIVE_FUNCTION_HEAD(void, glBindBufferBase,GLenum target, GLuint index, GLuint buffer) NATIVE_FUNCTION_END_NO_RETURN(void,glBindBufferBase,target,index,buffer)
|
||||
NATIVE_FUNCTION_HEAD(void, glTransformFeedbackVaryings,GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode) NATIVE_FUNCTION_END_NO_RETURN(void,glTransformFeedbackVaryings,program,count,varyings,bufferMode)
|
||||
@ -897,7 +898,7 @@ NATIVE_FUNCTION_HEAD(void,glGetQueryObjectuiv,GLuint id, GLenum pname, GLuint* p
|
||||
NATIVE_FUNCTION_HEAD(void,glDeleteBuffers,GLsizei n, const GLuint* buffers); NATIVE_FUNCTION_END_NO_RETURN(void,glDeleteBuffers,n,buffers)
|
||||
NATIVE_FUNCTION_HEAD(void,glGenBuffers,GLsizei n, GLuint* buffers); NATIVE_FUNCTION_END_NO_RETURN(void,glGenBuffers,n,buffers)
|
||||
NATIVE_FUNCTION_HEAD(GLboolean,glIsBuffer,GLuint buffer); NATIVE_FUNCTION_END_NO_RETURN(GLboolean,glIsBuffer,buffer)
|
||||
NATIVE_FUNCTION_HEAD(void,glBufferData,GLenum target, GLsizeiptr size, const void* data, GLenum usage); NATIVE_FUNCTION_END_NO_RETURN(void,glBufferData,target,size,data,usage)
|
||||
//NATIVE_FUNCTION_HEAD(void,glBufferData,GLenum target, GLsizeiptr size, const void* data, GLenum usage); NATIVE_FUNCTION_END_NO_RETURN(void,glBufferData,target,size,data,usage)
|
||||
NATIVE_FUNCTION_HEAD(void,glBufferSubData,GLenum target, GLintptr offset, GLsizeiptr size, const void* data); NATIVE_FUNCTION_END_NO_RETURN(void,glBufferSubData,target,offset,size,data)
|
||||
NATIVE_FUNCTION_HEAD(void,glGetBufferSubData,GLenum target, GLintptr offset, GLsizeiptr size, void* data); NATIVE_FUNCTION_END_NO_RETURN(void,glGetBufferSubData,target,offset,size,data)
|
||||
NATIVE_FUNCTION_HEAD(GLboolean,glUnmapBuffer,GLenum target); NATIVE_FUNCTION_END_NO_RETURN(GLboolean,glUnmapBuffer,target)
|
||||
|
Loading…
x
Reference in New Issue
Block a user