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.
This commit is contained in:
Manuel Stoeckl 2022-07-20 19:21:14 -04:00
parent add44b3e2e
commit 972a5cdf7a
1 changed files with 2 additions and 7 deletions

View File

@ -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);