From 972a5cdf7a9701a266119d60da48624ca8ebf703 Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Wed, 20 Jul 2022 19:21:14 -0400 Subject: render/gles2: simplify alpha depth check GL_ALPHA_BITS is the number of bits of the alpha channel of the currently bound frame buffer's color buffer -- which is precisely renderer->current_buffer->rbo . Thus, instead of binding the color buffer and checking its properties, we can query the already bound frame buffer. Note that GL_IMPLEMENTATION_COLOR_READ_{FORMAT,TYPE} are also properties of frame buffer's color buffer. --- render/gles2/renderer.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'render/gles2') diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 5a2f31b5..c00a7f51 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -395,15 +395,10 @@ static uint32_t gles2_preferred_read_format( push_gles2_debug(renderer); - GLint gl_format = -1, gl_type = -1; + GLint gl_format = -1, gl_type = -1, alpha_size = -1; glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_format); glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_type); - - EGLint alpha_size = -1; - glBindRenderbuffer(GL_RENDERBUFFER, renderer->current_buffer->rbo); - glGetRenderbufferParameteriv(GL_RENDERBUFFER, - GL_RENDERBUFFER_ALPHA_SIZE, &alpha_size); - glBindRenderbuffer(GL_RENDERBUFFER, 0); + glGetIntegerv(GL_ALPHA_BITS, &alpha_size); pop_gles2_debug(renderer); -- cgit v1.2.3