Mesa (master): st/mesa: check shader image format support before using PBO download

Ilia Mirkin imirkin at kemper.freedesktop.org
Mon Jun 6 16:07:01 UTC 2016


Module: Mesa
Branch: master
Commit: 4f1cccf570112f93265a4cace504eb763fa8f73e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f1cccf570112f93265a4cace504eb763fa8f73e

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sun Jun  5 18:56:12 2016 -0400

st/mesa: check shader image format support before using PBO download

ARB_shader_image_load_store only requires a very fixed list of formats
to be supported, while textures may be in all kinds of formats, like
BGRA which are presently not supported on at least Kepler.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Tested-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/state_tracker/st_cb_readpixels.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 6df3a39..09450c9 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -79,6 +79,7 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
                    const struct gl_pixelstore_attrib *pack, void *pixels)
 {
    struct pipe_context *pipe = st->pipe;
+   struct pipe_screen *screen = pipe->screen;
    struct cso_context *cso = st->cso_context;
    struct pipe_surface *surface = strb->surface;
    struct pipe_resource *texture = strb->texture;
@@ -91,6 +92,11 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
    if (texture->nr_samples > 1)
       return false;
 
+   if (!screen->is_format_supported(screen, dst_format, PIPE_TEXTURE_2D,
+                                    texture->nr_samples,
+                                    PIPE_BIND_SHADER_IMAGE))
+      return false;
+
    desc = util_format_description(dst_format);
 
    /* Compute PBO addresses */




More information about the mesa-commit mailing list