Mesa (master): st/mesa: don' t update unrelated states in non-draw calls such as Clear
Marek Olšák
mareko at kemper.freedesktop.org
Fri Feb 24 23:15:14 UTC 2017
Module: Mesa
Branch: master
Commit: e027935a795ecf546f3e4abcc25655766f9615ac
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e027935a795ecf546f3e4abcc25655766f9615ac
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Feb 22 19:59:27 2017 +0100
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 at vmware.com>
---
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(-)
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 65ac517..4bef342 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 37e382c..45c3e48 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 158efc1..f507775 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 d762ca6..78433bf 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 22001e4..7f1b4fd 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 78ea0c7..795519d 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) {
More information about the mesa-commit
mailing list