swr: [rasterizer jitter] fetch support for offsetting VertexID
[mesa.git] / src / gallium / drivers / swr / swr_query.cpp
index 5c599654ba90ac99bd89777bd5f2878cfefbddc3..35d0e53fb2375c5d62e8823f39a8be7ba8ecf889 100644 (file)
@@ -63,7 +63,7 @@ swr_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
 
    if (pq->fence) {
       if (swr_is_fence_pending(pq->fence))
-         swr_fence_finish(pipe->screen, pq->fence, 0);
+         swr_fence_finish(pipe->screen, NULL, pq->fence, 0);
       swr_fence_reference(pipe->screen, &pq->fence, NULL);
    }
 
@@ -91,18 +91,17 @@ swr_gather_stats(struct pipe_context *pipe, struct swr_query *pq)
       /* nothing to do here */
       break;
    default:
-      /*
-       * All other results are collected from SwrCore counters via
-       * SwrGetStats. This returns immediately, but results are later filled
-       * in by the backend.  Fence status is the only indication of
-       * completion.  */
-      SwrGetStats(ctx->swrContext, &result->core);
+      /* TODO: should fence instead of stalling pipeline */
+      SwrWaitForIdle(ctx->swrContext);
+      memcpy(&result->core, &ctx->stats, sizeof(result->core));
 
+#if 0
       if (!pq->fence) {
          struct swr_screen *screen = swr_screen(pipe->screen);
          swr_fence_reference(pipe->screen, &pq->fence, screen->flush_fence);
       }
       swr_fence_submit(ctx, pq->fence);
+#endif
 
       /* Only change stat collection if there are no active queries */
       if (ctx->active_queries == 0)
@@ -128,7 +127,7 @@ swr_get_query_result(struct pipe_context *pipe,
       if (!wait && !swr_is_fence_done(pq->fence))
          return FALSE;
 
-      swr_fence_finish(pipe->screen, pq->fence, 0);
+      swr_fence_finish(pipe->screen, NULL, pq->fence, 0);
       swr_fence_reference(pipe->screen, &pq->fence, NULL);
    }
 
@@ -152,6 +151,7 @@ swr_get_query_result(struct pipe_context *pipe,
       break;
    case PIPE_QUERY_PRIMITIVES_GENERATED:
       result->u64 = end->core.IaPrimitives - start->core.IaPrimitives;
+      break;
    case PIPE_QUERY_PRIMITIVES_EMITTED:
       result->u64 = end->core.SoNumPrimsWritten[index]
          - start->core.SoNumPrimsWritten[index];