[Mesa-dev] [PATCH 4/5] st/mesa: set blend state for PBO readbacks

Marek Olšák maraeo at gmail.com
Thu Feb 23 00:22:02 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

v2: restore the state

Cc: 13.0 17.0 <mesa-stable at lists.freedesktop.org>
---
 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 5ce2421..78ea0c7 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -124,20 +124,21 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
    addr.yoffset = y;
    addr.width = width;
    addr.height = height;
    addr.depth = 1;
    if (!st_pbo_addresses_pixelstore(st, GL_TEXTURE_2D, false, pack, pixels, &addr))
       return false;
 
    cso_save_state(cso, (CSO_BIT_FRAGMENT_SAMPLER_VIEWS |
                         CSO_BIT_FRAGMENT_SAMPLERS |
                         CSO_BIT_FRAGMENT_IMAGE0 |
+                        CSO_BIT_BLEND |
                         CSO_BIT_VERTEX_ELEMENTS |
                         CSO_BIT_AUX_VERTEX_BUFFER_SLOT |
                         CSO_BIT_FRAMEBUFFER |
                         CSO_BIT_VIEWPORT |
                         CSO_BIT_RASTERIZER |
                         CSO_BIT_DEPTH_STENCIL_ALPHA |
                         CSO_BIT_STREAM_OUTPUTS |
                         CSO_BIT_PAUSE_QUERIES |
                         CSO_BIT_SAMPLE_MASK |
                         CSO_BIT_MIN_SAMPLES |
@@ -206,20 +207,25 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
    }
 
    /* Set up no-attachment framebuffer */
    memset(&fb, 0, sizeof(fb));
    fb.width = surface->width;
    fb.height = surface->height;
    fb.samples = 1;
    fb.layers = 1;
    cso_set_framebuffer(cso, &fb);
 
+   /* Any blend state would do. Set this just to prevent drivers having
+    * blend == NULL.
+    */
+   cso_set_blend(cso, &st->pbo.upload_blend);
+
    cso_set_viewport_dims(cso, fb.width, fb.height, invert_y);
 
    if (invert_y)
       st_pbo_addresses_invert_y(&addr, fb.height);
 
    {
       struct pipe_depth_stencil_alpha_state dsa;
       memset(&dsa, 0, sizeof(dsa));
       cso_set_depth_stencil_alpha(cso, &dsa);
    }
-- 
2.7.4



More information about the mesa-dev mailing list