aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-06-05 18:56:12 -0400
committerIlia Mirkin <[email protected]>2016-06-06 12:05:59 -0400
commit4f1cccf570112f93265a4cace504eb763fa8f73e (patch)
tree02f70fa56af7bb0a4517c617733e2fec17d29c23
parent4163c71010479524d8c9010a78454c584ddd8629 (diff)
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 <[email protected]> Tested-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 6df3a39c053..09450c9f41b 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 */