From b6bcf0864138787c21b19cda3749c80c6ad74604 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 Jan 2016 18:28:57 -0700 Subject: [PATCH] st/mesa: move bitmap cache flushing out of state validation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Just do it where needed (before drawing, clearing, etc). Reviewed-by: José Fonseca --- src/mesa/state_tracker/st_atom.c | 4 ---- src/mesa/state_tracker/st_cb_clear.c | 3 +++ src/mesa/state_tracker/st_cb_drawpixels.c | 5 +++++ src/mesa/state_tracker/st_cb_drawtex.c | 3 +++ src/mesa/state_tracker/st_draw.c | 3 +++ src/mesa/state_tracker/st_draw_feedback.c | 3 +++ 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index c1a9d00969f..337213c1b80 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -33,7 +33,6 @@ #include "pipe/p_defines.h" #include "st_context.h" #include "st_atom.h" -#include "st_cb_bitmap.h" #include "st_program.h" #include "st_manager.h" @@ -181,9 +180,6 @@ void st_validate_state( struct st_context *st ) check_attrib_edgeflag(st); - if (state->mesa) - st_flush_bitmap_cache(st); - check_program_state( st ); st_manager_validate_framebuffers(st); diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index e09f5ec6a0b..7b6d10e76b1 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -41,6 +41,7 @@ #include "program/prog_instruction.h" #include "st_context.h" #include "st_atom.h" +#include "st_cb_bitmap.h" #include "st_cb_clear.h" #include "st_cb_fbo.h" #include "st_format.h" @@ -466,6 +467,8 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) GLbitfield clear_buffers = 0x0; GLuint i; + st_flush_bitmap_cache(st); + /* This makes sure the pipe has the latest scissor, etc values */ st_validate_state( st ); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 86e8a55e25e..7ed52dd2600 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -50,6 +50,7 @@ #include "st_atom.h" #include "st_atom_constbuf.h" +#include "st_cb_bitmap.h" #include "st_cb_drawpixels.h" #include "st_cb_readpixels.h" #include "st_cb_fbo.h" @@ -1063,6 +1064,8 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, /* Mesa state should be up to date by now */ assert(ctx->NewState == 0x0); + st_flush_bitmap_cache(st); + st_validate_state(st); /* Limit the size of the glDrawPixels to the max texture size. @@ -1422,6 +1425,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, GLint readX, readY, readW, readH; struct gl_pixelstore_attrib pack = ctx->DefaultPacking; + st_flush_bitmap_cache(st); + st_validate_state(st); if (type == GL_DEPTH_STENCIL) { diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index b3e4b5bb70c..e6ab77fb521 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -21,6 +21,7 @@ #include "st_context.h" #include "st_atom.h" +#include "st_cb_bitmap.h" #include "st_cb_drawtex.h" #include "pipe/p_context.h" @@ -113,6 +114,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, struct pipe_vertex_element velements[2 + MAX_TEXTURE_UNITS]; unsigned offset; + st_flush_bitmap_cache(st); + st_validate_state(st); /* determine if we need vertex color */ diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 63b46222e6b..d7a97169bc2 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -48,6 +48,7 @@ #include "st_context.h" #include "st_atom.h" +#include "st_cb_bitmap.h" #include "st_cb_bufferobjects.h" #include "st_cb_xformfb.h" #include "st_debug.h" @@ -197,6 +198,8 @@ st_draw_vbo(struct gl_context *ctx, /* Mesa core state should have been validated already */ assert(ctx->NewState == 0x0); + st_flush_bitmap_cache(st); + /* Validate state. */ if (st->dirty.st || ctx->NewDriverState) { st_validate_state(st); diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 88c10a8f150..b6e6dea5b27 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -33,6 +33,7 @@ #include "st_context.h" #include "st_atom.h" +#include "st_cb_bitmap.h" #include "st_cb_bufferobjects.h" #include "st_draw.h" #include "st_program.h" @@ -137,6 +138,8 @@ st_feedback_draw_vbo(struct gl_context *ctx, assert(draw); + st_flush_bitmap_cache(st); + st_validate_state(st); if (!index_bounds_valid) -- 2.30.2