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 <brianp@vmware.com>
This commit is contained in:
Marek Olšák 2017-02-22 19:59:27 +01:00
parent cc2f92b09f
commit e027935a79
6 changed files with 21 additions and 4 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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++) {

View file

@ -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);
}
}

View file

@ -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,

View file

@ -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) {