From: Nicolai Hähnle Date: Thu, 9 Jun 2016 10:16:26 +0000 (+0200) Subject: st/mesa: invalidate readpixels cache X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a571859fc446a9ba106ba4586603b5a01e7cc52a;p=mesa.git st/mesa: invalidate readpixels cache 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 --- diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index ade3d61dc70..7d769f23dcb 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -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); diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index b4d04b4de5f..a1091207f3b 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -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) { diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index be0b1030996..826152dc8e4 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -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; diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index d630664704b..e70cba6f938 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -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 ); diff --git a/src/mesa/state_tracker/st_cb_compute.c b/src/mesa/state_tracker/st_cb_compute.c index 063d750d03a..c057a781026 100644 --- a/src/mesa/state_tracker/st_cb_compute.c +++ b/src/mesa/state_tracker/st_cb_compute.c @@ -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); diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c index 8afb861812f..f670bd9967e 100644 --- a/src/mesa/state_tracker/st_cb_copyimage.c +++ b/src/mesa/state_tracker/st_cb_copyimage.c @@ -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); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index ae3ca7a2033..d2b964e6614 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -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); diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index e2af2357f02..3321e15bdd3 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -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); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 3b870d77e17..088ac9e0ef6 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -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); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 3db5749725e..d12d77f5015 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -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) { diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 9f48945d74d..e76694d4b2b 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -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); diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index adf02e71fd8..10af11e17b4 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -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().