diff options
| author | Andre Weissflog <floooh@gmail.com> | 2025-12-02 14:12:03 +0100 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2025-12-02 14:12:03 +0100 |
| commit | 1a400a26a5dae74938d13df35755427bcbd82dde (patch) | |
| tree | d1a6975081b8074e0126dc7124fa3e9dacada8bd | |
| parent | 6579577b9de45406c92a5bae9e1d64842e1bcccc (diff) | |
sokol_gfx.h gl: when clearing framebuffer slots in begin-pass, also clear the renderbuffer attachments
| -rw-r--r-- | sokol_gfx.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sokol_gfx.h b/sokol_gfx.h index 1d08c14e..c53702b3 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -10910,8 +10910,9 @@ _SOKOL_PRIVATE void _sg_gl_begin_pass(const sg_pass* pass, const _sg_attachments } } // explicitly detach unused color attachments - for (int i = atts->num_color_views; i < SG_MAX_COLOR_ATTACHMENTS; i++) { + for (int i = atts->num_color_views; i < _sg.limits.max_color_attachments; i++) { const GLenum gl_att_type = (GLenum)(GL_COLOR_ATTACHMENT0 + i); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, gl_att_type, GL_RENDERBUFFER, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, gl_att_type, GL_TEXTURE_2D, 0, 0); } if (atts->ds_view) { @@ -10925,6 +10926,7 @@ _SOKOL_PRIVATE void _sg_gl_begin_pass(const sg_pass* pass, const _sg_attachments } } else { // explicitly detach depth-stencil attachment if not used in this pass + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0); } if (!_sg_gl_check_framebuffer_status()) { |