gk110/ir: add emission for OP_SULDB and OP_SUSTx
[mesa.git] / src / gallium / drivers / freedreno / freedreno_draw.c
index 6831a58749cbc5a6fa3a6e1aa6c924f550976db9..66bb1163df234cfc4c5049a4cb6c891aa3242640 100644 (file)
@@ -88,6 +88,10 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
                return;
        }
 
+       /* TODO: push down the region versions into the tiles */
+       if (!fd_render_condition_check(pctx))
+               return;
+
        /* emulate unsupported primitives: */
        if (!fd_supported_prim(ctx, info->mode)) {
                if (ctx->streamout.num_targets > 0)
@@ -170,7 +174,16 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
        prims = u_reduced_prims_for_vertices(info->mode, info->count);
 
        ctx->stats.draw_calls++;
-       ctx->stats.prims_emitted += prims;
+
+       /* TODO prims_emitted should be clipped when the stream-out buffer is
+        * not large enough.  See max_tf_vtx().. probably need to move that
+        * into common code.  Although a bit more annoying since a2xx doesn't
+        * use ir3 so no common way to get at the pipe_stream_output_info
+        * which is needed for this calculation.
+        */
+       if (ctx->streamout.num_targets > 0)
+               ctx->stats.prims_emitted += prims;
+       ctx->stats.prims_generated += prims;
 
        /* any buffers that haven't been cleared yet, we need to restore: */
        ctx->restore |= buffers & (FD_BUFFER_ALL & ~ctx->cleared);
@@ -185,7 +198,10 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
        ctx->draw_vbo(ctx, info);
 
        for (i = 0; i < ctx->streamout.num_targets; i++)
-               ctx->streamout.offsets[i] += prims;
+               ctx->streamout.offsets[i] += info->count;
+
+       if (fd_mesa_debug & FD_DBG_DDRAW)
+               ctx->dirty = 0xffffffff;
 
        /* if an app (or, well, piglit test) does many thousands of draws
         * without flush (or anything which implicitly flushes, like
@@ -217,6 +233,10 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
        unsigned cleared_buffers;
        int i;
 
+       /* TODO: push down the region versions into the tiles */
+       if (!fd_render_condition_check(pctx))
+               return;
+
        /* for bookkeeping about which buffers have been cleared (and thus
         * can fully or partially skip mem2gmem) we need to ignore buffers
         * that have already had a draw, in case apps do silly things like