From fdbc27510e2829c5174dcf77a253b6f7db5d5202 Mon Sep 17 00:00:00 2001 From: Tungstend Date: Fri, 7 Feb 2025 00:34:57 +0800 Subject: [PATCH] revert --- src/main/cpp/gl/framebuffer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/cpp/gl/framebuffer.c b/src/main/cpp/gl/framebuffer.c index b5b1722..894f1de 100644 --- a/src/main/cpp/gl/framebuffer.c +++ b/src/main/cpp/gl/framebuffer.c @@ -19,14 +19,12 @@ GLint getMaxDrawBuffers() { return MAX_DRAW_BUFFERS; } -void rebind_framebuffer(GLenum old_attachment, GLenum target_attachment, bool draw) { +void rebind_framebuffer(GLenum old_attachment, GLenum target_attachment) { if (!bound_framebuffer) return; - GLenum rebindTarget = draw ? GL_DRAW_FRAMEBUFFER : bound_framebuffer->current_target; - struct attachment_t* attach; - if (rebindTarget == GL_DRAW_FRAMEBUFFER) + if (bound_framebuffer->current_target == GL_DRAW_FRAMEBUFFER) attach = bound_framebuffer->draw_attachment; else attach = bound_framebuffer->read_attachment; @@ -37,7 +35,7 @@ void rebind_framebuffer(GLenum old_attachment, GLenum target_attachment, bool dr struct attachment_t attachment = attach[old_attachment - GL_COLOR_ATTACHMENT0]; LOAD_GLES(glFramebufferTexture2D, void, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) - gles_glFramebufferTexture2D(rebindTarget, target_attachment, attachment.textarget, attachment.texture, attachment.level); + gles_glFramebufferTexture2D(bound_framebuffer->current_target, target_attachment, attachment.textarget, attachment.texture, attachment.level); } void glBindFramebuffer(GLenum target, GLuint framebuffer) { @@ -155,7 +153,7 @@ void glDrawBuffers(GLsizei n, const GLenum *bufs) { if (bufs[i] >= GL_COLOR_ATTACHMENT0 && bufs[i] <= GL_COLOR_ATTACHMENT0 + getMaxDrawBuffers()) { GLenum target_attachment = GL_COLOR_ATTACHMENT0 + i; new_bufs[i] = target_attachment; - rebind_framebuffer(bufs[i], target_attachment, true); + rebind_framebuffer(bufs[i], target_attachment); } else { new_bufs[i] = bufs[i]; }