From e027935a795ecf546f3e4abcc25655766f9615ac Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 22 Feb 2017 19:59:27 +0100 Subject: st/mesa: don't update unrelated states in non-draw calls such as Clear If a VAO isn't bound and u_vbuf isn't enabled because of the Core profile, we'll get user vertex buffers in drivers if we update vertex buffers in glClear. So don't do that. This fixes a regression since disabling u_vbuf for Core profiles. Reviewed-by: Brian Paul --- src/mesa/state_tracker/st_atom.c | 10 ++++++++++ src/mesa/state_tracker/st_atom.h | 7 +++++++ src/mesa/state_tracker/st_cb_clear.c | 2 +- src/mesa/state_tracker/st_cb_fbo.c | 2 +- src/mesa/state_tracker/st_cb_msaa.c | 2 +- src/mesa/state_tracker/st_cb_readpixels.c | 2 +- 6 files changed, 21 insertions(+), 4 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 65ac5170fdf..4bef3423b07 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -176,6 +176,16 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline ) pipeline_mask = ST_PIPELINE_RENDER_STATE_MASK; break; + case ST_PIPELINE_CLEAR: + st_manager_validate_framebuffers(st); + pipeline_mask = ST_PIPELINE_CLEAR_STATE_MASK; + break; + + case ST_PIPELINE_UPDATE_FRAMEBUFFER: + st_manager_validate_framebuffers(st); + pipeline_mask = ST_PIPELINE_UPDATE_FB_STATE_MASK; + break; + case ST_PIPELINE_COMPUTE: { struct st_compute_program *old_cp = st->cp; struct gl_program *new_cp = ctx->ComputeProgram._Current; diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index 37e382c4456..45c3e487647 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -43,6 +43,8 @@ struct st_context; */ enum st_pipeline { ST_PIPELINE_RENDER, + ST_PIPELINE_CLEAR, + ST_PIPELINE_UPDATE_FRAMEBUFFER, ST_PIPELINE_COMPUTE, }; @@ -145,6 +147,11 @@ enum { /* All state flags within each group: */ #define ST_PIPELINE_RENDER_STATE_MASK (ST_NEW_CS_STATE - 1) #define ST_PIPELINE_COMPUTE_STATE_MASK (0xffllu << ST_NEW_CS_STATE_INDEX) +#define ST_PIPELINE_CLEAR_STATE_MASK (ST_NEW_FB_STATE | \ + ST_NEW_SCISSOR | \ + ST_NEW_WINDOW_RECTANGLES) +/* For ReadPixels, ReadBuffer, GetSamplePosition: */ +#define ST_PIPELINE_UPDATE_FB_STATE_MASK (ST_NEW_FB_STATE) #define ST_ALL_STATES_MASK (ST_PIPELINE_RENDER_STATE_MASK | \ ST_PIPELINE_COMPUTE_STATE_MASK) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 158efc186c0..f507775da20 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -406,7 +406,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) st_invalidate_readpix_cache(st); /* This makes sure the pipe has the latest scissor, etc values */ - st_validate_state( st, ST_PIPELINE_RENDER ); + st_validate_state(st, ST_PIPELINE_CLEAR); if (mask & BUFFER_BITS_COLOR) { for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index d762ca660a4..78433bff046 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -734,7 +734,7 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer) /* add the buffer */ st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex); _mesa_update_state(ctx); - st_validate_state(st, ST_PIPELINE_RENDER); + st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER); } } diff --git a/src/mesa/state_tracker/st_cb_msaa.c b/src/mesa/state_tracker/st_cb_msaa.c index 22001e49973..7f1b4fde91d 100644 --- a/src/mesa/state_tracker/st_cb_msaa.c +++ b/src/mesa/state_tracker/st_cb_msaa.c @@ -45,7 +45,7 @@ st_GetSamplePosition(struct gl_context *ctx, { struct st_context *st = st_context(ctx); - st_validate_state(st, ST_PIPELINE_RENDER); + st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER); if (st->pipe->get_sample_position) st->pipe->get_sample_position(st->pipe, diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 78ea0c7bf8c..795519d0a7e 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -422,7 +422,7 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y, /* Validate state (to be sure we have up-to-date framebuffer surfaces) * and flush the bitmap cache prior to reading. */ - st_validate_state(st, ST_PIPELINE_RENDER); + st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER); st_flush_bitmap_cache(st); if (!st->prefer_blit_based_texture_transfer) { -- cgit v1.2.3