aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/gles2/pixel_format.c14
-rw-r--r--render/gles2/renderer.c6
2 files changed, 16 insertions, 4 deletions
diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c
index 31bb3908..b155bbbe 100644
--- a/render/gles2/pixel_format.c
+++ b/render/gles2/pixel_format.c
@@ -98,6 +98,10 @@ static const struct wlr_gles2_pixel_format formats[] = {
// TODO: more pixel formats
+/*
+ * Return true if supported for texturing, even if other operations like
+ * reading aren't supported.
+ */
bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
const struct wlr_gles2_pixel_format *format) {
if (format->gl_type == GL_UNSIGNED_INT_2_10_10_10_REV_EXT
@@ -108,10 +112,12 @@ bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
&& !renderer->exts.OES_texture_half_float_linear) {
return false;
}
- if (format->gl_format == GL_BGRA_EXT
- && !renderer->exts.EXT_read_format_bgra) {
- return false;
- }
+ /*
+ * Note that we don't need to check for GL_EXT_texture_format_BGRA8888
+ * here, since we've already checked if we have it at renderer creation
+ * time and bailed out if not. We do the check there because Wayland
+ * requires all compositors to support SHM buffers in that format.
+ */
return true;
}
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 527d85bf..67b8ead4 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -441,6 +441,12 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
return false;
}
+ if (fmt->gl_format == GL_BGRA_EXT && !renderer->exts.EXT_read_format_bgra) {
+ wlr_log(WLR_ERROR,
+ "Cannot read pixels: missing GL_EXT_read_format_bgra extension");
+ return false;
+ }
+
const struct wlr_pixel_format_info *drm_fmt =
drm_get_pixel_format_info(fmt->drm_format);
assert(drm_fmt);