From 43dac2700ca05bc773b3fd84fab6f8c1f83079d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 15 Apr 2013 03:41:43 +0200 Subject: [PATCH] mesa: don't flag _NEW_DEPTH in Begin/EndQuery if driver implements the functions We don't want to set the flag for Gallium. I think only swrast needs the flag to be set for occlusion queries. v2: fix stats_wm updates in i965 Reviewed-by: Brian Paul Reviewed-by: Eric Anholt --- 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 f5affcfedc5..988b85e73c9 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 2ad62cd3a91..c9aa090f33f 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 81e975a1860..40f926ba1e0 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 9b30ba1ad55..60dc14a34a5 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 342a0366257..4bac56ab747 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 1ea2eb1f48d..f0c00974d8f 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -75,7 +75,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 */ } @@ -86,6 +86,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; } @@ -314,7 +315,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) { @@ -391,7 +392,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) { -- 2.30.2