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 <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Marek Olšák
2013-04-15 03:41:43 +02:00
parent 629813d9de
commit 43dac2700c
6 changed files with 14 additions and 8 deletions
+1 -1
View File
@@ -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,
+2
View File
@@ -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 */
+2
View File
@@ -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:
+2 -1
View File
@@ -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
};
+3 -3
View File
@@ -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)
+4 -3
View File
@@ -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) {