aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-12-08 19:37:21 +0100
committerSimon Ser <contact@emersion.fr>2020-12-09 21:45:28 +0100
commitf91e89fd9f701781ff320f643acdb129ab4f4e55 (patch)
treea9e2879245d4aaddbbdc9ef49e98b0db14641710
parentbe8403e73d01acafbe849d92b19dc6d95c05dde0 (diff)
render/gles2: query alpha size from render buffer
If we're using a render buffer, query the alpha size from it. Closes: https://github.com/swaywm/wlroots/issues/2527
-rw-r--r--render/gles2/renderer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index bb8dab02..db313034 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -453,7 +453,12 @@ static enum wl_shm_format gles2_preferred_read_format(
pop_gles2_debug(renderer);
EGLint alpha_size = -1;
- if (renderer->egl->config != EGL_NO_CONFIG_KHR) {
+ if (renderer->current_buffer != NULL) {
+ glBindRenderbuffer(GL_RENDERBUFFER, renderer->current_buffer->rbo);
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER,
+ GL_RENDERBUFFER_ALPHA_SIZE, &alpha_size);
+ glBindRenderbuffer(GL_RENDERBUFFER, 0);
+ } else if (renderer->egl->config != EGL_NO_CONFIG_KHR) {
eglGetConfigAttrib(renderer->egl->display, renderer->egl->config,
EGL_ALPHA_SIZE, &alpha_size);
}