[Mesa-dev] [PATCH 6/7] st/mesa: invalidate readpixels cache
Nicolai Hähnle
nhaehnle at gmail.com
Wed Jun 15 08:38:35 UTC 2016
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
Whenever a draw happens or some other function call might change the result
of future glReadPixels calls, we must invalidate the cache.
---
src/mesa/state_tracker/st_atom_framebuffer.c | 1 +
src/mesa/state_tracker/st_cb_bitmap.c | 3 +++
src/mesa/state_tracker/st_cb_blit.c | 1 +
src/mesa/state_tracker/st_cb_clear.c | 1 +
src/mesa/state_tracker/st_cb_compute.c | 1 +
src/mesa/state_tracker/st_cb_copyimage.c | 1 +
src/mesa/state_tracker/st_cb_drawpixels.c | 2 ++
src/mesa/state_tracker/st_cb_drawtex.c | 1 +
src/mesa/state_tracker/st_cb_texture.c | 3 +++
src/mesa/state_tracker/st_draw.c | 1 +
src/mesa/state_tracker/st_draw_feedback.c | 1 +
src/mesa/state_tracker/st_gen_mipmap.c | 1 +
12 files changed, 17 insertions(+)
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index ade3d61..7d769f2 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 b4d04b4..a109120 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 a05a5af..ca58eb9 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -96,6 +96,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 362cef4..e25a35d 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -389,6 +389,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 063d750..c057a78 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 8afb861..f670bd9 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 311ba25..feb339e 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1071,6 +1071,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);
@@ -1433,6 +1434,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 e2af235..3321e15 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 3b870d7..088ac9e 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 3db5749..d12d77f 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 9f48945..e76694d 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 adf02e7..10af11e 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().
--
2.7.4
More information about the mesa-dev
mailing list