aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2022-07-20 19:21:14 -0400
committerManuel Stoeckl <code@mstoeckl.com>2022-07-20 20:02:46 -0400
commit972a5cdf7a9701a266119d60da48624ca8ebf703 (patch)
treef3bc545a48c836001f78272bca9ea8a01a0bb57c
parentadd44b3e2e4ff7ef98b16813fb3c9e1d8b398008 (diff)
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.
-rw-r--r--render/gles2/renderer.c9
1 files changed, 2 insertions, 7 deletions
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);