[Mesa-dev] [PATCH 11/14] mesa: don't flag _NEW_DEPTH in Begin/EndQuery if driver implements the functions
Marek Olšák
maraeo at gmail.com
Tue Apr 16 09:03:09 PDT 2013
We don't want to set the flag for Gallium.
I think only swrast needs the flag to be set for occlusion queries.
Reviewed-by: Brian Paul <brianp at vmware.com>
v2: fix stats_wm updates in i965
---
Something like this, Eric?
src/mesa/drivers/dri/i965/brw_cc.c | 2 +-
src/mesa/drivers/dri/i965/brw_context.h | 2 ++
src/mesa/drivers/dri/i965/brw_queryobj.c | 2 ++
src/mesa/drivers/dri/i965/brw_wm.c | 3 ++-
src/mesa/drivers/dri/i965/brw_wm_state.c | 6 +++---
src/mesa/main/queryobj.c | 7 ++++---
6 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c
index f5affcf..988b85e 100644
--- a/src/mesa/drivers/dri/i965/brw_cc.c
+++ b/src/mesa/drivers/dri/i965/brw_cc.c
@@ -230,7 +230,7 @@ static void upload_cc_unit(struct brw_context *brw)
const struct brw_tracked_state brw_cc_unit = {
.dirty = {
.mesa = _NEW_STENCIL | _NEW_COLOR | _NEW_DEPTH,
- .brw = BRW_NEW_BATCH,
+ .brw = BRW_NEW_BATCH | BRW_NEW_STATS_WM,
.cache = CACHE_NEW_CC_VP
},
.emit = upload_cc_unit,
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 2ad62cd..c9aa090 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -152,6 +152,7 @@ enum brw_state_id {
BRW_STATE_VUE_MAP_GEOM_OUT,
BRW_STATE_TRANSFORM_FEEDBACK,
BRW_STATE_RASTERIZER_DISCARD,
+ BRW_STATE_STATS_WM,
};
#define BRW_NEW_URB_FENCE (1 << BRW_STATE_URB_FENCE)
@@ -182,6 +183,7 @@ enum brw_state_id {
#define BRW_NEW_VUE_MAP_GEOM_OUT (1 << BRW_STATE_VUE_MAP_GEOM_OUT)
#define BRW_NEW_TRANSFORM_FEEDBACK (1 << BRW_STATE_TRANSFORM_FEEDBACK)
#define BRW_NEW_RASTERIZER_DISCARD (1 << BRW_STATE_RASTERIZER_DISCARD)
+#define BRW_NEW_STATS_WM (1 << BRW_STATE_STATS_WM)
struct brw_state_flags {
/** State update flags signalled by mesa internals */
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 194725c..54bdfc9 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -339,6 +339,7 @@ brw_begin_query(struct gl_context *ctx, struct gl_query_object *q)
* so turn them on now.
*/
intel->stats_wm++;
+ brw->state.dirty.brw |= BRW_NEW_STATS_WM;
break;
case GL_PRIMITIVES_GENERATED:
@@ -411,6 +412,7 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q)
brw->query.obj = NULL;
intel->stats_wm--;
+ brw->state.dirty.brw |= BRW_NEW_STATS_WM;
break;
case GL_PRIMITIVES_GENERATED:
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 9b30ba1..60dc14a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -509,7 +509,8 @@ const struct brw_tracked_state brw_wm_prog = {
_NEW_MULTISAMPLE),
.brw = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_REDUCED_PRIMITIVE |
- BRW_NEW_VUE_MAP_GEOM_OUT)
+ BRW_NEW_VUE_MAP_GEOM_OUT |
+ BRW_NEW_STATS_WM)
},
.emit = brw_upload_wm_prog
};
diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c
index 342a036..4bac56a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_state.c
@@ -203,7 +203,7 @@ brw_upload_wm_unit(struct brw_context *brw)
/* _NEW_LINE */
wm->wm5.line_stipple = ctx->Line.StippleFlag;
- /* _NEW_DEPTH */
+ /* BRW_NEW_STATS_WM */
if (unlikely(INTEL_DEBUG & DEBUG_STATS) || intel->stats_wm)
wm->wm4.stats_enable = 1;
@@ -237,13 +237,13 @@ const struct brw_tracked_state brw_wm_unit = {
_NEW_POLYGONSTIPPLE |
_NEW_LINE |
_NEW_COLOR |
- _NEW_DEPTH |
_NEW_BUFFERS),
.brw = (BRW_NEW_BATCH |
BRW_NEW_PROGRAM_CACHE |
BRW_NEW_FRAGMENT_PROGRAM |
- BRW_NEW_CURBE_OFFSETS),
+ BRW_NEW_CURBE_OFFSETS |
+ BRW_NEW_STATS_WM),
.cache = (CACHE_NEW_WM_PROG |
CACHE_NEW_SAMPLER)
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index f0db740..29ab149 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -76,7 +76,7 @@ _mesa_new_query_object(struct gl_context *ctx, GLuint id)
static void
_mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q)
{
- /* no-op */
+ ctx->NewState |= _NEW_DEPTH; /* for swrast */
}
@@ -87,6 +87,7 @@ _mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q)
static void
_mesa_end_query(struct gl_context *ctx, struct gl_query_object *q)
{
+ ctx->NewState |= _NEW_DEPTH; /* for swrast */
q->Ready = GL_TRUE;
}
@@ -315,7 +316,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
if (!query_error_check_index(ctx, target, index))
return;
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ FLUSH_VERTICES(ctx, 0);
bindpt = get_query_binding_point(ctx, target);
if (!bindpt) {
@@ -392,7 +393,7 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index)
if (!query_error_check_index(ctx, target, index))
return;
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ FLUSH_VERTICES(ctx, 0);
bindpt = get_query_binding_point(ctx, target);
if (!bindpt) {
--
1.7.10.4
More information about the mesa-dev
mailing list