mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-23 11:14:14 -04:00
misc(framebuffer): avoid freeing wild pointer, fixing forge crash on startup
This commit is contained in:
parent
fdbc27510e
commit
c4539fb9e9
@ -41,13 +41,18 @@ void rebind_framebuffer(GLenum old_attachment, GLenum target_attachment) {
|
|||||||
void glBindFramebuffer(GLenum target, GLuint framebuffer) {
|
void glBindFramebuffer(GLenum target, GLuint framebuffer) {
|
||||||
LOG()
|
LOG()
|
||||||
|
|
||||||
|
INIT_CHECK_GL_ERROR
|
||||||
|
|
||||||
LOG_D("glBindFramebuffer(0x%x, %d)", target, framebuffer)
|
LOG_D("glBindFramebuffer(0x%x, %d)", target, framebuffer)
|
||||||
|
|
||||||
LOAD_GLES(glBindFramebuffer, void, GLenum target, GLuint framebuffer)
|
LOAD_GLES(glBindFramebuffer, void, GLenum target, GLuint framebuffer)
|
||||||
gles_glBindFramebuffer(target, framebuffer);
|
gles_glBindFramebuffer(target, framebuffer);
|
||||||
|
CHECK_GL_ERROR_NO_INIT
|
||||||
|
|
||||||
if (!bound_framebuffer)
|
if (!bound_framebuffer) {
|
||||||
bound_framebuffer = malloc(sizeof(struct framebuffer_t));
|
bound_framebuffer = malloc(sizeof(struct framebuffer_t));
|
||||||
|
memset(bound_framebuffer, 0, sizeof(struct framebuffer_t));
|
||||||
|
}
|
||||||
|
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case GL_DRAW_FRAMEBUFFER:
|
case GL_DRAW_FRAMEBUFFER:
|
||||||
@ -68,7 +73,7 @@ void glBindFramebuffer(GLenum target, GLuint framebuffer) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_GL_ERROR
|
CHECK_GL_ERROR_NO_INIT
|
||||||
}
|
}
|
||||||
|
|
||||||
void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
|
void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user