mesa: don't flag _NEW_DEPTH in Begin/EndQuery if driver implements the functions
authorMarek Olšák <maraeo@gmail.com>
Mon, 15 Apr 2013 01:41:43 +0000 (03:41 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 24 Apr 2013 01:23:23 +0000 (03:23 +0200)
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>
src/mesa/drivers/dri/i965/brw_cc.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_queryobj.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm_state.c
src/mesa/main/queryobj.c

index f5affcfedc59a5cd8702cf334c55d2543374d85f..988b85e73c95c3d0ade8cd6dbd67c48e4bcc17c7 100644 (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,
index 2ad62cd3a915328eff9d5ee00ead89ae134b0400..c9aa090f33f3b524b64e8d9b0a86d60af0078852 100644 (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 */
index 81e975a186039a02be316708a98a29608dec8cac..40f926ba1e02b1e4f2aa32f7a148d6e217e0e7ce 100644 (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:
index 9b30ba1ad553703cfd407d927e0c7a1630946545..60dc14a34a58c6e8ce5a0c3557929f4037d7ebd2 100644 (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
 };
index 342a0366257384b9302d42320a69b90c372db122..4bac56ab74736cb072737bfddcbb27938f6f0c58 100644 (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)
index 1ea2eb1f48d49e68e2ea498cb1b53fe4b288da48..f0c00974d8fed58e5c6b464812a9ed2768857d25 100644 (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) {