mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-18 00:23:29 -04:00
Fix(binding): bind real buffer when glBindVertexBuffer is called
This commit is contained in:
parent
9809ec5df0
commit
9c27d5f1b5
@ -13,7 +13,7 @@ GLint maxArrayId = 0;
|
||||
std::unordered_map<GLuint, GLuint> g_gen_buffers;
|
||||
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;
|
||||
|
||||
std::unordered_map<GLuint, BufferMapping> g_active_mappings;
|
||||
@ -222,6 +222,25 @@ void glBindBufferBase(GLenum target, GLuint index, GLuint buffer) {
|
||||
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) {
|
||||
LOG()
|
||||
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 glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
|
||||
|
||||
GLAPI GLAPIENTRY GLboolean glUnmapBuffer(GLenum target);
|
||||
|
||||
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, 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, 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, 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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user