st/mesa: invalidate readpixels cache
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 9 Jun 2016 10:16:26 +0000 (12:16 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 21 Jun 2016 08:54:19 +0000 (10:54 +0200)
Whenever a draw happens or some other function call might change the result
of future glReadPixels calls, we must invalidate the cache.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
12 files changed:
src/mesa/state_tracker/st_atom_framebuffer.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_blit.c
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_cb_compute.c
src/mesa/state_tracker/st_cb_copyimage.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_drawtex.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_draw_feedback.c
src/mesa/state_tracker/st_gen_mipmap.c

index ade3d61..7d769f2 100644 (file)
@@ -113,6 +113,7 @@ update_framebuffer_state( struct st_context *st )
    GLuint i;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    st->state.fb_orientation = st_fb_orientation(fb);
 
index b4d04b4..a109120 100644 (file)
@@ -636,6 +636,8 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
    assert(width > 0);
    assert(height > 0);
 
+   st_invalidate_readpix_cache(st);
+
    if (!st->bitmap.cache) {
       init_bitmap_state(st);
    }
@@ -702,6 +704,7 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,
    st_flush_bitmap_cache(st);
 
    st_validate_state(st, ST_PIPELINE_RENDER);
+   st_invalidate_readpix_cache(st);
 
    sv = st_create_texture_sampler_view(pipe, stObj->pt);
    if (!sv) {
index be0b103..826152d 100644 (file)
@@ -97,6 +97,7 @@ st_BlitFramebuffer(struct gl_context *ctx,
 
    /* Make sure bitmap rendering has landed in the framebuffers */
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    clip.srcX0 = srcX0;
    clip.srcY0 = srcY0;
index d630664..e70cba6 100644 (file)
@@ -401,6 +401,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
    GLuint i;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    /* This makes sure the pipe has the latest scissor, etc values */
    st_validate_state( st, ST_PIPELINE_RENDER );
index 063d750..c057a78 100644 (file)
@@ -46,6 +46,7 @@ static void st_dispatch_compute_common(struct gl_context *ctx,
    struct pipe_grid_info info = { 0 };
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    if (ctx->NewState)
       _mesa_update_state(ctx);
index 8afb861..f670bd9 100644 (file)
@@ -549,6 +549,7 @@ st_CopyImageSubData(struct gl_context *ctx,
    int src_level, dst_level;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    if (src_image) {
       struct st_texture_image *src = st_texture_image(src_image);
index ae3ca7a..d2b964e 100644 (file)
@@ -1072,6 +1072,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
    assert(ctx->NewState == 0x0);
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    st_validate_state(st, ST_PIPELINE_RENDER);
 
@@ -1437,6 +1438,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
    struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    st_validate_state(st, ST_PIPELINE_RENDER);
 
index e2af235..3321e15 100644 (file)
@@ -118,6 +118,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
    unsigned offset;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    st_validate_state(st, ST_PIPELINE_RENDER);
 
index 3b870d7..088ac9e 100644 (file)
@@ -1325,6 +1325,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
    unsigned dst_level = 0;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    if (stObj->pt == stImage->pt)
       dst_level = texImage->TexObject->MinLevel + texImage->Level;
@@ -2260,6 +2261,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
    GLint srcY0, srcY1;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
           texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
@@ -2784,6 +2786,7 @@ st_ClearTexSubImage(struct gl_context *ctx,
       return;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    u_box_3d(xoffset, yoffset, zoffset + texImage->Face,
             width, height, depth, &box);
index 3db5749..d12d77f 100644 (file)
@@ -170,6 +170,7 @@ st_draw_vbo(struct gl_context *ctx,
    assert(ctx->NewState == 0x0);
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    /* Validate state. */
    if (st->dirty.st || st->dirty.mesa || ctx->NewDriverState) {
index 9f48945..e76694d 100644 (file)
@@ -139,6 +139,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
    assert(draw);
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    st_validate_state(st, ST_PIPELINE_RENDER);
 
index adf02e7..10af11e 100644 (file)
@@ -98,6 +98,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
       return;
 
    st_flush_bitmap_cache(st);
+   st_invalidate_readpix_cache(st);
 
    /* The texture isn't in a "complete" state yet so set the expected
     * lastLevel here, since it won't get done in st_finalize_texture().