diff options
author | Marek Olšák <[email protected]> | 2017-05-08 02:11:31 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-05-10 19:29:08 +0200 |
commit | 94506e56424970f30861baf2808020609d752b00 (patch) | |
tree | 73697b649b09f581ef8b35afca50e47fcf7f5e67 /src | |
parent | f60f14bdb3ecb3327b964f74de794c4d04ab194e (diff) |
st/mesa: unify common code in st_draw_vbo functions
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_draw.c | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 78aabb08962..15c5b80f291 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -124,6 +124,23 @@ translate_prim(const struct gl_context *ctx, unsigned prim) return prim; } +static inline void +prepare_draw(struct st_context *st, struct gl_context *ctx) +{ + /* Mesa core state should have been validated already */ + assert(ctx->NewState == 0x0); + + if (unlikely(!st->bitmap.cache.empty)) + st_flush_bitmap_cache(st); + + st_invalidate_readpix_cache(st); + + /* Validate state. */ + if ((st->dirty | ctx->NewDriverState) & ST_PIPELINE_RENDER_STATE_MASK || + st->gfx_shaders_may_be_dirty) { + st_validate_state(st, ST_PIPELINE_RENDER); + } +} /** * This function gets plugged into the VBO module and is called when @@ -148,23 +165,10 @@ st_draw_vbo(struct gl_context *ctx, unsigned i; unsigned start = 0; - /* Mesa core state should have been validated already */ - assert(ctx->NewState == 0x0); - - if (unlikely(!st->bitmap.cache.empty)) - st_flush_bitmap_cache(st); - - st_invalidate_readpix_cache(st); - - /* Validate state. */ - if ((st->dirty | ctx->NewDriverState) & ST_PIPELINE_RENDER_STATE_MASK || - st->gfx_shaders_may_be_dirty) { - st_validate_state(st, ST_PIPELINE_RENDER); - } + prepare_draw(st, ctx); - if (st->vertex_array_out_of_memory) { + if (st->vertex_array_out_of_memory) return; - } /* Initialize pipe_draw_info. */ info.primitive_restart = false; @@ -253,21 +257,11 @@ st_indirect_draw_vbo(struct gl_context *ctx, struct pipe_draw_info info; struct pipe_draw_indirect_info indirect; - /* Mesa core state should have been validated already */ - assert(ctx->NewState == 0x0); assert(stride); + prepare_draw(st, ctx); - st_invalidate_readpix_cache(st); - - /* Validate state. */ - if ((st->dirty | ctx->NewDriverState) & ST_PIPELINE_RENDER_STATE_MASK || - st->gfx_shaders_may_be_dirty) { - st_validate_state(st, ST_PIPELINE_RENDER); - } - - if (st->vertex_array_out_of_memory) { + if (st->vertex_array_out_of_memory) return; - } memset(&indirect, 0, sizeof(indirect)); util_draw_init_info(&info); |